OpenVG 1.1 API Quick Reference Card - Page 1

OpenVG® is an API for hardware-accelerated two-dimensional Errors [4.1] vector and raster graphics. It provides a device-independent Error codes and their numerical values are defined by the VGErrorCode enumeration and can be and vendor-neutral interface for sophisticated 2D graphical obtained with the function: VGErrorCode vgGetError(void). The possible values are as follows: applications, while allowing device manufacturers to provide VG_NO_ERROR 0 VG_UNSUPPORTED_IMAGE_FORMAT_ERROR 0x1004 where appropriate. VG_BAD_HANDLE_ERROR 0x1000 VG_UNSUPPORTED_PATH_FORMAT_ERROR 0x1005 • [n.n.n] refers to sections and tables in the OpenVG 1.1 API VG_ILLEGAL_ARGUMENT_ERROR 0x1001 VG_IMAGE_IN_USE_ERROR 0x1006 specification available at www.khronos.org/openvg/ VG_OUT_OF_MEMORY_ERROR 0x1002 VG_NO_CONTEXT_ERROR 0x1007 • Default values are shown in blue. VG_PATH_CAPABILITY_ERROR 0x1003

Data Types & Number Representations Colors [3.4] The sRGB color space defines values R’sRGB, G’sRGB, B’sRGB in terms of the linear lRGB primaries. Primitive Data Types [3.2] Colors in OpenVG other than those stored in image pixels are represented as non-premultiplied sRGBA color values. openvg.h khronos_type.h range Convert from lRGB to sRGB Convert from sRGB to lRGB Image pixel color and alpha values lie in the range [0,1] (gamma mapping) (1) (inverse gamma mapping) (2) VGbyte khronos_int8_t [-128, 127] unless otherwise noted. -1 VGubyte khronos_uint8_t [0, 255] R’sRGB = γ(R) R = γ (R’sRGB) Color Space Definitions -1 The linear lRGB color space is defined in terms of the G’sRGB = γ(G) G = γ (G’sRGB) VGshort khronos_int16_t [-32768, 32767] -1 standard CIE XYZ color space, following ITU Rec. 709 B’sRGB = γ(B) B = γ (B’sRGB) VGushort khronos_uint16_t [0, 65535] using a D65 white point: VGint khronos_int32_t [-2³¹, (2³¹-1)] R = 3.240479 X –1.537150 Y – 0.498535 Z The linear grayscale (luminance) color space (which we VGuint khronos_uint32_t [0, (2³²-1)] G =-0.969256 X +1.875992 Y +0.041556 Z denote as lL) is related to the linear lRGB color space by the equations: VGbitfield khronos_uint32_t [0, (2³²-1)] B = 0.055648 X –0.204043 Y +1.057311 Z L = 0.2126 R + 0.7152 G + 0.0722 B (3) VGboolean khronos_int32_t [0, 1] Color Space Conversions R = G = B = L (4) VGfloat khronos_float_t IEEE 754 Standard In the following table, the source format is in the left column, and the destination format is in the top row. The The perceptually-uniform grayscale color space (which Number Representations [3.3] numbers indicate the numbered equations (n) from this we denote as sL) is related to the linear grayscale section that are to be applied, in left-to-right order: (luminance) color space by the gamma mapping: VG_MAXSHORT largest positive value of VGshort, Src/Dst IRGB sRGB IL sL L’ = γ(L) (5) smallest negative value is -1 (–VG_MAXSHORT – 1) IRGB — 1 3 3, 5 L = γ (L’) (6) sRGB 2 — 2, 3 2, 3, 5 VG_MAXINT largest positive value of VGint, smallest Conversion from perceptually-uniform grayscale to sRGB negative value is (–VG_MAXINT – 1) IL 4 4, 1 — 5 is performed by replication: sL 7, 2 7 6 — R’ = G’ = B’ = L’ (7) VG_MAX_FLOAT largest floating‐point number

Handle-based Data Types [3.6] typedef VGuint VGHandle; Object Parameter Set/Get API [5.3] VGfloat vgGetParameterf(VGHandle obj, VGint paramType) vgGetParameteri obj paramType VGFont reference to font data void vgSetParameterf(VGHandle obj, VGint paramType, VGint (VGHandle , VGint ) VGfloat val) VGint vgGetParameterVectorSize(VGHandle obj, VGint VGImage reference to image data void vgSetParameteri(VGHandle obj, VGint paramType, paramType) VGfloat val) VGMaskLayer reference to mask data void vgGetParameterfv(VGHandle obj, VGint paramType, void vgSetParameterfv(VGHandle obj, VGint paramType, VGint cnt, VGfloat * val) VGPaint reference to a paint specification VGint cnt, const VGfloat * val) void vgGetParameteriv(VGHandle obj, VGint type, VGint cnt, VGPath reference to path data void vgSetParameteriv(VGHandle obj, VGint paramType, VGint cnt, const VGint * val) VGint * val)

Drawing Context [4] EGL Functions[4.2] EGL Attribute List param_name Usable EGLConfigs have EGL_OPENVG_BIT param_name EGL_MAX_SWAP_INTERVAL State Element Description set in EGL_RENDERABLE_TYPE attribute. The EGL_BUFFER_SIZE EGL_LUMINANCE_SIZE Drawing Surface Surface for drawing EGL_ALPHA_MASK_SIZE attribute contains the bit depth of the mask. attrib_list is an EGL_ALPHA_SIZE EGL_ALPHA_MASK_SIZE Matrix Mode Trans. to be manipulated array with pairs of param_name and value, EGL_BLUE_SIZE EGL_COLOR_BUFFER_TYPE Path user‐to‐surface Affine trans. for filled and terminating with EGL_NONE. Transformation stroked geometry See EGL Attribute List EGL_GREEN_SIZE EGL_RENDERABLE_TYPE EGL_RED_SIZE EGL_MATCH_NATIVE_PIXMAP Image user‐to‐ Affine or projective trans. EGLBoolean eglBindAPI(EGLenum ) surface Transform for images api: use EGL_OPENVG_API. to bind OpenVG EGL_DEPTH_SIZE EGL_CONFORMANT Paint‐to‐user Affine transformations for EGLContext eglCreateContext( EGL_STENCIL_SIZE EGL_CONFORMANT_KHR Transformations paint applied to geometry EGLDisplay dpy, EGLConfig config, EGL_CONFIG_CAVEAT EGL_SLOW_CONFIG Glyph user‐to‐surface Affine transformation for EGLContext share_context, EGL_CONFIG_ID EGL_NON_CONFORMANT_CONFIG Transformation glyphs const EGLint * attrib_list) EGL_LEVEL EGL_TRANSPARENT_RGB Glyph origin (X,Y) origin of glyph EGLSurface eglCreateWindowSurface( EGL_MAX_PBUFFER_HEIGHT EGL_RGB_BUFFER Fill Rule Rule for filling paths EGLDisplay dpy, EGLConfig config, NativeWindowType win, EGL_MAX_PBUFFER_PIXELS EGL_LUMINANCE_BUFFER Quality Settings Image and rendering const EGLint * attrib_list) EGL_MAX_PBUFFER_WIDTH EGL_NO_TEXTURE quality, pixel layout EGLSurface EGL_NATIVE_RENDERABLE EGL_TEXTURE_RGB Color Transformation Color Transformation eglCreatePbufferFromClientBuffer( EGL_NATIVE_VISUAL_ID EGL_TEXTURE_RGBA Blend Mode Pixel blend function EGLDisplay dpy, EGLenum buftype, EGL_NATIVE_VISUAL_TYPE EGL_TEXTURE_2D Image Mode Image/paint combination EGLClientBufferbuffer , EGLConfigconfig , EGL_PRESERVED_RESOURCES EGL_PBUFFER_BIT const EGLint * attrib_list) Scissoring Enable/disable scissoring Pbuffer (off-screen buffer) allow rendering into EGL_SAMPLES EGL_PIXMAP_BIT Stroke Stroke parameters a VGImage. EGL_SAMPLE_BUFFER EGL_WINDOW_BIT Pixel & Screen layout Pixel layout information EGLBoolean eglMakeCurrent( EGL_SURFACE_TYPE EGL_VG_COLORSPACE_LINEAR_BIT EGLDisplay dpy, EGLSurface draw, EGL_TRANSPARENT_TYPE EGL_VG_ALPHA_FORMAT_PRE_BIT Tile fill color Color for FILL tiling mode EGLSurface read, EGLContext context) Clear color Color for fast clear Causes the given context to become current on EGL_TRANSPARENT_BLUE_VALUE EGL_OPENGL_ES_BIT EGL_TRANSPARENT_GREEN_VALUE EGL_OPENVG_BIT Filter Parameters Image filtering parameters the running thread. EGL_TRANSPARENT_RED_VALUE Paint Paint definitions EGLContext eglGetCurrentContext() EGL_NONE Forcing Drawing to Complete API [4.3] Mask Coverage mask and EGLBoolean eglDestroyContext( void vgFlush(void) enable/disable EGLDisplay dpy,EGLContext context) EGL_BIND_TO_TEXTURE_RGB Complete requests in finite time. EGL_BIND_TO_TEXTURE_RGBA Error Oldest unreported error EGLBoolean eglSwapBuffers( void vgFinish(void) EGLDisplay dpy, EGLSurface surface) EGL_MIN_SWAP_INTERVAL Complete requests.

©2010 - Rev. 0410 www.khronos.org/openvg OpenVG 1.1 API Quick Reference Card - Page 2

Context Parameters VG_FILL_RULE (VGFillRule) VG_STROKE_LINE_WIDTH (VGfloat) VG_SCISSORING (VGboolean) Context Parameter Set/Get API [5.2] VG_EVEN_ODD VG_NON_ZERO 1.0f VG_TRUE VG_FALSE(disabled) void vgSetf(VGParamType paramType, VG_IMAGE_QUALITY (VGImageQuality) VG_STROKE_CAP_STYLE (VGCapStyle) VG_SCREEN_LAYOUT (VGPixelLayout) VGfloat val) VG_IMAGE_QUALITY_NONANTIALIASED VG_CAP_BUTT VG_PIXEL_LAYOUT (VGPixelLayout) VG_IMAGE_QUALITY_FASTER VG_CAP_ROUND VG_PIXEL_LAYOUT_UNKNOWN* void vgSeti(VGParamType paramType, VG_IMAGE_QUALITY_BETTER VG_CAP_SQUARE VG_PIXEL_LAYOUT_RGB_VERTICAL VGint val) VG_PIXEL_LAYOUT_BGR_VERTICAL void vgSetfv(VGParamType paramType, VG_RENDERING_QUALITY (VGRenderingQuality) VG_STROKE_JOIN_STYLE (VGJoinStyle) VG_PIXEL_LAYOUT_RGB_HORIZONTAL VGint cnt, const VGfloat * val) VG_RENDERING_QUALITY_NONANTIALIASED VG_JOIN_MITER VG_PIXEL_LAYOUT_BGR_HORIZONTAL VG_RENDERING_QUALITY_FASTER VG_JOIN_ROUND * This is the default for VG_PIXEL_LAYOUT only. void vgSetiv(VGParamType paramType, VG_RENDERING_QUALITY_BETTER VG_JOIN_BEVEL VGint cnt, const VGint * val) The default for VG_SCREEN_LAYOUT is the VG_BLEND_MODE (VGBlendMode) layout of the drawing surface. paramType VG_STROKE_MITER_LIMIT (VGfloat) VGfloatvgGetf (VGParamType ) VG_BLEND_SRC 4.0f VG_FILTER_FORMAT_LINEAR (VGboolean) VGint vgGeti(VGParamType paramType) VG_BLEND_SRC_OVER VG_TRUE VG_FALSE (disabled) VG_BLEND_DST_OVER VG_STROKE_DASH_PATTERN (VGfloat *) VGint vgGetVectorSize( VG_BLEND_SRC_IN { } (array of length 0) (disabled) VG_FILTER_FORMAT_PREMULTIPLIED VGParamType paramType) VG_BLEND_DST_IN {on1, off1, on2, off2,….} (VGboolean) void vgGetfv(VGParamType paramType, VG_BLEND_MULTIPLY VG_TRUE VG_FALSE(disabled) VG_BLEND_SCREEN VG_STROKE_DASH_PHASE (VGfloat) VGint cnt, VGfloat * val) 0.0f VG_FILTER_CHANNEL_MASK (VGbitfield) VG_BLEND_DARKEN (VG_RED | VG_GREEN | VG_BLUE | VG_ALPHA) void vgGetiv(VGParamType paramType, VG_BLEND_LIGHTEN VGint cnt, VGint * val) VG_STROKE_DASH_PHASE_RESET (VGboolean) VG_BLEND_ADDITIVE VG_FALSE VG_TRUE Read-Only Context Parameters VG_IMAGE_MODE (VGImageMode) VG_MAX_SCISSOR_RECTS (VGint) Context Parameters [5.2.1] VG_DRAW_IMAGE_NORMAL VG_TILE_FILL_COLOR (VGfloat[4]) The possible values of paramType from VG_DRAW_IMAGE_MULTIPLY {0.0f, 0.0f, 0.0f, 0.0f} VG_MAX_DASH_COUNT (VGint) enumeration VGParamType are shown VG_DRAW_IMAGE_STENCIL {red,green,blue,alpha} VG_MAX_KERNEL_SIZE (VGint) below, with the legal values for val. The VG_SCISSOR_RECTS (VGint *) VG_MAX_SEPARABLE_KERNEL_SIZE (VGint) type of val is shown in parentheses. Default VG_CLEAR_COLOR (VGfloat[4]) { } (array of length 0) {0.0f, 0.0f, 0.0f, 0.0f} VG_MAX_GAUSSIAN_STD_DEVIATION (VGfloat) value shown in blue. {sx1,sy1,w1,h1,…} {red,green,blue,alpha} VG_MAX_COLOR_RAMP_STOPS (VGint) VG_MATRIX_MODE (VGMatrixMode) VG_COLOR_TRANSFORM (VGboolean) VG_MAX_IMAGE_WIDTH (VGint) VG_MATRIX_PATH_USER_TO_SURFACE VG_TRUE VG_FALSE VG_GLYPH_ORIGIN (VGfloat[2]) VG_MATRIX_IMAGE_USER_TO_SURFACE {0.0f, 0.0f} {ox,oy} VG_MAX_IMAGE_HEIGHT (VGint) VG_MATRIX_FILL_PAINT_TO_USER VG_COLOR_TRANSFORM_VALUES (VGfloat[8]) VG_MASKING (VGboolean) VG_MAX_IMAGE_PIXELS (VGint) VG_MATRIX_STROKE_PAINT_TO_USER { 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f } VG_TRUE VG_FALSE(disabled) VG_MAX_IMAGE_BYTES (VGint) {Rf, Gf, Bf, Af, Rb, Gb, Bb, Ab} VG_MATRIX_GLYPH_USER_TO_SURFACE VG_MAX_FLOAT (VGfloat)

Matrix Transformation [6.6] Matrix Manipulation Functions Scissor, Mask, and Fast Clear VGMaskLayer vgCreateMaskLayer( Matrix m = VGint width, VGint height) Select Matrix Mode Scissoring [7.1] { sx, shy, w0, shx, sy, w1, tx, ty, w2 } paramType values for the vgSet*() and void vgDestroyMaskLayer( paramType values for the vgSet*() and In affine transform VGMaskLayer masklayer) vgGet*() functions. vgGet*() functions. Defaults are in blue. w0 = w1 = 0.0, w2 = 1.0 void vgFillMaskLayer( VG_SCISSORING (VGboolean) VG_MATRIX_PATH_USER_TO_SURFACE Affine void vgLoadIdentity(void) VGMaskLayer masklayer, VGint x, VG_TRUE VGint y, VGint width, VGint height, VG_MATRIX_IMAGE_USER_TO_SURFACE Perspective void vgLoadMatrix(const VGfloat *m ) VG_FALSE (disabled) VGfloat val) VG_MATRIX_FILL_PAINT_TO_USER Affine void vgMultMatrix(const VGfloat *m ) VG_SCISSOR_RECTS (VGint *) void vgCopyMask( { } (array of length 0) VGMaskLayer masklayer, VGint x, VG_MATRIX_STROKE_PAINT_TO_USER Affine void vgGetMatrix(VGfloat *m ) {sx1,sy1,w1,h1,…} VGint y, VGint sx, VGint sy, VG_MATRIX_GLYPH_USER_TO_SURFACE Affine void vgTranslate(VGfloattx , VGfloatty ) Example: VGint width, VGint height, VGfloat val) Example: void vgScale(VGfloatsx , VGfloatsy ) #defineNUM_RECTS 2 VGMaskOperation VGint coords[4*NUM_RECTS] Mr=resulting mask, Mn=input mask, vgSeti(VG_MATRIX_MODE, void vgShear(VGfloatshx , VGfloatshy ) = { 20, 30, 100, 200, Mp=previous mask VG_MATRIX_PATH_USER_TO_ 50, 70, 80, 80 }; VG_CLEAR_MASK. . . .Mr = 0 SURFACE); void vgRotate(VGfloatangle ) // order of x, y, w, h VG_FILL_MASK. . . . .Mr = 1 vgSetiv (VG_SCISSOR_RECTS, VG_SET_MASK . . . . .Mr = Mn 4*NUM_RECTS, coords); VG_UNION_MASK...... Mr = 1 - (1-Mn)*(1-Mp) Path Masking [7.2] VG_INTERSECT_MASK . .Mr = Mn * Mp Segment Commands [8.5.2] void vgMask(VGHandle mask, VG_SUBTRACT_MASK. . Mr = Mp * (1-Mn) Reference points are defined as: (sx, sy): beginning of the current subpath; VGMaskOperation op, VGint x, Fast Clear [7.3] (ox, oy): last point of the previous segment; (px, py): last internal control point of the VGint y, VGint width, VGint height) void vgClear(VGint x, VGint y, previous segment if the segment was a (regular or smooth) quadratic or cubic Bézier, VGint width, VGint height) or else the last point of the previous segment. void vgRenderToMask(VGPath path, VGbitfield paintMode, The following table describes each segment command type and the side effects of VGMaskOperation op) the segment command on the termination of the current subpath. VGPathSegment Coordinates Implicit Points Description (Side Effects) VG_CLOSE_PATH none (px,py)=(ox,oy)=(sx,sy) End current subpath. Path Operations [8.6] Path Object Parameter [8.6.3] VG_MOVE_TO x0,y0 (sx,sy)=(px,py)=(ox,oy)=(x0,y0) Path capabilities are specified as bits in a paramType values for the vgSetParameter() End current subpath. VGbitfield, with the following values defined in and vgGetParameter() functions. Default value VG_LINE_TO x0, y0 (px,py)=(ox,oy)=(x0,y0) the VGPathCapabilities enumeration: shown in blue. VG_HLINE_TO x0 y0=oy (px,py)=(x0,oy), ox=x0 VG_PATH_CAPABILITY_APPEND_FROM VG_PATH_FORMAT (VGint) VG_VLINE_TO y0 x0=ox (px,py)=(ox,y0), oy=y0 VG_PATH_CAPABILITY_APPEND_TO VG_PATH_FORMAT_STANDARD 0 VG_QUAD_TO x0,y0,x1,y1 (px,py)=(x0,y0) VG_PATH_CAPABILITY_MODIFY VG_PATH_DATATYPE (VGPathDatatype) (ox,oy)=(x1,y1) VG_PATH_CAPABILITY_TRANSFORM_FROM VG_PATH_DATATYPE_S_{8, 16, 32} VG_PATH_DATATYPE_F VG_CUBIC_TO x0,y0,x1,y1,x2,y2 (px,py)=(x1,y1) VG_PATH_CAPABILITY_TRANSFORM_TO (ox,oy)=(x2,y2) VG_PATH_BIAS (VGfloat) VG_PATH_CAPABILITY_INTERPOLATE_FROM 0.0f VG_SQUAD_TO x1,y1 (x0,y0)= (px,py)=(2*ox-px, 2*oy-py) VG_PATH_CAPABILITY_INTERPOLATE_TO (2*ox‐px,2*oy‐py) (ox,oy)=(x1,y1) VG_PATH_NUM_SEGMENTS (VGint) 0 VG_SCUBIC_TO x1,y1,x2,y2 (x0,y0)= VG_PATH_CAPABILITY_PATH_LENGTH (2*ox‐px,2*oy‐py)(px,py)=(x1,y1),(ox,oy)=(x2,y2) VG_PATH_CAPABILITY_POINT_ALONG_PATH VG_PATH_NUM_COORDS (VGint) 0 VG_SCCWARC_TO rh,rv,rot,x0,y0 (px,py)=(ox,oy)=(x0,y0) VG_PATH_CAPABILITY_TANGENT_ALONG_PATH VG_PATH_SCALE (VGfloat) VG_SCWARC_TO rh,rv,rot,x0,y0 (px,py)=(ox,oy)=(x0,y0) VG_PATH_CAPABILITY_PATH_BOUNDS 1.0f VG_LCCWARC_TO rh,rv,rot,x0,y0 (px,py)=(ox,oy)=(x0,y0) VG_PATH_CAPABILITY_PATH_TRANSFORMED_BOUNDS VG_LCWARC_TO rh,rv,rot,x0,y0 (px,py)=(ox,oy)=(x0,y0) VG_PATH_CAPABILITY_ALL (Continued >)

©2010 Khronos Group - Rev. 0410 www.khronos.org/openvg OpenVG 1.1 API Quick Reference Card - Page 3

Path (continued) void vgAppendPathData(VGPath dstPath, Position & Tangent Along Path[8.6.11] VGint numSeg, const VGubyte * pathSeg, void vgPointAlongPath(VGPath path, VGint startSeg, Create and Destroy Path [8.6.2] const void * pathData) VGint numSeg, VGfloat distance, VGfloat * x, VGPath vgCreatePath(VGint pathFormat, VGfloat * y, VGfloat * tanX, VGfloat *tanY) VGPathDatatype datatype, VGfloat scale, Modify Path Data [8.6.7] VGfloat bias, VGint segCapacityHint, void vgModifyPathCoords(VGPath dstPath, Query Bounding Box [8.6.12] VGint coordCapacityHint, VGbitfield capabilities) VGint startIdx, VGint sumSeg, const void * pathData) void vgPathBounds(VGPath path, VGfloat *minx, VGfloat * miny, VGfloat * width, VGfloat * height) void vgClearPath(VGPath path, Transform Path [8.6.8] VGbitfield capabilities) void vgPathTransformedBounds(VGPath path, (VG_MATRIX_PATH_USER_TO_SURFACE is applied) minx miny width void vgDestroyPath(VGPath path) VGfloat * , VGfloat * , VGfloat * , void vgTransformPath(VGPath dstPath, VGPath srcPath) VGfloat * height) Query & Modify Path Capabilities[8.6.4] Interpolate Between Paths [8.6.9] Draw Path [8.8] path VGbitfield vgGetPathCapabilities(VGPath ) VGboolean vgInterpolatePath(VGPath dstPath, VGfloat vgPathLength(VGPath path, VGint startSeg, void vgRemovePathCapabilities(VGPath path, VGPath startPath, VGPath endPath, VGfloat amount) VGint numSeg) VGbitfield capabilities) VGfloat vgDrawPath(VGPath path, VGbitfield Length of Path [8.6.10] paintModes) Copy Data Between Paths [8.6.5-6] VGfloat vgPathLength(VGPath path, VGint startSeg, paintModes: bitwise OR of {VG_FILL_PATH | VG_STROKE_PATH} void vgAppendPath(VGPath dstPath, VGPath srcPath) VGint numSeg)

Images Read and Write Image Pixels [10.5] Paint void vgClearImage(VGImage image, VGint x, VGint y, Paint Definition [9.1] Image Definition [10.3] VGint width, VGint height) typedef VGHandle VGPaint; typedef VGHandle VGImage; void vgImageSubData(VGImage image, Create & Destroy Paint [9.1.1] paramType values for the vgSet*() and vgGet*() functions. const void * data, VGint dataStride, VGPaint vgCreatePaint(void) VGImageFormat fmt, VGint x, VGint y, VGint width, VG_IMAGE_QUALITY (VGImageQuality) VGint height) void vgDestroyPaint(VGPaint paint) VG_IMAGE_QUALITY_NONANTIALIASED VG_IMAGE_QUALITY_FASTER void vgGetImageSubData(VGImage image, void * data, Set the Current Paint [9.1.2] VG_IMAGE_QUALITY_BETTER VGint dataStride, VGImageFormat fmt, VGint x, void vgSetPaint(VGPaint paint, VGint y, VGint width, VGint height) VGbitfield paintMode) VG_MAX_IMAGE_WIDTH Child Images [10.6] VGPaint vgGetPaint(VGPaintMode paintModes) VG_MAX_IMAGE_HEIGHT VGImage vgChildImage(VGImage parent, VGint x, paintModes: bitwise OR of {VG_FILL_PATH | VG_STROKE_PATH} VG_MAX_IMAGE_PIXELS VGint y, VGint width, VGint height) Paint Object Parameter (VGPaintParamType) [9.1.3] VG_MAX_IMAGE_BYTES VGImage vgGetParent(VGImage image) paramType values for the vgSetParameter() and Copy Between Images [10.7] vgGetParameter() functions. Default value in blue. Create & Destroy Image [10.3] void vgCopyImage(VGImage dst, VGint dx, VGint dy, VG_PAINT_TYPE (VGPaintType) VGImage vgCreateImage(VGImageFormat fmt, VGImage src, VGint sx, VGint sy, VGint width, VG_PAINT_TYPE_COLOR VGint width, VGint height, VGbitfield quality) VGint height, VGboolean dither) VG_PAINT_TYPE_{LINEAR, RADIAL}_GRADIENT void vgDestroyImage(VGImage image) Draw Image [10.8] VG_PAINT_TYPE_PATTERN void vgDrawImage(VGImage image) VG_PAINT_COLOR (VGfloat[4]) Image Object Parameter (VGImageParamType) [10.4] {0.0f, 0.0f, 0.0f, 1.0f} Read and Write Drawing Surface Pixels [10.9] {red,green,blue,alpha} paramType values for the vgSetParameter() and void vgSetPixels(VGint dx, VGint dy, VGImage src, vgGetParameter() functions. VGint sx, VGint sy, VGint width, VGint height) VG_PAINT_COLOR_RAMP_SPREAD_MODE (VGColorRampSpreadMode) VG_IMAGE_FORMAT (VGImageFormat) void vgWritePixels(const void * data, VGint dataStride, VG_COLOR_RAMP_SPREAD_PAD VGImageFormat fmt, VGint dx, VGint dy, VGint width, // RGB{A,X} channel ordering: // {A,X}RGB channel ordering: VGint height) VG_COLOR_RAMP_SPREAD_{REPEAT, REFLECT} VG_sRGB_565 VG_{s,l}{XRGB,ARGB}_8888 VG_PAINT_COLOR_RAMP_PREMULTIPLIED (VGboolean) VG_{s,l}RGBX_8888 VG_{s,l}ARGB_8888_PRE void vgGetPixels(VGImage dst, VGint dx, VGint dy, VG_TRUE VG_{s,l}RGBA_PRE VG_{sARGB}_{1555,4444} VGint sx, VGint sy, VGint width, VGint height) VG_FALSE (disabled) VG_sRGBA_{5551,4444} void vgReadPixels(void * data, VGint dataStride, VG_{sL,lL,A}_8 VGImageFormat fmt, VGint sx, VGint sy, VGint width, VG_PAINT_COLOR_RAMP_STOPS (VGfloat *) VGint height) NULL {stop0, red0, green0, blue0, alpha0,…} VG_{BW,A}_1 void vgCopyPixel(VGint dx, VGint dy, VGint sx, VGint sy, VG_PAINT_LINEAR_GRADIENT (VGfloat[4]) // {BGR{A,X} channel ordering: // {A,X}BGR channel ordering: VGint width, VGint height) {0.0f, 0.0f, 1.0f, 0.0f} VG_{s,l}{BGRX,BGRA}_8888 VG_{s,l}{XBGR,ABGR}_8888 {startx, starty, endx, endy} VG_{s,l}BGRA_8888_PRE VG_{s,l}ABGR_8888_PRE Pixel Copy Functions[10.9] VG_{sBGRA}_{1555,4444} VG_{sABGR}_{1555,4444} VG_PAINT_RADIAL_GRADIENT (VGfloat[5]) Src/Dst Memory VGImage Surface {0.0f, 0.0f, 0.0f, 0.0f, 1.0f} VG_IMAGE_WIDTH (VGint) // default value = 0 {centerx, centery, focusx, focusy, radius} Memory — vgImageSubData vgWritePixels VG_PAINT_PATTERN_TILING_MODE (VGTilingMode) VG_IMAGE_HEIGHT (VGint) // default value = 0 VG_TILE_FILL VGImage vgGetImageSubData vgCopyImage vgSetPixels VG_TILE_{PAD, REPEAT, REFLECT} Surface vgReadPixels vgGetPixels vgCopyPixels Color Paint [9.2] Color paint uses a fixed color and alpha for all pixels. Colors are specified in non-premultiplied sRGBA format. Text and Font Operations void vgSetGlyphToPath(VGFont font, VGuint glyphIndex, void vgSetParameterfv(VGPaint paint, OpenVG provides a fast, low-level hardware-accelerated API that VGPath path, VGboolean inHinted, VG_PAINT_COLOR, 4, VGfloat col[4]) is capable of supporting both hinted and unhinted vector glyph const VGfloat origin[2], const VGfloat escape[2]) void vgSetColor(VGPaint paint, VGuint rgba) outlines, as well as glyphs represented as bitmaps. void vgSetGlyphToImage(VGFont font, VGuint glyphIndex, VGuint vgGetColor(VGPaint paint) Font Definition[11.4] VGImage image, const VGfloat origin[2], typedef VGHandle VGFont; const VGfloat escape[2]) Gradient Paint [9.3] void vgClearGlyph(VGFont font, VGuint glyphIndex) Linear Gradients Manage VGFont Object [11.4.2] Enable using vgSetParameteri to set the paint type VGFont vgCreateFont(VGint glyphCapacityHint) Font Sharing [11.4.5] to VG_PAINT_TYPE_LINEAR_GRADIENT. Set parameters void vgDestroyFont(VGFont font) In order for VGFont objects to be shared, the VGFont (and using vgSetParameterfv with a paramType argument of underlying VGPath and VGImage objects) must be bound to a VG_PAINT_LINEAR_GRADIENT. Font Object Parameter (VGFontParamType) [11.4.3] shared context. paramType value for the vgGetParameter() function. Radial Gradients Draw Text [11.5] VG_FONT_NUM_GLYPHS (VGint) // default value = 0 Enable using vgSetParameteri to set the paint type to void vgDrawGlyph(VGFont font, VGuint glyphIndex, VG_PAINT_TYPE_RADIAL_GRADIENT. Set parameters VGbitfield paintModes, VGboolean allowAutoHinting) using vgSetParameterfv with a paramType argument of Add/Modify Glyphs in Fonts [11.4.4] VG_PAINT_RADIAL_GRADIENT. Applications are responsible for destroying path or image objects void vgDrawGlyphs(VGFont font, VGint glyphCount, they have assigned as font glyphs. It is recommended that const VGuint * glyphIndices, Pattern Paint [9.4] applications destroy the path or image using vgDestroyPath or const VGfloat * adjustments_x, void vgPaintPattern(VGPaint paint, vgDestroyImage immediately after setting the object as a glyph. const VGfloat *adjustments_y, VGbitfield paintModes, VGImage pattern) VGboolean allowAutoHinting)

©2010 Khronos Group - Rev. 0410 www.khronos.org/openvg OpenVG 1.1 API Quick Reference Card - Page 4

Image Filter Blending and Stencil Equations Image filters allow images to be modified or combined using Blending Equations [13.2-5] a variety of imaging operations. Blending modes define alpha and color blending functions. Alpha blending function α(αsrc, αdst); Color blending function Format Normalization [12.1] c(csrc, cdst, αsrc, αdst); Pre-mult alpha form c’(αsrc * csrc, αdst * cdst, αsrc, αdst) = c’(c’src, c’dst, αsrc, αdst) Source pixels are converted to one of sRGBA, sRGBA_PRE, lRGBA, or lRGBA_PRE formats, as determined by the current values of the VG_FILTER_FORMAT_PREMULTIPLIED and Blend Mode Color blending function Apha blending function VG_FILTER_FORMAT_LINEAR parameters. Filtered pixels are c’(c’src, c’dst, αsrc, αdst) α(αsrc, αdst) then converted into the destination format using the normal Porter-Duff Blending pixel format conversion rules described in [3.4]. VG_BLEND_SRC c’src αsrc Channel Masks [12.2] The VG_FILTER_CHANNEL_MASK parameter specifies VG_BLEND_SRC_OVER c’src + c’dst * (1–αsrc) αsrc + αdst * (1–αsrc) which destination channels are to be written. The VG_BLEND_DST_OVER c’src * (1–αdst) + c’dst αsrc * (1–αdst) + αdst parameter is supplied as a bitwise OR of values from the VGImageChannel enumeration. VG_BLEND_SRC_IN c’src * αdst αsrc * αdst typedef enum { VG_BLEND_DST_IN c’dst * αsrc αdst * αsrc VG_RED = (1 << 3), Additional Blending VG_GREEN = (1 << 2), VG_BLUE = (1 << 1), VG_BLEND_MULTIPLY c’src * (1-αdst) + c’dst * (1-αsrc) + c’src * c’dst αsrc + αdst * (1–αsrc) VG_ALPHA = (1 << 0) VG_BLEND_SCREEN c’src + c’dst – c’src * c’dst αsrc + αdst * (1–αsrc) } VGImageChannel; VG_BLEND_DARKEN min(c’src + c’dst * (1–αsrc), c’dst + c’src * (1–αdst)) αsrc + αdst * (1–αsrc) Color Combination [12.3] VG_BLEND_LIGHTEN max(c’src + c’dst * (1–αsrc), c’dst + c’src * (1–αdst)) αsrc + αdst * (1–αsrc) 4x4 color multiplication Additive Blending void vgColorMatrix(VGImage dst, VGImage src, const VGfloat * matrix) VG_BLEND_ADDITIVE min(c’src + c’dst , 1) min(αsrc + αdst ,1)

Convolution[12.4] Stencil Equations [10.8] void vgConvolve(VGImage dst, VGImage src, VGint kernelW, VGint KernelH, VGint shiftX, In stencil mode, equations for blending are changed as follows: If drawing surface has a luminance-only format: VGint shiftY, const VGshort * kernel, VGfloatscale , αtmp = α(αimage*αpaint, αdst) αtmp = α(αimage*αpaint, αdst) VGfloat bias, VGTilingMode tilingMode) Rdst ← c(Rpaint, Rdst, Rimage*αimage*αpaint, αdst) / αtmp Ldst ← c(Lpaint, Ldst, Limage*αimage*αpaint, αdst) / αtmp void vgSeparableConvolve(VGImage dst, Gdst ← c(Gpaint, Gdst, Gimage*αimage*αpaint, αdst) / αtmp αdst ← αtmp VGImage src, VGint kernelW, VGint KernelH, Bdst ← c(Bpaint, Bdst, Bimage*αimage*αpaint, αdst) / αtmp VGint shiftX, VGint shiftY, const VGshort * kernelX, αdst ← αtmp const VGshort kernelY, VGfloat scale, VGfloat bias, VGTilingMode tilingMode) void vgGaussianBlur(VGImage dst, VGImage src, VGfloat stdDevX, VGfloat stdDevY, VGU Utility Library [17] vguErrorCode vguEllipse(VGPath path, VGfloatcx , VGTilingMode tilingMode) Applications may choose whether to link to VGU at compile VGfloat cy, VGfloat width, VGfloat height) Appends an axis-aligned ellipse to a path. The center of the Convolution Parameters time; the library is not guaranteed to be present on the run- time platform. VGU is designed so it may be implemented in a ellipse is given by (cx, cy) and the dimensions of the axis- Read-only paramType values for the vgGetParameter() aligned rectangle enclosing the ellipse are given by width function. portable manner using only the public functionality provided by the OpenVG library. and height. VG_MAX_KERNEL_SIZE vguErrorCode vguArc(VGPath path, VGfloat x, Largest legal value of width and height (vgConvolve) VGU Version VGfloat y, VGfloat width, VGfloat height, For the current version, the constant VGU_VERSION_1_1 is VGfloat startAngle, VGfloat angleExt, VG_MAX_SEPARABLE_KERNEL_SIZE defined. The older version VGU_VERSION_1_0 continues VGUArcType arcType) Largest legal value of the size parameter to be defined for backwards compatibility. Appends an elliptical arc to a path, possibly along with one or (vgSeparableConvolve) #define VGU_VERSION_1_0 1 two line segments, according to the arcType parameter. The startAngle and angleExtent parameters are given in degrees, VG_MAX_GAUSSIAN_STD_DEVIATION #define VGU_VERSION_1_1 2 proceeding counter-clockwise from the positive X axis. Largest legal value of the stdDeviationX and stdDeviationY parameters (vgGaussianBlur) High ‐Level Geometric Primitives [17.1] arcType may be one of the constants from the following table: These functions allow applications to specify high-level VGU_ARC_OPEN arc segment only Lookup Table [12.5] geometric primitives to be appended to a path. Each primitive void vgLookup(VGImage dst, VGImage src, is reduced to a series of line segments, Bézier curves, and VGU_ARC_CHORD arc, plus line between arc endpoints const VGubyte * redLUT, const VGubyte * arcs. Input coordinates are mapped to input values for the VGU_ARC_PIE arc, plus lines from each endpoint to the greenLUT, vgAppendPathData command by subtracting the path’s bias ellipse center const VGubyte * blueLUT, const VGubyte * alphaLUT, and dividing by its scale value. Coordinates may overflow VGboolean outputLinear, silently if the resulting values fall outside the range defined by Image Warping [17.2] VGboolean outputPremultiplied) the path datatype. These functions compute 3x3 projective transform matrices. void vgLookupSingle(VGImage dst, VGImage src, vguErrorCode vguLine(VGPath path, VGfloat x0, The first two compute the transformation from an arbitrary const VGuint * LUT, VGImageChannel VGfloat y0, VGfloat x1, VGfloat y1) quadrilateral onto the unit square, and vice versa. The third sourceChannel, VGboolean outputLinear, Appends a line segment to a path. computes the transformation from an arbitrary quadrilateral VGboolean outputPremultiplied) to an arbitrary quadrilateral. vguErrorCode vguPolygon(VGPath path, vguErrorCode vguComputeWarpQuadToSquare( const VGfloat * points, VGint count, VGfloat sx0, VGfloat sy0, VGfloat sx1, VGfloat sy1, VGboolean closed) VGfloat sx2, VGfloat sy2, VGfloat sx3, VGfloat sy3, Querying Hardware Capabilities[14] Appends a polyline (connected sequence of line segments) or polygon to a path. VGfloat * matrix) vgHardwareQuery vguErrorCode vguComputeWarpSquareToQuad( Indicates whether a given setting of a property of a type vguErrorCode vguRect(VGPath path, VGfloat x, VGfloat dx0, VGfloat dy0, VGfloat dx1, VGfloat dy1, given by key is generally accelerated in hardware. VGfloat y, VGfloat width, VGfloat height) VGfloat dx2, VGfloat dy2, VGfloat dx3, VGfloat dy3, VGHardwareQueryResult vgHardwareQuery( Appends an axis-aligned rectangle with its lower-left corner at VGfloat * matrix) VGHardwareQueryType key, VGint setting) (x,y) and a given width and height to a path. vguErrorCode vguComputeWarpQuadToQuad( key: VG_IMAGE_FORMAT_QUERY, VG_PATH_DATATYPE_QUERY vguErrorCode vguRoundRect(VGPath path, VGfloat sx0, VGfloat sy0, VGfloat sx1, VGfloat sy1, VGfloat x, VGfloat y, VGfloat width, VGfloat height, VGfloat sx2, VGfloat sy2, VGfloat sx3, VGfloat sy3, setting: One of the constants from the enumerations VGfloat arcW, VGfloat arcH) VGImageFormat [10.2] or VGPathDataType [8.5.3] VGfloat dx0, VGfloat dy0, VGfloat dx1, VGfloat dy1, Appends an axis-aligned round-cornered rectangle with the VGfloat dx2, VGfloat dy2, VGfloat dx3, VGfloat dy3, Returns VG_HARDWARE_ACCELERATED, lower-left corner of its rectangular bounding box at (x, y) and VGfloat* matrix) VG_HARDWARE_UNACCELERATED a given width, height, arcWidth, and arcHeight to a path.

Khronos and OpenVG are trademarks of The Khronos Group Inc. The Khronos Group is an industry consortium creating open standards for the authoring and acceleration of parallel computing, graphics and dynamic media on a wide variety of platforms and devices. See www.khronos.org/openvg to learn more about the Khronos Group and OpenVG.

©2010 Khronos Group - Rev. 0410 Reference card production by and Miller & Mattson www.millermattson.com www.khronos.org/openvg