Openvg 1.1 API Quick Reference Card - Page 1
Total Page:16
File Type:pdf, Size:1020Kb
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 hardware acceleration 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 api) 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 Khronos Group - 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]