Package net.rim.device.api.openvg

Examples of net.rim.device.api.openvg.VG11


    /**
     * @see net.rim.device.api.openvg.VGField#initialize(VG)
     */
    protected void initialize(final VG g) {
        final VG11 vg = (VG11) g;
        vg.vgSetfv(VG10.VG_CLEAR_COLOR, 4, MY_CLEAR_COLOR, 0);

        final XYRect rect = new XYRect();

        // Create the bitmap from bundled resource "icons.png"
        final Bitmap bitmap = Bitmap.getBitmapResource("icons.png");
View Full Code Here


    /**
     * @see net.rim.device.api.openvg.VGField#render(VG)
     */
    protected void render(final VG g) {
        final VG11 vg = (VG11) g;

        // Clear the display
        vg.vgClear(0, 0, getWidth(), getHeight());

        vg.vgSeti(VG10.VG_MATRIX_MODE, VG10.VG_MATRIX_IMAGE_USER_TO_SURFACE);

        // Shifting bits by >> 1 is equivalent to division by 2
        final float halfIconWidth = ICON_WIDTH >> 1;

        // Go through all the images and rotate them
        // around the center of the screen.
        for (int i = 0; i < _imageHandles.length; i++) {
            // Load clean Identity matrix
            vg.vgLoadIdentity();

            // Translate to the center of the display
            vg.vgTranslate(_xScreenCenter, _yScreenCenter);

            // Rotate the image
            vg.vgRotate(_mainRotation.getFloat() + ROTATE * i);

            // Translate the image half of the icon's width
            vg.vgTranslate(-halfIconWidth, RADIUS);

            // Draw the rotated, translated image
            vg.vgDrawImage(_imageHandles[i]);
        }

        // Draw the text image on this field
        drawText(vg);
    }
View Full Code Here

    /**
     * @see net.rim.device.api.openvg.VGField#initialize(VG)
     */
    protected void initialize(final VG vg) {
        // Code to initialize an OpenVG resource
        final VG11 vg11 = (VG11) vg;
        vg11.vgSetfv(VG10.VG_CLEAR_COLOR, 4, MY_CLEAR_COLOR, 0);

        // Read paths from file
        final PathFileReader pathReader = new PathFileReader();
        _svgPathsArray = pathReader.getPaths(vg11, "/res/paths.txt");

View Full Code Here

    /**
     * @see net.rim.device.api.openvg.VGField#render(VG)
     */
    protected void render(final VG renderer) {
        final VG11 vg11 = (VG11) renderer;

        // Clear the display from the last time it was rendered
        vg11.vgClear(0, 0, getWidth(), getHeight());

        // Draw the text images on this field
        drawText(vg11);

        // Set VG_MATRIX_MODE to VG_MATRIX_PATH_USER_TO_SURFACE
        vg11.vgSeti(VG10.VG_MATRIX_MODE, VG10.VG_MATRIX_PATH_USER_TO_SURFACE);

        // Load a clean identity matrix
        vg11.vgLoadIdentity();

        // Calculate scale factor
        final float scaleFactor =
                Math.min(_displayHeight / PATHS_IMAGE_HEIGHT, _displayWidth
                        / PATHS_IMAGE_WIDTH);

        // Calculate x position
        final float xPos =
                (_displayWidth - PATHS_IMAGE_WIDTH * scaleFactor) / 2;

        // Move the y position to just below the text that was drawn
        final int yPos = _displayHeight - (TEXT_OFFSET + 5);

        // Translate to origin corresponding to SVG (top left)
        vg11.vgTranslate(xPos, yPos);

        // Scale the image
        vg11.vgScale(scaleFactor, -scaleFactor);

        // Draw the image on the screen
        drawPaths(vg11, _svgPathsArray);
    }
View Full Code Here

TOP

Related Classes of net.rim.device.api.openvg.VG11

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.