OpenVG Specification
Version 1.1
Version 1.0 – August 1, 2005
Version 1.0.1 – January 26, 2007
Version 1.1 – December 3, 2008
Editors: Daniel Rice, Google, Inc.
Robert J. Simpson, AMD
“ ”
For Ilise – DSR
Copyright © 2005-2008 The Khronos Group Inc. All Rights Reserved.
This specification is protected by copyright laws and contains material
proprietary to the Khronos Group, Inc. It or any components may not be
reproduced, republished, distributed, transmitted, displayed, broadcast or
otherwise exploited in any manner without the express prior written permission
of Khronos Group. You may use this specification for implementing the
functionality therein, without altering or removing any trademark, copyright or
other notice from the specification, but the receipt or possession of this
specification does not convey any rights to reproduce, disclose, or distribute its
contents, or to manufacture, use, or sell anything that it may describe, in whole
or in part.
Khronos Group grants express permission to any current Promoter, Contributor
or Adopter member of Khronos to copy and redistribute UNMODIFIED versions
of this specification in any fashion, provided that NO CHARGE is made for the
specification and the latest available update of the specification for any version of
the API is used whenever possible. Such distributed specification may be re-
formatted AS LONG AS the contents of the specification are not changed in any
way. The specification may be incorporated into a product that is sold as long as
such product includes significant independent work developed by the seller. A
link to the current version of this specification on the Khronos Group web-site
should be included whenever possible with specification distributions.
Khronos Group makes no, and expressly disclaims any, representations or
warranties, express or implied, regarding this specification, including, without
limitation, any implied warranties of merchantability or fitness for a particular
purpose or non-infringement of any intellectual property.
Khronos Group makes no, and expressly disclaims any, warranties, express or
implied regarding the correctness, accuracy, completeness, timeliness, and
reliability of the specification. Under no circumstances will the Khronos Group,
or any of its Promoters, Contributors or Members or their respective partners,
officers, directors, employees, agents or representatives be liable for any
damages, whether direct, indirect, special or consequential damages for lost
revenues, lost profits, or otherwise, arising from or in connection with these
materials.
Khronos and OpenVG are trademarks of The Khronos Group Inc. OpenGL is a
registered trademark, and OpenGL ES is a trademark, of Silicon Graphics, Inc.
Table of Contents
1Introduction..................................................................................................................................10
1.1Feature Set..........................................................................................................................10
1.2Target Applications..............................................................................................................10
SVG and Adobe Flash Viewers .................................................................................................10
Portable Mapping Applications................................................................................................10
E-book Readers............................................................................................................................11
Games...........................................................................................................................................11
Scalable User Interfaces.............................................................................................................11
Low-Level Graphics Device Interface......................................................................................11
1.3Target Devices.....................................................................................................................11
1.4Design Philosophy...............................................................................................................11
1.5Naming and Typographical Conventions.............................................................................12
1.6Library Naming....................................................................................................................12
2The OpenVG Pipeline..................................................................................................................13
2.1Stage 1: Path, Transformation, Stroke, and Paint...............................................................14
2.2Stage 2: Stroked Path Generation.......................................................................................14
2.3Stage 3: Transformation......................................................................................................14
2.4Stage 4: Rasterization.........................................................................................................14
2.5Stage 5: Clipping and Masking............................................................................................15
2.6Stage 6: Paint Generation...................................................................................................15
2.7Stage 7: Image Interpolation...............................................................................................15
2.8Stage 8: Color Transformation, Blending, and Antialiasing..................................................16
2.9Multisampling......................................................................................................................16
3Constants, Functions and Data Types.........................................................................................16
3.1Versioning............................................................................................................................17
OPENVG_VERSION_1_1..........................................................................................................17
3.2Primitive Data Types............................................................................................................17
VGbyte..........................................................................................................................................17
VGubyte.......................................................................................................................................17
VGshort........................................................................................................................................17
VGint.............................................................................................................................................18
VGuint..........................................................................................................................................18
VGbitfield.....................................................................................................................................18
VGboolean...................................................................................................................................18
VGfloat.........................................................................................................................................18
3.3Floating-Point and Integer Representations........................................................................18
VG_MAXSHORT........................................................................................................................19
VG_MAXINT...............................................................................................................................19
VG_MAX_FLOAT.......................................................................................................................19
3.4Colors..................................................................................................................................19
3.4.1Linear and Non-Linear Color Representations............................................................20
i
3.4.2Color Space Definitions...............................................................................................21
3.4.3Premultiplied Alpha......................................................................................................23
3.4.4Color Format Conversion............................................................................................23
3.5Enumerated Data Types......................................................................................................24
3.7Handle-based Data Types...................................................................................................25
VGHandle....................................................................................................................................25
VG_INVALID_HANDLE..........................................................................................................26
4The Drawing Context...................................................................................................................27
4.1Errors..................................................................................................................................29
VGErrorCode...............................................................................................................................29
vgGetError...................................................................................................................................30
4.2Manipulating the Context Using EGL ..................................................................................30
4.2.1EGLConfig Attributes...................................................................................................30
EGL_OPENVG_BIT....................................................................................................................30
EGL_ALPHA_MASK_SIZE.......................................................................................................31
4.2.2EGL Functions.............................................................................................................31
eglBindAPI...................................................................................................................................31
eglCreateContext.........................................................................................................................31
eglCreateWindowSurface..........................................................................................................31
eglCreatePbufferFromClientBuffer..........................................................................................32
eglMakeCurrent..........................................................................................................................32
eglGetCurrentContext................................................................................................................32
eglDestroyContext......................................................................................................................32
eglSwapBuffers............................................................................................................................32
4.3Forcing Drawing to Complete..............................................................................................33
vgFlush.........................................................................................................................................33
vgFinish........................................................................................................................................33
5Setting API Parameters...............................................................................................................34
5.1Context Parameter Types....................................................................................................34
VGParamType.............................................................................................................................34
5.2Setting and Querying Context Parameter Values................................................................36
vgSet..............................................................................................................................................36
vgGet and vgGetVectorSize .......................................................................................................37
5.2.1Default Context Parameter Values..............................................................................38
5.3Setting and Querying Object Parameter Values..................................................................40
vgSetParameter...........................................................................................................................40
vgGetParameter and vgGetParameterVectorSize ..................................................................41
6Rendering Quality and Antialiasing..............................................................................................44
6.1Rendering Quality................................................................................................................45
VGRenderingQuality.................................................................................................................45
6.2Additional Quality Settings...................................................................................................46
VGPixelLayout............................................................................................................................46
6.3Coordinate Systems and Transformations...........................................................................47
6.4Coordinate Systems............................................................................................................47
6.5Transformations...................................................................................................................48
ii
6.5.1Homogeneous Coordinates.........................................................................................48
6.5.2Affine Transformations.................................................................................................49
6.5.3Projective (Perspective) Transformations....................................................................49
6.6Matrix Manipulation.............................................................................................................50
VGMatrixMode...........................................................................................................................51
vgLoadIdentity............................................................................................................................51
vgLoadMatrix..............................................................................................................................51
vgGetMatrix.................................................................................................................................52
.......................................................................................................................................................52
vgMultMatrix..............................................................................................................................53
vgTranslate...................................................................................................................................53
vgScale..........................................................................................................................................54
vgShear.........................................................................................................................................54
vgRotate.......................................................................................................................................54
7Scissoring, Masking, and Clearing..............................................................................................55
7.1Scissoring............................................................................................................................55
VG_MAX_SCISSOR_RECTS.....................................................................................................55
Specifying Scissoring Rectangles..............................................................................................55
7.2Masking ..............................................................................................................................56
VGMaskOperation......................................................................................................................57
vgMask.........................................................................................................................................58
vgRenderToMask........................................................................................................................60
VGMaskLayer..............................................................................................................................61
vgCreateMaskLayer...................................................................................................................61
vgDestroyMaskLayer.................................................................................................................62
vgFillMaskLayer.........................................................................................................................62
vgCopyMask...............................................................................................................................63
7.3Fast Clearing.......................................................................................................................64
vgClear.........................................................................................................................................64
8Paths...........................................................................................................................................64
8.1Moves..................................................................................................................................65
8.2Straight Line Segments.......................................................................................................65
8.3Bézier Curves......................................................................................................................65
8.3.1Quadratic Bézier Curves.............................................................................................65
8.3.2Cubic Bézier Curves....................................................................................................66
8.3.3G1 Smooth Segments.................................................................................................66
8.3.4C1 Smooth Segments.................................................................................................67
8.3.5C2 Smooth Segments.................................................................................................68
8.3.6Converting Segments From Quadratic to Cubic Form.................................................68
8.4Elliptical Arcs.......................................................................................................................68
8.5The Standard Path Format..................................................................................................69
VG_PATH_FORMAT_STANDARD.........................................................................................70
8.5.1Path Segment Command Side Effects........................................................................70
8.5.2Segment Commands...................................................................................................71
8.5.3Coordinate Data Formats............................................................................................73
iii