コード例 #1
0
  /** @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);
  }