net.rim.device.api.openvg
Class VGUtils

java.lang.Object
  extended by net.rim.device.api.openvg.VGUtils

public final class VGUtils
extends Object

Provides a set of utility methods for OpenVG applications.

This class has BlackBerry extension to help use OpenVG and also contains OpenVG VGU functions that allow applications to specify a number of higher-level geometric primitives to be appended to a path. Each primitive is immediately reduced to a series of line segments, Bιzier curves, and arcs. Coordinates may overflow silently if they fall outside the range defined by the path datatype, scale, and bias.

VGU provides three utility functions to compute 3x3 projective transform matrices. The first two compute the transformation from an arbitrary quadrilateral onto the unit square, and vice versa. The third computes the transformation from an arbitrary quadrilateral to an arbitrary quadrilateral. The output transformation is stored into matrix as 9 elements in the order { sx, shy, w0, shx, sy, w1, tx, ty, w2 }. In all cases, if there is no projective mapping that satisfies the given constraints, or the mapping would be degenerate (i.e., non-invertible), VGU_BAD_WARP_ERROR is returned and matrix is unchanged. Formulas for computing projective warps may be found in [HECK89] and [WOLB90].

Since:
BlackBerry API 6.0.0

Field Summary
static int VGU_ARC_CHORD
          OpenVG VGU 1.0 constant.
static int VGU_ARC_OPEN
          OpenVG VGU 1.0 constant.
static int VGU_ARC_PIE
          OpenVG VGU 1.0 constant.
static int VGU_BAD_HANDLE_ERROR
          OpenVG VGU 1.0 constant.
static int VGU_BAD_WARP_ERROR
          OpenVG VGU 1.0 constant.
static int VGU_ILLEGAL_ARGUMENT_ERROR
          OpenVG VGU 1.0 constant.
static int VGU_NO_ERROR
          OpenVG VGU 1.0 constant.
static int VGU_OUT_OF_MEMORY_ERROR
          OpenVG VGU 1.0 constant.
static int VGU_PATH_CAPABILITY_ERROR
          OpenVG VGU 1.0 constant.
 
Method Summary
static VG getVG(EGLContext context)
          Returns a VG object associated with this EGL context.
static boolean isSupported()
          Determines whether or not the device supports OpenVG.
static int vgCreateImage(VG vg, Bitmap bitmap, boolean flipY, int allowedQuality)
          The vgCreateImage creates a VGImage from the specified bitmap.
static float vgDrawText(VG vg, Font font, String str, int strOffset, int strLength, DrawTextParam params, TextMetrics metrics)
          The vgDrawText draws the specified string using the font and text renderering parameters.
static void vgImageSubData(VG vg, Bitmap bitmap, boolean flipY, int image)
          The vgImageSubData load the sub data from a bitmap into an destination VGImage.
static int vguArc(VG vg, int path, float x, float y, float width, float height, float startAngle, float angleExtent, int arcType)
          The vguEllipse appends an elliptical arc to a path, possibly along with one or two line segments, according to the arcType parameter.
static int vguComputeWarpQuadToQuad(VG vg, float dx0, float dy0, float dx1, float dy1, float dx2, float dy2, float dx3, float dy3, float sx0, float sy0, float sx1, float sy1, float sx2, float sy2, float sx3, float sy3, float[] matrix, int offset)
          The vguComputeWarpQuadToSquare sets the entries of matrix to a projective transformation that maps the point: (sx0, sy0) to (dx0, dy0); (sx1, sy1) to (dx1, dy1); (sx2, sy2) to (dx2, dy2); and (sx3, sy3) to (dx3, dy3).
static int vguComputeWarpQuadToQuad(VG vg, float dx0, float dy0, float dx1, float dy1, float dx2, float dy2, float dx3, float dy3, float sx0, float sy0, float sx1, float sy1, float sx2, float sy2, float sx3, float sy3, FloatBuffer buffer)
          The floating-point Buffer version of vguComputeWarpQuadToQuad.
static int vguComputeWarpQuadToSquare(VG vg, float sx0, float sy0, float sx1, float sy1, float sx2, float sy2, float sx3, float sy3, float[] matrix, int offset)
          The vguComputeWarpQuadToSquare sets the entries of matrix to a projective transformation that maps the point: (sx0, sy0) to (0, 0); (sx1, sy1) to (1, 0); (sx2, sy2) to (0, 1); and (sx3, sy3) to (1, 1).
static int vguComputeWarpQuadToSquare(VG vg, float sx0, float sy0, float sx1, float sy1, float sx2, float sy2, float sx3, float sy3, FloatBuffer buffer)
          The floating-point Buffer version of vguComputeWarpQuadToSquare.
static int vguComputeWarpSquareToQuad(VG vg, float dx0, float dy0, float dx1, float dy1, float dx2, float dy2, float dx3, float dy3, float[] matrix, int offset)
          The vguComputeWarpSquareToQuad sets the entries of matrix to a projective transformation that maps the point: (0, 0) to (dx0, dy0); (1, 0) to (dx1, dy1); (0, 1) to (dx2, dy2); and (1, 1) to (dx3, dy3).
static int vguComputeWarpSquareToQuad(VG vg, float dx0, float dy0, float dx1, float dy1, float dx2, float dy2, float dx3, float dy3, FloatBuffer buffer)
          The floating-point Buffer version of vguComputeWarpSquareToQuad.
static int vguEllipse(VG vg, int path, float cx, float cy, float width, float height)
          The vguEllipse appends an axis-aligned ellipse to a path.
static int vguLine(VG vg, int path, float x0, float y0, float x1, float y1)
          The vguLine appends a line segment to a path.
static int vguPolygon(VG vg, int path, float[] points, int offset, int count, boolean closed)
          The vguPolygon appends a polyline or polygon to a path.
static int vguPolygon(VG vg, int path, FloatBuffer points, boolean closed)
          The floating-point Buffer version of vguPolygon.
static int vguRect(VG vg, int path, float x, float y, float width, float height)
          The vguRect appends an axis-aligned rectangle with its lower-left corner at (x, y) and a given width and height to a path.
static int vguRoundRect(VG vg, int path, float x, float y, float width, float height, float arcWidth, float arcHeight)
          The vguRoundRect appends an axis-aligned round-cornered rectangle with the lower-left corner of its rectangular bounding box at (x, y) and a given width, height, arcWidth, and arcHeight to a path.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 



Field Detail

VGU_NO_ERROR

public static final int VGU_NO_ERROR
OpenVG VGU 1.0 constant.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

VGU_BAD_HANDLE_ERROR

public static final int VGU_BAD_HANDLE_ERROR
OpenVG VGU 1.0 constant.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

VGU_ILLEGAL_ARGUMENT_ERROR

public static final int VGU_ILLEGAL_ARGUMENT_ERROR
OpenVG VGU 1.0 constant.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

VGU_OUT_OF_MEMORY_ERROR

public static final int VGU_OUT_OF_MEMORY_ERROR
OpenVG VGU 1.0 constant.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

VGU_PATH_CAPABILITY_ERROR

public static final int VGU_PATH_CAPABILITY_ERROR
OpenVG VGU 1.0 constant.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

VGU_BAD_WARP_ERROR

public static final int VGU_BAD_WARP_ERROR
OpenVG VGU 1.0 constant.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

VGU_ARC_OPEN

public static final int VGU_ARC_OPEN
OpenVG VGU 1.0 constant.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

VGU_ARC_CHORD

public static final int VGU_ARC_CHORD
OpenVG VGU 1.0 constant.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0

VGU_ARC_PIE

public static final int VGU_ARC_PIE
OpenVG VGU 1.0 constant.

See Also:
Constant Field Values
Since:
BlackBerry API 6.0.0


Method Detail

getVG

public static VG getVG(EGLContext context)
Returns a VG object associated with this EGL context.

To call extension methods, cast the returned object to the interface type that contains the methods of the extension.

Returns:
a VG instance that implements all available extension interfaces.
Throws:
UnsupportedOperationException - if the device does not support OpenVG)
IllegalStateException - if this context is not an OpenVG context.
Since:
BlackBerry API 6.0.0

isSupported

public static boolean isSupported()
Determines whether or not the device supports OpenVG.

To query the actual version of OpenVG supported for the device, use vgGetString(int).

Returns:
true if the device supports some version of OpenVG, false otherwise.
Since:
BlackBerry API 6.0.0

vgCreateImage

public static int vgCreateImage(VG vg,
                                Bitmap bitmap,
                                boolean flipY,
                                int allowedQuality)
The vgCreateImage creates a VGImage from the specified bitmap.

Parameters:
vg - The OpenVG renderer.
bitmap - The source bitmap to create the image from.
flipY - if true the image is flipped on the y axis so that image coordinate are top-left which is same as the image data in the bitmap.
allowedQuality - The allowed image quality.

Errors

VGU_ILLEGAL_ARGUMENT_ERROR is generated: - if allowedQuality is not a bitwise combination of: VG_IMAGE_QUALITY_NONANTIALIASED, VG_IMAGE_QUALITY_FASTER or VG_IMAGE_QUALITY_BETTER.

Returns:
The created VGImage or VG_INVALID_HANDLE if an error occurred.
Throws:
IllegalArgumentException - if vg is null.
IllegalArgumentException - if bitmap is null.
Since:
BlackBerry API 6.0.0

vgImageSubData

public static void vgImageSubData(VG vg,
                                  Bitmap bitmap,
                                  boolean flipY,
                                  int image)
The vgImageSubData load the sub data from a bitmap into an destination VGImage.

Errors:

VG_BAD_HANDLE_ERROR

vgDrawText

public static float vgDrawText(VG vg,
                               Font font,
                               String str,
                               int strOffset,
                               int strLength,
                               DrawTextParam params,
                               TextMetrics metrics)
The vgDrawText draws the specified string using the font and text renderering parameters.

Parameters:
vg - The OpenVG renderer.
font - The font to draw with.
str - The The string or substring to be drawn.
strOffset - The start offset of the substring.
strLength - The length of substring.
params - The text parameters to control drawing. If null this uses the defaults drawing parameters.
metrics - The text metrics gathered for the drawing call. If null then no metrics are computed/updated.
Returns:
The linear advance width in pixels of the text substring drawn.
Throws:
IllegalArgumentException - if vg is null.
IllegalArgumentException - if font is null.
IllegalArgumentException - if str is null.
IllegalArgumentException - if strOffset + strLength is greater than str.length().
Since:
BlackBerry API 6.0.0

vguLine

public static int vguLine(VG vg,
                          int path,
                          float x0,
                          float y0,
                          float x1,
                          float y1)
The vguLine appends a line segment to a path.

Equivalent to the following pseudo-code:

  LINE(x0, y0, x1, y1):
 
  MOVE_TO_ABS x0, y0
  LINE_TO_ABS x1, y1
 

Errors

VGU_BAD_HANDLE_ERROR is generated: - if path is not a valid path handle, or is not shared with the current context

VGU_PATH_CAPABILITY_ERROR is generated: - if VG_PATH_CAPABILITY_APPEND_TO is not enabled for path

Parameters:
vg - The OpenVG renderer.
path - The path to be appended to.
x0 - The line starting x coordinate.
y0 - The line starting y coordinate.
x1 - The line ending x coordinate.
y1 - The line ending y coordinate.
Returns:
The vgu error code.
Throws:
IllegalArgumentException - if vg is null.
Since:
BlackBerry API 6.0.0

vguPolygon

public static int vguPolygon(VG vg,
                             int path,
                             float[] points,
                             int offset,
                             int count,
                             boolean closed)
The vguPolygon appends a polyline or polygon to a path.

Equivalent to the following pseudo-code:

  POLYGON(points, count):
  
  MOVE_TO_ABS points[0], points[1]
  for (i = 1; i < count; i++) 
  { 
      LINE_TO_ABS points[2*i], points[2*i + 1]
  }
   if (closed) 
      CLOSE_PATH
 

Errors

VGU_BAD_HANDLE_ERROR is generated: - if path is not a valid path handle, or is not shared with the current context

VGU_PATH_CAPABILITY_ERROR is generated: - if VG_PATH_CAPABILITY_APPEND_TO is not enabled for path

VGU_ILLEGAL_ARGUMENT_ERROR is generated: - if points is NULL, - if points is not properly aligned - if count is less than or equal to 0

Parameters:
vg - The OpenVG renderer.
path - The path to be appended to.
points - There are 2 * count coordinates in points.
offset - The offset into the points array.
count - The number of coordinte pairs in the polygon.
closed - true if the polygon should be closed.
Returns:
The vgu error code.
Throws:
IllegalArgumentException - if vg is null.
IllegalArgumentException - if points.length - offset is less than count * 2.
Since:
BlackBerry API 6.0.0

vguPolygon

public static int vguPolygon(VG vg,
                             int path,
                             FloatBuffer points,
                             boolean closed)
The floating-point Buffer version of vguPolygon.

Throws:
IllegalArgumentException - if vg is null.
Since:
BlackBerry API 6.0.0

vguRect

public static int vguRect(VG vg,
                          int path,
                          float x,
                          float y,
                          float width,
                          float height)
The vguRect appends an axis-aligned rectangle with its lower-left corner at (x, y) and a given width and height to a path.

Equivalent to the following pseudo-code:

 RECT(x, y, width, height):
 
 MOVE_TO_ABS x, y
 HLINE_TO_REL width
 VLINE_TO_REL height
 HLINE_TO_REL -width
 CLOSE_PATH
 

Errors

VGU_BAD_HANDLE_ERROR is generated: - if path is not a valid path handle, or is not shared with the current context.

VGU_PATH_CAPABILITY_ERROR is generated: - if VG_PATH_CAPABILITY_APPEND_TO is not enabled for path.

VGU_ILLEGAL_ARGUMENT_ERROR is generated: - if width or height are less than or equal to 0.

Parameters:
vg - The OpenVG renderer.
path - The path to be appended to.
x - The rectangle starting x coordinate.
y - The rectangle starting y coordinate.
width - The rectangle width.
height - The rectangle height.
Returns:
The vgu error code.
Throws:
IllegalArgumentException - if vg is null.
Since:
BlackBerry API 6.0.0

vguRoundRect

public static int vguRoundRect(VG vg,
                               int path,
                               float x,
                               float y,
                               float width,
                               float height,
                               float arcWidth,
                               float arcHeight)
The vguRoundRect appends an axis-aligned round-cornered rectangle with the lower-left corner of its rectangular bounding box at (x, y) and a given width, height, arcWidth, and arcHeight to a path. The arcs are included even when arcWidth and/or arcHeight is 0.

Equivalent to the following pseudo-code:

 ROUNDRECT(x, y, w, h, arcWidth, arcHeight):
 
 MOVE_TO_ABS (x + arcWidth/2), y
 HLINE_TO_REL width – arcWidth
 SCCWARC_TO_REL arcWidth/2, arcHeight/2, 0, arcWidth/2, arcHeight/2
 VLINE_TO_REL height – arcHeight
 SCCWARC_TO_REL arcWidth/2, arcHeight/2, 0, -arcWidth/2, arcHeight/2
 HLINE_TO_REL -(width – arcWidth)
 SCCWARC_TO_REL arcWidth/2, arcHeight/2, 0, -arcWidth/2, -arcHeight/2
 VLINE_TO_REL -(height – arcHeight)
 SCCWARC_TO_REL arcWidth/2, arcHeight/2, 0, arcWidth/2, -arcHeight/2
 CLOSE_PATH
 

Errors

VGU_BAD_HANDLE_ERROR is generated: - if path is not a valid path handle, or is not shared with the current context.

VGU_PATH_CAPABILITY_ERROR is generated: - if VG_PATH_CAPABILITY_APPEND_TO is not enabled for path.

VGU_ILLEGAL_ARGUMENT_ERROR is generated: - if width or height are less than or equal to 0.

Parameters:
vg - The OpenVG renderer.
path - The path to be appended to.
x - The rectangle starting x coordinate.
y - The rectangle starting y coordinate.
width - The rectangle width.
height - The rectangle height.
arcWidth - The rectangle arc width. If arcWidth is less than 0, it is clamped to 0. If arcWidth is greater than width, its value is clamped to that of width.
arcHeight - The rectangle arc height. If arcHeight is less than 0, it is clamped to 0. If arcHeight is greater than height, its value is clamped to that of height.
Returns:
The vgu error code.
Throws:
IllegalArgumentException - if vg is null.
Since:
BlackBerry API 6.0.0

vguEllipse

public static int vguEllipse(VG vg,
                             int path,
                             float cx,
                             float cy,
                             float width,
                             float height)
The vguEllipse appends an axis-aligned ellipse to a path. The center of the ellipse is given by (cx, cy) and the dimensions of the axis-aligned rectangle enclosing the ellipse are given by width and height. The ellipse begins at (cx + width/2, cy) and is stroked as two equal counter-clockwise arcs.

Equivalent to the following pseudo-code:

 ELLIPSE(cx, cy, width, height):
 
 MOVE_TO_ABS cx + width/2, cy
 SCCWARC_TO_REL width/2, height/2, 0, -width, 0
 SCCWARC_TO_REL width/2, height/2, 0, width, 0
 CLOSE_PATH
 

Errors

VGU_BAD_HANDLE_ERROR is generated: - if path is not a valid path handle, or is not shared with the current context.

VGU_PATH_CAPABILITY_ERROR is generated: - if VG_PATH_CAPABILITY_APPEND_TO is not enabled for path.

VGU_ILLEGAL_ARGUMENT_ERROR is generated: - if width or height are less than or equal to 0.

Parameters:
vg - The OpenVG renderer.
path - The path to be appended to.
cx - The ellipse starting center x coordinate.
cy - The ellipse starting center y coordinate.
width - The rectangle width.
height - The rectangle height.
Returns:
The vgu error code.
Throws:
IllegalArgumentException - if vg is null.
Since:
BlackBerry API 6.0.0

vguArc

public static int vguArc(VG vg,
                         int path,
                         float x,
                         float y,
                         float width,
                         float height,
                         float startAngle,
                         float angleExtent,
                         int arcType)
The vguEllipse appends an elliptical arc to a path, possibly along with one or two line segments, according to the arcType parameter. The startAngle and angleExtent parameters are given in degrees, proceeding counter-clockwise from the positive X axis. The arc is defined on the unit circle, then scaled by the width and height of the ellipse; thus, the starting point of the arc has coordinates (x + cos(startAngle)*w/2, y + sin(startAngle)*h/2) and the ending point has coordinates (x + cos(startAngle + angleExtent)*w/2, y + sin(startAngle + angleExtent)*h/2). If angleExtent is negative, the arc will proceed clockwise; if it is larger than 360 or smaller than -360, the arc will wrap around itself.

Defines three values to control the style of arcs drawn by the vguArc function:

  VGU_ARC_OPEN – arc segment only
  VGU_ARC_CHORD – arc, plus line between arc endpoints
  VGU_ARC_PIE – arc, plus lines from each endpoint to the ellipse center.
 

Equivalent to the following pseudo-code:

 ARC(x, y, w, h, startAngle, angleExtent, arcType):
 
 last = startAngle + angleExtent
 MOVE_TO_ABS x+cos(startAngle)*w/2, y+sin(startAngle)*h/2
 if (angleExtent > 0) 
 {     
  angle = startAngle + 180 
  while (angle < last) 
  { 
      SCCWARC_TO_ABS w/2, h/2, 0, x+cos(angle)*w/2, y+sin(angle)*h/2 
      angle += 180 
  } 
  SCCWARC_TO_ABS w/2, h/2, 0, x+cos(last)*w/2, y+sin(last)*h/2} 
  else 
  { 
      angle = startAngle – 180 
      while (angle > last) 
      { 
          SCWARC_TO_ABS w/2, h/2, 0, x+cos(angle)*w/2, y+sin(angle)*h/2 
          angle -= 180 
      } 
      SCWARC_TO_ABS w/2, h/2, 0, x+cos(last)*w/2, y+sin(last)*h/2
  }
  if arcType == VGU_ARC_PIE 
      LINE_TO_ABS x, y
  if arcType == VGU_ARC_PIE || arcType == VGU_ARC_CHORD 
      CLOSE_PATH
 

Errors

VGU_BAD_HANDLE_ERROR is generated: - if path is not a valid path handle, or is not shared with the current context.

VGU_PATH_CAPABILITY_ERROR is generated: - if VG_PATH_CAPABILITY_APPEND_TO is not enabled for path.

VGU_ILLEGAL_ARGUMENT_ERROR is generated: - if width or height are less than or equal to 0. - if arcType is not one of the values from the VGUArcType enumeration

Parameters:
vg - The OpenVG renderer.
path - The path to be appended to.
x - The starting x coordinate.
y - The starting y coordinate.
width - The rectangle width.
height - The rectangle height.
startAngle - The starting angle in degrees.
angleExtent - The angle extent in degrees.
arcType - The type of arc.
Returns:
The vgu error code.
Throws:
IllegalArgumentException - if vg is null.
Since:
BlackBerry API 6.0.0

vguComputeWarpQuadToSquare

public static int vguComputeWarpQuadToSquare(VG vg,
                                             float sx0,
                                             float sy0,
                                             float sx1,
                                             float sy1,
                                             float sx2,
                                             float sy2,
                                             float sx3,
                                             float sy3,
                                             float[] matrix,
                                             int offset)
The vguComputeWarpQuadToSquare sets the entries of matrix to a projective transformation that maps the point: (sx0, sy0) to (0, 0); (sx1, sy1) to (1, 0); (sx2, sy2) to (0, 1); and (sx3, sy3) to (1, 1).

Errors

VGU_ILLEGAL_ARGUMENT_ERROR is generated: - if matrix is not properly aligned

VGU_BAD_WARP_ERROR is generated: - if no non-degenerate transformation satisfies the constraints and the matrix is unchanged.

Parameters:
vg - The OpenVG renderer.
sx0 - Warp point (0,0), x coordinate.
sy0 - Warp point (0,0), y coordinate.
sx1 - Warp point (1,0), x coordinate.
sy1 - Warp point (1,0), y coordinate.
sx2 - Warp point (0,1), x coordinate.
sy2 - Warp point (0,1), y coordinate.
sx3 - Warp point (1,1), x coordinate.
sy3 - Warp point (1,1), y coordinate.
matrix - The matrix to be projected onto.
offset - The matrix array offset.
Returns:
The vgu error code.
Throws:
IllegalArgumentException - if vg is null.
IllegalArgumentException - if matrix.length - offset is less than 9.
Since:
BlackBerry API 6.0.0

vguComputeWarpQuadToSquare

public static int vguComputeWarpQuadToSquare(VG vg,
                                             float sx0,
                                             float sy0,
                                             float sx1,
                                             float sy1,
                                             float sx2,
                                             float sy2,
                                             float sx3,
                                             float sy3,
                                             FloatBuffer buffer)
The floating-point Buffer version of vguComputeWarpQuadToSquare.

Throws:
IllegalArgumentException - if vg is null.
IllegalArgumentException - if buffer.GetRemaining() is less than 9.
Since:
BlackBerry API 6.0.0

vguComputeWarpSquareToQuad

public static int vguComputeWarpSquareToQuad(VG vg,
                                             float dx0,
                                             float dy0,
                                             float dx1,
                                             float dy1,
                                             float dx2,
                                             float dy2,
                                             float dx3,
                                             float dy3,
                                             float[] matrix,
                                             int offset)
The vguComputeWarpSquareToQuad sets the entries of matrix to a projective transformation that maps the point: (0, 0) to (dx0, dy0); (1, 0) to (dx1, dy1); (0, 1) to (dx2, dy2); and (1, 1) to (dx3, dy3).

If no non-degenerate matrix satisfies the constraints, VGU_BAD_WARP_ERROR is returned and matrix is unchanged.

Errors

VGU_ILLEGAL_ARGUMENT_ERROR is generated: - if matrix is not properly aligned

VGU_BAD_WARP_ERROR is generated: - if no non-degenerate transformation satisfies the constraints and the matrix is unchanged.

Parameters:
vg - The OpenVG renderer.
dx0 - Warp point (0,0), x coordinate.
dy0 - Warp point (0,0), y coordinate.
dx1 - Warp point (1,0), x coordinate.
dy1 - Warp point (1,0), y coordinate.
dx2 - Warp point (0,1), x coordinate.
dy2 - Warp point (0,1), y coordinate.
dx3 - Warp point (1,1), x coordinate.
dy3 - Warp point (1,1), y coordinate.
matrix - The matrix to be projected onto.
offset - The matrix array offset.
Returns:
The vgu error code.
Throws:
IllegalArgumentException - if vg is null.
IllegalArgumentException - if matrix.length - offset is less than 9.
Since:
BlackBerry API 6.0.0

vguComputeWarpSquareToQuad

public static int vguComputeWarpSquareToQuad(VG vg,
                                             float dx0,
                                             float dy0,
                                             float dx1,
                                             float dy1,
                                             float dx2,
                                             float dy2,
                                             float dx3,
                                             float dy3,
                                             FloatBuffer buffer)
The floating-point Buffer version of vguComputeWarpSquareToQuad.

Throws:
IllegalArgumentException - if vg is null.
IllegalArgumentException - if buffer.GetRemaining() is less than 9.
Since:
BlackBerry API 6.0.0

vguComputeWarpQuadToQuad

public static int vguComputeWarpQuadToQuad(VG vg,
                                           float dx0,
                                           float dy0,
                                           float dx1,
                                           float dy1,
                                           float dx2,
                                           float dy2,
                                           float dx3,
                                           float dy3,
                                           float sx0,
                                           float sy0,
                                           float sx1,
                                           float sy1,
                                           float sx2,
                                           float sy2,
                                           float sx3,
                                           float sy3,
                                           float[] matrix,
                                           int offset)
The vguComputeWarpQuadToSquare sets the entries of matrix to a projective transformation that maps the point: (sx0, sy0) to (dx0, dy0); (sx1, sy1) to (dx1, dy1); (sx2, sy2) to (dx2, dy2); and (sx3, sy3) to (dx3, dy3).

Errors

VGU_ILLEGAL_ARGUMENT_ERROR is generated: - if matrix is not properly aligned

VGU_BAD_WARP_ERROR is generated: - if no non-degenerate transformation satisfies the constraints and the matrix is unchanged.

Parameters:
vg - The OpenVG renderer.
dx0 - Destination quad, warp point (0,0), x coordinate.
dy0 - Destination quad, warp point (0,0), y coordinate.
dx1 - Destination quad, warp point (1,0), x coordinate.
dy1 - Destination quad, warp point (1,0), y coordinate.
dx2 - Destination quad, warp point (0,1), x coordinate.
dy2 - Destination quad, warp point (0,1), y coordinate.
dx3 - Destination quad, warp point (1,1), x coordinate.
dy3 - Source quad, warp point (1,1), y coordinate.
sx0 - Source quad, warp point (0,0), x coordinate.
sy0 - Source quad, warp point (0,0), y coordinate.
sx1 - Source quad, warp point (1,0), x coordinate.
sy1 - Source quad, warp point (1,0), y coordinate.
sx2 - Source quad, warp point (0,1), x coordinate.
sy2 - Source quad, warp point (0,1), y coordinate.
sx3 - Source quad, warp point (1,1), x coordinate.
sy3 - Source quad, warp point (1,1), y coordinate.
matrix - The matrix to be projected onto.
offset - The matrix array offset.
Returns:
The vgu error code.
Throws:
IllegalArgumentException - if vg is null.
IllegalArgumentException - if matrix.length - offset is less than 9.
Since:
BlackBerry API 6.0.0

vguComputeWarpQuadToQuad

public static int vguComputeWarpQuadToQuad(VG vg,
                                           float dx0,
                                           float dy0,
                                           float dx1,
                                           float dy1,
                                           float dx2,
                                           float dy2,
                                           float dx3,
                                           float dy3,
                                           float sx0,
                                           float sy0,
                                           float sx1,
                                           float sy1,
                                           float sx2,
                                           float sy2,
                                           float sx3,
                                           float sy3,
                                           FloatBuffer buffer)
The floating-point Buffer version of vguComputeWarpQuadToQuad.

Throws:
IllegalArgumentException - if vg is null.
IllegalArgumentException - if buffer.GetRemaining() is less than 9.
Since:
BlackBerry API 6.0.0





Copyright 1999-2010 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark of Sun Microsystems, Inc.