|
1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // OpenVG C API for Symbian DLL |
|
15 |
|
16 |
|
17 #include "vgstate.h" |
|
18 |
|
19 |
|
20 |
|
21 extern "C" { |
|
22 |
|
23 /* |
|
24 Note: Comments at the start of each Open VG api are adapted from the Open VG 1.1 specification. |
|
25 The text has been chosen/adapted to give a helpful overview of the function, and the errors |
|
26 (other than VG_NO_CONTEXT_ERROR) that it may generate. For more details and diagrams see the |
|
27 full Open VG specification. |
|
28 */ |
|
29 |
|
30 /* |
|
31 The vgGetParameter functions return the value of a parameter on a given VGHandlebased |
|
32 object. |
|
33 |
|
34 The original value passed to vgSetParameter (provided the call to |
|
35 vgSetParameter completed without error) should be returned by |
|
36 vgGetParameter (except where specifically noted), even if the implementation |
|
37 makes use of a truncated or quantized value internally. |
|
38 |
|
39 ERRORS |
|
40 VG_BAD_HANDLE_ERROR |
|
41 if object is not a valid handle, or is not shared with the current context |
|
42 VG_ILLEGAL_ARGUMENT_ERROR |
|
43 if paramType is not a valid value from the appropriate enumeration |
|
44 if paramType refers to a vector parameter in vgGetParameterf or |
|
45 vgGetParameteri |
|
46 */ |
|
47 EXPORT_C VGint |
|
48 vgGetParameteri(VGHandle object, |
|
49 VGint paramType) |
|
50 { |
|
51 OPENVG_TRACE("vgGetParameteri object=0x%x, paramType=0x%x -->", object, paramType); |
|
52 |
|
53 VGint value = TGuestOpenVg::vgGetParameteri(object, paramType); |
|
54 OPENVG_TRACE("vgGetParameteri value=0x%x <--", value); |
|
55 return value; |
|
56 } |
|
57 |
|
58 |
|
59 //////////////////////////////////////////////////////////////////////////////////////////// |
|
60 //Functions returning value |
|
61 //////////////////////////////////////////////////////////////////////////////////////////// |
|
62 /* |
|
63 Returns the oldest error code provided by an API call on the current context since the |
|
64 previous call to vgGetError on that context (or since the creation of the context). No |
|
65 error is indicated by a return value of 0 (VG_NO_ERROR). After the call, the error code is |
|
66 cleared to 0. The possible errors that may be generated by each OpenVG function (apart from |
|
67 VG_OUT_OF_MEMORY_ERROR) are shown below the definition of the function. |
|
68 If no context is current at the time vgGetError is called, the error code |
|
69 VG_NO_CONTEXT_ERROR is returned. Pending error codes on existing contexts are not affected |
|
70 by the call. |
|
71 */ |
|
72 EXPORT_C VGErrorCode |
|
73 vgGetError(void) |
|
74 { |
|
75 OPENVG_TRACE("vgGetError"); |
|
76 |
|
77 MVgContext* vgContext = CVghwUtils::VgContext(); |
|
78 VGErrorCode error = VG_NO_CONTEXT_ERROR; |
|
79 if (vgContext) |
|
80 { // thread state already exists - get client or Host VG error |
|
81 error = vgContext->VgError(); |
|
82 } |
|
83 return error; |
|
84 } |
|
85 |
|
86 /* |
|
87 Returns the paint object currently set for the given paintMode, or VG_INVALID_HANDLE |
|
88 if an error occurs or if no paint object is set (i.e., the default paint is present) on |
|
89 the given context with the given paintMode. |
|
90 |
|
91 ERRORS |
|
92 VG_ILLEGAL_ARGUMENT_ERROR |
|
93 if paintMode is not a valid value from the VGPaintMode enumeration |
|
94 */ |
|
95 EXPORT_C VGPaint |
|
96 vgGetPaint(VGPaintMode paintMode) |
|
97 { |
|
98 OPENVG_TRACE("vgGetPaint paintMode=0x%x -->", paintMode); |
|
99 |
|
100 VGPaint paintHandle = TGuestOpenVg::vgGetPaint(paintMode); |
|
101 OPENVG_TRACE("vgGetPaint handle=0x%x <--", paintHandle); |
|
102 return paintHandle; |
|
103 } |
|
104 |
|
105 /* |
|
106 Creates a new paint object that is initialized to a set of default values and returns |
|
107 a VGPaint handle to it. If insufficient memory is available to allocate a new object, |
|
108 VG_INVALID_HANDLE is returned. |
|
109 */ |
|
110 EXPORT_C VGPaint |
|
111 vgCreatePaint(void) |
|
112 { |
|
113 OPENVG_TRACE("vgCreatePaint -->"); |
|
114 |
|
115 VGPaint paintHandle = TGuestOpenVg::vgCreatePaint(); |
|
116 OPENVG_TRACE("vgCreatePaint handle=0x%x <--", paintHandle); |
|
117 return paintHandle; |
|
118 } |
|
119 |
|
120 /* |
|
121 Appends a path, defined by interpolation (or extrapolation) between the paths |
|
122 startPath and endPath by the given amount, to the path dstPath. It returns |
|
123 VG_TRUE if interpolation was successful (i.e., the paths had compatible segment |
|
124 types after normalization), and VG_FALSE otherwise. If interpolation is |
|
125 unsuccessful, dstPath is left unchanged. It is legal for dstPath to be a handle |
|
126 to the same path object as either startPath or endPath or both, in which case |
|
127 the contents of the source path or paths referenced by dstPath will have the |
|
128 interpolated path appended. If dstPath is not the a handle to the same path |
|
129 object as either startPath or endPath, the contents of startPath and endPath |
|
130 will not be affected by the call. |
|
131 |
|
132 ERRORS |
|
133 VG_BAD_HANDLE_ERROR |
|
134 if any of dstPath, startPath, or endPath is not a valid path handle, or is |
|
135 not shared with the current context |
|
136 VG_PATH_CAPABILITY_ERROR |
|
137 if VG_PATH_CAPABILITY_INTERPOLATE_TO is not enabled for dstPath |
|
138 if VG_PATH_CAPABILITY_INTERPOLATE_FROM is not enabled for startPath or endPath |
|
139 */ |
|
140 EXPORT_C VGboolean |
|
141 vgInterpolatePath(VGPath dstPath, |
|
142 VGPath startPath, |
|
143 VGPath endPath, |
|
144 VGfloat amount) |
|
145 { |
|
146 OPENVG_TRACE("vgInterpolatePath dstPath=0x%x, startPath=0x%x, endPath=0x%x, amount=%f", |
|
147 dstPath, startPath, endPath, amount); |
|
148 |
|
149 return TGuestOpenVg::vgInterpolatePath(dstPath, startPath, endPath, amount); |
|
150 } |
|
151 |
|
152 /* |
|
153 Returns the length of a given portion of a path in the user coordinate system |
|
154 (that is, in the paths own coordinate system, disregarding any matrix |
|
155 settings). Only the subpath consisting of the numSegments path segments beginning |
|
156 with startSegment (where the initial path segment has index 0) is used. If an |
|
157 error occurs, -1.0f is returned. |
|
158 |
|
159 ERRORS |
|
160 VG_BAD_HANDLE_ERROR |
|
161 if path is not a valid path handle, or is not shared with the current context |
|
162 VG_PATH_CAPABILITY_ERROR |
|
163 if VG_PATH_CAPABILITY_PATH_LENGTH is not enabled for path |
|
164 VG_ILLEGAL_ARGUMENT_ERROR |
|
165 if startSegment is less than 0 or greater than the index of the final path |
|
166 segment |
|
167 if numSegments is less than or equal to 0 |
|
168 if (startSegment + numSegments 1) is greater than the index of the final |
|
169 path segment |
|
170 */ |
|
171 EXPORT_C VGfloat |
|
172 vgPathLength(VGPath path, |
|
173 VGint startSegment, |
|
174 VGint numSegments) |
|
175 { |
|
176 OPENVG_TRACE("vgPathLength path=0x%x, startSegment=%d, numSegments=%d", path, startSegment, numSegments); |
|
177 |
|
178 return TGuestOpenVg::vgPathLength(path, startSegment, numSegments); |
|
179 } |
|
180 |
|
181 /* |
|
182 Returns the current capabilities of the path, as a bitwise OR of |
|
183 VGPathCapabilities constants. If an error occurs, 0 is returned. |
|
184 |
|
185 ERRORS |
|
186 VG_BAD_HANDLE_ERROR |
|
187 if path is not a valid path handle, or is not shared with the current context |
|
188 */ |
|
189 EXPORT_C VGbitfield |
|
190 vgGetPathCapabilities(VGPath path) |
|
191 { |
|
192 OPENVG_TRACE("vgGetPathCapabilities path=0x%x", path); |
|
193 |
|
194 return TGuestOpenVg::vgGetPathCapabilities(path); |
|
195 } |
|
196 |
|
197 /* |
|
198 Create a new path that is ready to accept segment data and return a VGPath handle |
|
199 to it. The path data will be formatted in the format given by pathFormat, typically |
|
200 VG_PATH_FORMAT_STANDARD. The datatype parameter contains a value from the |
|
201 VGPathDatatype enumeration indicating the datatype that will be used for coordinate |
|
202 data. The capabilities argument is a bitwise OR of the desired VGPathCapabilities |
|
203 values. Bits of capabilities that do not correspond to values from VGPathCapabilities |
|
204 have no effect. |
|
205 |
|
206 If an error occurs, VG_INVALID_HANDLE is returned. |
|
207 |
|
208 ERRORS |
|
209 VG_UNSUPPORTED_PATH_FORMAT_ERROR |
|
210 if pathFormat is not a supported format |
|
211 VG_ILLEGAL_ARGUMENT_ERROR |
|
212 if datatype is not a valid value from the VGPathDatatype enumeration |
|
213 if scale is equal to 0 |
|
214 */ |
|
215 EXPORT_C VGPath |
|
216 vgCreatePath(VGint pathFormat, |
|
217 VGPathDatatype datatype, |
|
218 VGfloat scale, VGfloat bias, |
|
219 VGint segmentCapacityHint, |
|
220 VGint coordCapacityHint, |
|
221 VGbitfield capabilities) |
|
222 { |
|
223 OPENVG_TRACE("vgCreatePath pathFormat=%d, datatype=0x%x, scale=%f, bias=%f, segCapHint=%d, coordCapHint=%d, caps=0x%x -->", |
|
224 pathFormat, datatype, scale, bias, segmentCapacityHint, coordCapacityHint, capabilities); |
|
225 |
|
226 VGPath pathHandle = TGuestOpenVg::vgCreatePath(pathFormat, datatype, scale, bias, segmentCapacityHint, coordCapacityHint, capabilities); |
|
227 OPENVG_TRACE("vgCreatePath handle=0x%x <--", pathHandle); |
|
228 return pathHandle; |
|
229 } |
|
230 |
|
231 /* |
|
232 The vgGet functions return the value of a parameter on the current context. |
|
233 The original value passed to vgSet (except as specifically noted, and provided the call to |
|
234 vgSet completed without error) is returned by vgGet, even if the implementation makes |
|
235 use of a truncated or quantized value internally. This rule ensures that OpenVG state may |
|
236 be saved and restored without degradation. |
|
237 |
|
238 If an error occurs during a call to vgGetf, vgGeti, or vgGetVectorSize, the return value |
|
239 is undefined. |
|
240 |
|
241 ERRORS |
|
242 VG_ILLEGAL_ARGUMENT_ERROR |
|
243 if paramType is not a valid value from the VGParamType enumeration |
|
244 if paramType refers to a vector parameter in vgGetf or vgGeti |
|
245 */ |
|
246 EXPORT_C VGfloat |
|
247 vgGetf(VGParamType type) |
|
248 { |
|
249 OPENVG_TRACE("vgGetf type=0x%x", type); |
|
250 |
|
251 return TGuestOpenVg::vgGetf(type); |
|
252 } |
|
253 |
|
254 /* |
|
255 The vgGet functions return the value of a parameter on the current context. |
|
256 The original value passed to vgSet (except as specifically noted, and provided the call to |
|
257 vgSet completed without error) is returned by vgGet, even if the implementation makes |
|
258 use of a truncated or quantized value internally. This rule ensures that OpenVG state may |
|
259 be saved and restored without degradation. |
|
260 |
|
261 If an error occurs during a call to vgGetf, vgGeti, or vgGetVectorSize, the return value |
|
262 is undefined. |
|
263 |
|
264 ERRORS |
|
265 VG_ILLEGAL_ARGUMENT_ERROR |
|
266 if paramType is not a valid value from the VGParamType enumeration |
|
267 if paramType refers to a vector parameter in vgGetf or vgGeti |
|
268 */ |
|
269 EXPORT_C VGint |
|
270 vgGeti(VGParamType type) |
|
271 { |
|
272 OPENVG_TRACE("vgGeti type=0x%x", type); |
|
273 |
|
274 return TGuestOpenVg::vgGeti(type); |
|
275 } |
|
276 |
|
277 /* |
|
278 The vgGetVectorSize function returns the maximum number of elements in the vector |
|
279 that will be retrieved by the vgGetiv or vgGetfv functions if called with the given |
|
280 paramType argument. For scalar values, 1 is returned. If vgGetiv or vgGetfv is |
|
281 called with a smaller value for count than that returned by vgGetVectorSize, |
|
282 only the first count elements of the vector are retrieved. Use of a greater value |
|
283 for count will result in an error. |
|
284 The original value passed to vgSet (except as specifically noted, and provided the call to |
|
285 vgSet completed without error) is returned by vgGet, even if the implementation makes |
|
286 use of a truncated or quantized value internally. This rule ensures that OpenVG state may |
|
287 be saved and restored without degradation. |
|
288 If an error occurs during a call to vgGetf, vgGeti, or vgGetVectorSize, the return value |
|
289 is undefined. |
|
290 |
|
291 ERRORS |
|
292 VG_ILLEGAL_ARGUMENT_ERROR |
|
293 if paramType is not a valid value from the VGParamType enumeration |
|
294 */ |
|
295 EXPORT_C VGint |
|
296 vgGetVectorSize(VGParamType type) |
|
297 { |
|
298 OPENVG_TRACE("vgGetVectorSize type=0x%x", type); |
|
299 |
|
300 return TGuestOpenVg::vgGetVectorSize(type); |
|
301 } |
|
302 |
|
303 /* |
|
304 The vgGetParameter functions return the value of a parameter on a given VGHandlebased |
|
305 object. |
|
306 |
|
307 The original value passed to vgSetParameter (provided the call to |
|
308 vgSetParameter completed without error) should be returned by |
|
309 vgGetParameter (except where specifically noted), even if the implementation |
|
310 makes use of a truncated or quantized value internally. |
|
311 |
|
312 ERRORS |
|
313 VG_BAD_HANDLE_ERROR |
|
314 if object is not a valid handle, or is not shared with the current context |
|
315 VG_ILLEGAL_ARGUMENT_ERROR |
|
316 if paramType is not a valid value from the appropriate enumeration |
|
317 if paramType refers to a vector parameter in vgGetParameterf or |
|
318 vgGetParameteri |
|
319 */ |
|
320 EXPORT_C VGfloat |
|
321 vgGetParameterf(VGHandle object, |
|
322 VGint paramType) |
|
323 { |
|
324 OPENVG_TRACE("vgGetParameterf object=0x%x, paramType=0x%x -->", object, paramType); |
|
325 |
|
326 VGfloat value = TGuestOpenVg::vgGetParameterf(object, paramType); |
|
327 OPENVG_TRACE("vgGetParameterf value=%f <--", value); |
|
328 return value; |
|
329 } |
|
330 |
|
331 /* |
|
332 The vgGetParameterVectorSize function returns the number of elements in the vector |
|
333 that will be returned by the vgGetParameteriv or vgGetParameterfv functions if called |
|
334 with the given paramType argument. For scalar values, 1 is returned. |
|
335 |
|
336 ERRORS |
|
337 VG_BAD_HANDLE_ERROR |
|
338 if object is not a valid handle, or is not shared with the current context |
|
339 VG_ILLEGAL_ARGUMENT_ERROR |
|
340 if paramType is not a valid value from the appropriate enumeration |
|
341 */ |
|
342 EXPORT_C VGint |
|
343 vgGetParameterVectorSize(VGHandle object, |
|
344 VGint paramType) |
|
345 { |
|
346 OPENVG_TRACE("vgGetParameterVectorSize object=0x%x, paramType=0x%x -->", object, paramType); |
|
347 |
|
348 VGint size = TGuestOpenVg::vgGetParameterVectorSize(object, paramType); |
|
349 OPENVG_TRACE("vgGetParameterVectorSize size=%i <--", size); |
|
350 return size; |
|
351 } |
|
352 |
|
353 /* |
|
354 Creates an object capable of storing a mask layer with the given width and |
|
355 height and returns a VGMaskLayer handle to it. The mask layer is defined to |
|
356 be compatible with the format and multisampling properties of the current |
|
357 drawing surface. If there is no current drawing surface, no mask is |
|
358 configured for the current drawing surface, or an error occurs, |
|
359 VG_INVALID_HANDLE is returned. All mask layer values are initially set to one. |
|
360 |
|
361 ERRORS |
|
362 VG_ILLEGAL_ARGUMENT_ERROR |
|
363 if width or height are less than or equal to 0 |
|
364 if width is greater than VG_MAX_IMAGE_WIDTH |
|
365 if height is greater than VG_MAX_IMAGE_HEIGHT |
|
366 if width*height is greater than VG_MAX_IMAGE_PIXELS |
|
367 */ |
|
368 EXPORT_C VGMaskLayer |
|
369 vgCreateMaskLayer(VGint width, VGint height) |
|
370 { |
|
371 OPENVG_TRACE("vgCreateMaskLayer width=%d, height=%d -->", width, height); |
|
372 |
|
373 VGMaskLayer maskHandle = TGuestOpenVg::vgCreateMaskLayer(width, height); |
|
374 OPENVG_TRACE("vgCreateMaskLayer handle=0x%x <--", maskHandle); |
|
375 return maskHandle; |
|
376 } |
|
377 |
|
378 /* |
|
379 The current setting of the VG_PAINT_COLOR parameter on a given paint object may |
|
380 be queried as a 32-bit non-premultiplied sRGBA_8888 value. Each color channel or |
|
381 alpha value is clamped to the range [0, 1] , multiplied by 255, and rounded to obtain an |
|
382 8-bit integer; the resulting values are packed into a 32-bit value in the same format as for |
|
383 vgSetColor. |
|
384 |
|
385 ERRORS |
|
386 VG_BAD_HANDLE_ERROR |
|
387 if paint is not a valid paint handle, or is not shared with the current context |
|
388 */ |
|
389 EXPORT_C VGuint |
|
390 vgGetColor(VGPaint paint) |
|
391 { |
|
392 OPENVG_TRACE("vgGetColor paint=0x%x", paint); |
|
393 |
|
394 return TGuestOpenVg::vgGetColor(paint); |
|
395 } |
|
396 |
|
397 /* |
|
398 Creates an image with the given width, height, and pixel format and returns a |
|
399 VGImage handle to it. If an error occurs, VG_INVALID_HANDLE is returned. All |
|
400 color and alpha channel values are initially set to zero. The format parameter |
|
401 must contain a value from the VGImageFormat enumeration. |
|
402 The allowedQuality parameter is a bitwise OR of values from the |
|
403 VGImageQuality enumeration, indicating which levels of resampling quality may be |
|
404 used to draw the image. It is always possible to draw an image using the |
|
405 VG_IMAGE_QUALITY_NONANTIALIASED quality setting even if it is not explicitly |
|
406 specified. |
|
407 |
|
408 ERRORS |
|
409 VG_UNSUPPORTED_IMAGE_FORMAT_ERROR |
|
410 if format is not a valid value from the VGImageFormat enumeration |
|
411 VG_ILLEGAL_ARGUMENT_ERROR |
|
412 if width or height are less than or equal to 0 |
|
413 if width is greater than VG_MAX_IMAGE_WIDTH |
|
414 if height is greater than VG_MAX_IMAGE_HEIGHT |
|
415 if width*height is greater than VG_MAX_IMAGE_PIXELS |
|
416 if width*height*(pixel size of format) is greater than |
|
417 VG_MAX_IMAGE_BYTES |
|
418 if allowedQuality is not a bitwise OR of values from the |
|
419 VGImageQuality enumeration |
|
420 */ |
|
421 EXPORT_C VGImage |
|
422 vgCreateImage(VGImageFormat format, |
|
423 VGint width, VGint height, |
|
424 VGbitfield allowedQuality) |
|
425 { |
|
426 OPENVG_TRACE("vgCreateImage format=0x%x, width=%d, height=%d, allowedQuality=0x%x -->", |
|
427 format, width, height, allowedQuality); |
|
428 |
|
429 VGImage imageHandle = TGuestOpenVg::vgCreateImage(format, width, height, allowedQuality); |
|
430 OPENVG_TRACE("vgCreateImage handle=0x%x <--", imageHandle); |
|
431 return imageHandle; |
|
432 } |
|
433 |
|
434 /* |
|
435 Returns a new VGImage handle that refers to a portion of the parent image. The |
|
436 region is given by the intersection of the bounds of the parent image with the |
|
437 rectangle beginning at pixel (x, y) with dimensions width and height, which |
|
438 must define a positive region contained entirely within parent. |
|
439 |
|
440 ERRORS |
|
441 VG_BAD_HANDLE_ERROR |
|
442 if parent is not a valid image handle, or is not shared with the current |
|
443 context |
|
444 VG_IMAGE_IN_USE_ERROR |
|
445 if parent is currently a rendering target |
|
446 VG_ILLEGAL_ARGUMENT_ERROR |
|
447 if x is less than 0 or greater than or equal to the parent width |
|
448 if y is less than 0 or greater than or equal to the parent height |
|
449 if width or height is less than or equal to 0 |
|
450 if x + width is greater than the parent width |
|
451 if y + height is greater than the parent height |
|
452 */ |
|
453 EXPORT_C VGImage |
|
454 vgChildImage(VGImage parent, |
|
455 VGint x, VGint y, |
|
456 VGint width, VGint height) |
|
457 { |
|
458 OPENVG_TRACE("vgChildImage parent=oc%x, x=%d, y=%d, width=%d, height=%d -->", |
|
459 parent, x, y, width, height); |
|
460 |
|
461 VGImage imageHandle = TGuestOpenVg::vgChildImage(parent, x, y, width, height); |
|
462 OPENVG_TRACE("vgChildImage handle=0x%x <--", imageHandle); |
|
463 return imageHandle; |
|
464 } |
|
465 |
|
466 /* |
|
467 Returns the closest valid ancestor (i.e., one that has not been the target of |
|
468 a vgDestroyImage call) of the given image. If image has no ancestors, image is |
|
469 returned. |
|
470 |
|
471 ERRORS |
|
472 VG_BAD_HANDLE_ERROR |
|
473 if image is not a valid image handle, or is not shared with the current |
|
474 context |
|
475 VG_IMAGE_IN_USE_ERROR |
|
476 if image is currently a rendering target |
|
477 */ |
|
478 EXPORT_C VGImage vgGetParent(VGImage image) |
|
479 { |
|
480 OPENVG_TRACE("vgGetParent image=0x%x", image); |
|
481 |
|
482 return TGuestOpenVg::vgGetParent(image); |
|
483 } |
|
484 |
|
485 /* |
|
486 Creates a new font object and returns a VGFont handle to it. The glyphCapacityHint |
|
487 argument provides a hint as to the capacity of a VGFont, i.e., the total number of |
|
488 glyphs that this VGFont object will be required to accept. A value of 0 indicates that |
|
489 the value is unknown. If an error occurs during execution, VG_INVALID_HANDLE is returned. |
|
490 |
|
491 ERRORS |
|
492 VG_ILLEGAL_ARGUMENT_ERROR |
|
493 if glyphCapacityHint is negative |
|
494 */ |
|
495 EXPORT_C VGFont vgCreateFont(VGint glyphCapacityHint) |
|
496 { |
|
497 OPENVG_TRACE("vgCreateFont glyphCapacityHint=%d -->", glyphCapacityHint); |
|
498 |
|
499 VGFont fontHandle = TGuestOpenVg::vgCreateFont(glyphCapacityHint); |
|
500 OPENVG_TRACE("vgCreateFont handle=0x%x <--", fontHandle); |
|
501 return fontHandle; |
|
502 } |
|
503 |
|
504 /* Hardware Queries */ |
|
505 |
|
506 /* |
|
507 Returns a value indicating whether a given setting of a property of a type given |
|
508 by key is generally accelerated in hardware on the currently running OpenVG |
|
509 implementation. |
|
510 |
|
511 ERRORS |
|
512 VG_ILLEGAL_ARGUMENT_ERROR |
|
513 if key is not one of the values from the VGHardwareQueryType enumeration |
|
514 if setting is not one of the values from the enumeration associated with |
|
515 key |
|
516 */ |
|
517 EXPORT_C VGHardwareQueryResult |
|
518 vgHardwareQuery |
|
519 (VGHardwareQueryType key, |
|
520 VGint setting) |
|
521 { |
|
522 OPENVG_TRACE("vgHardwareQuery key=0x%x, setting=%d", key, setting); |
|
523 |
|
524 return TGuestOpenVg::vgHardwareQuery(key, setting); |
|
525 } |
|
526 |
|
527 /* |
|
528 The vgGetString function returns information about the OpenVG implementation, |
|
529 including extension information. The values returned may vary according to |
|
530 the display (e.g., the EGLDisplay when using EGL) associated with the current |
|
531 context. |
|
532 |
|
533 Returns NULL if no context is current. |
|
534 */ |
|
535 EXPORT_C const VGubyte * |
|
536 vgGetString(VGStringID name) |
|
537 { |
|
538 OPENVG_TRACE("vgGetString name=0x%x", name); |
|
539 |
|
540 switch (name) |
|
541 { |
|
542 case VG_VENDOR: |
|
543 return (const VGubyte *)"Nokia"; |
|
544 case VG_RENDERER: |
|
545 return (const VGubyte *)"Guest 1.0"; |
|
546 case VG_VERSION: |
|
547 return (const VGubyte *)"1.1"; |
|
548 case VG_EXTENSIONS: // supported VG extensions, (associated function addresses are fetched with eglGetProcAddress) |
|
549 return (const VGubyte *)"VG_KHR_EGL_image"; |
|
550 } |
|
551 return (const VGubyte *)NULL; |
|
552 } |
|
553 |
|
554 /* |
|
555 The vgGetParameter functions return the value of a parameter on a given VGHandlebased |
|
556 object. |
|
557 |
|
558 If vgGetParameteriv or vgGetParameterfv is called with a smaller value for |
|
559 count than that returned by vgGetParameterVectorSize, only the first count |
|
560 elements of the vector are retrieved. Use of a greater value for count will result |
|
561 in an error. |
|
562 |
|
563 The original value passed to vgSetParameter (provided the call to |
|
564 vgSetParameter completed without error) should be returned by |
|
565 vgGetParameter (except where specifically noted), even if the implementation |
|
566 makes use of a truncated or quantized value internally. |
|
567 |
|
568 ERRORS |
|
569 VG_BAD_HANDLE_ERROR |
|
570 if object is not a valid handle, or is not shared with the current context |
|
571 VG_ILLEGAL_ARGUMENT_ERROR |
|
572 if paramType is not a valid value from the appropriate enumeration |
|
573 if values is NULL in vgGetParameterfv or vgGetParameteriv |
|
574 if values is not properly aligned in vgGetParameterfv or vgGetParameteriv |
|
575 if count is less than or equal to 0 in vgGetParameterfv or vgGetParameteriv |
|
576 if count is greater than the value returned by vgGetParameterVectorSize for |
|
577 the given parameter in vgGetParameterfv or vgGetParameteriv |
|
578 */ |
|
579 EXPORT_C void |
|
580 vgGetParameterfv(VGHandle object, |
|
581 VGint paramType, |
|
582 VGint count, |
|
583 VGfloat * values) |
|
584 { |
|
585 OPENVG_TRACE("vgGetParameterfv object=0x%x, paramType=0x%x, count=%d, values=0x%x", |
|
586 object, paramType, count, values); |
|
587 |
|
588 TGuestOpenVg::vgGetParameterfv(object, paramType, count, values); |
|
589 } |
|
590 |
|
591 EXPORT_C void |
|
592 vgGetParameteriv(VGHandle object, |
|
593 VGint paramType, |
|
594 VGint count, |
|
595 VGint * values) |
|
596 { |
|
597 OPENVG_TRACE("vgGetParameteriv object=0x%x, paramType=0x%x, count=%d, values=0x%x", |
|
598 object, paramType, count, values); |
|
599 |
|
600 TGuestOpenVg::vgGetParameteriv(object, paramType, count, values); |
|
601 } |
|
602 |
|
603 /* Renderer and Extension Information */ |
|
604 |
|
605 /* |
|
606 The vgGetVectorSize function returns the maximum number of elements in the vector |
|
607 that will be retrieved by the vgGetiv or vgGetfv functions if called with the given |
|
608 paramType argument. For scalar values, 1 is returned. If vgGetiv or vgGetfv is |
|
609 called with a smaller value for count than that returned by vgGetVectorSize, |
|
610 only the first count elements of the vector are retrieved. Use of a greater value |
|
611 for count will result in an error. |
|
612 The original value passed to vgSet (except as specifically noted, and provided the call to |
|
613 vgSet completed without error) is returned by vgGet, even if the implementation makes |
|
614 use of a truncated or quantized value internally. This rule ensures that OpenVG state may |
|
615 be saved and restored without degradation. |
|
616 If an error occurs during a call to vgGetfv or vgGetiv, nothing is |
|
617 written to values. |
|
618 |
|
619 ERRORS |
|
620 VG_ILLEGAL_ARGUMENT_ERROR |
|
621 if paramType is not a valid value from the VGParamType enumeration |
|
622 if values is NULL in vgGetfv or vgGetiv |
|
623 if values is not properly aligned in vgGetfv or vgGetiv |
|
624 if count is less than or equal to 0 in vgGetfv or vgGetiv |
|
625 if count is greater than the value returned by vgGetVectorSize for the |
|
626 given parameter in vgGetfv or vgGetiv |
|
627 */ |
|
628 EXPORT_C void |
|
629 vgGetfv(VGParamType type, VGint count, |
|
630 VGfloat * values) |
|
631 { |
|
632 OPENVG_TRACE("vgGetfv type=0x%x, count=%d, values=0x%x", type, count, values); |
|
633 |
|
634 TGuestOpenVg::vgGetfv(type, count, values); |
|
635 } |
|
636 |
|
637 EXPORT_C void |
|
638 vgGetiv(VGParamType type, VGint count, |
|
639 VGint * values) |
|
640 { |
|
641 OPENVG_TRACE("vgGetiv type=0x%x, count=%d, values=0x%x", type, count, values); |
|
642 |
|
643 TGuestOpenVg::vgGetiv(type, count, values); |
|
644 } |
|
645 |
|
646 /* |
|
647 Retrieve the value of the current transformation. |
|
648 Nine values are written to m in the order: |
|
649 { sx, shy, w0, shx, sy, w1, tx, ty, w2 } |
|
650 For an affine matrix, w0 and w1 will always be 0 and w2 will always be 1. |
|
651 |
|
652 ERRORS |
|
653 VG_ILLEGAL_ARGUMENT_ERROR |
|
654 if m is NULL |
|
655 if m is not properly aligned |
|
656 */ |
|
657 EXPORT_C void |
|
658 vgGetMatrix(VGfloat * m) |
|
659 { |
|
660 OPENVG_TRACE("vgGetMatrix m=0x%x", m); |
|
661 |
|
662 TGuestOpenVg::vgGetMatrix(m); |
|
663 } |
|
664 |
|
665 /* |
|
666 Read pixel values from a rectangular portion of an image, performs format conversion |
|
667 if necessary, and stores the resulting pixels into memory. |
|
668 |
|
669 Pixel values are written starting at the address given by the pointer data; adjacent |
|
670 scanlines are separated by dataStride bytes. Negative or zero values of |
|
671 dataStride are allowed. The region to be read is given by x, y, width, and |
|
672 height, which must define a positive region. Pixels that fall outside the bounds |
|
673 of the image are ignored. |
|
674 Pixel values in memory are formatted according to the dataFormat parameter, which |
|
675 must contain a value from the VGImageFormat enumeration. If dataFormat |
|
676 specifies a premultiplied format (VG_sRGBA_8888_PRE or VG_lRGBA_8888_PRE), |
|
677 color channel values of a pixel that are greater than their corresponding alpha value are |
|
678 clamped to the range [0, alpha]. The data pointer alignment and the pixel layout in |
|
679 memory are as described in the vgImageSubData section. |
|
680 |
|
681 ERRORS |
|
682 VG_BAD_HANDLE_ERROR |
|
683 if image is not a valid image handle, or is not shared with the current context |
|
684 VG_IMAGE_IN_USE_ERROR |
|
685 if image is currently a rendering target |
|
686 VG_UNSUPPORTED_IMAGE_FORMAT_ERROR |
|
687 if dataFormat is not a valid value from the VGImageFormat enumeration |
|
688 VG_ILLEGAL_ARGUMENT_ERROR |
|
689 if width or height is less than or equal to 0 |
|
690 if data is NULL |
|
691 if data is not properly aligned |
|
692 */ |
|
693 EXPORT_C void |
|
694 vgGetImageSubData(VGImage image, |
|
695 void * data, |
|
696 VGint dataStride, |
|
697 VGImageFormat dataFormat, |
|
698 VGint x, VGint y, |
|
699 VGint width, VGint height) |
|
700 { |
|
701 OPENVG_TRACE("vgGetImageSubData image=0x%x, data=0x%x, dataStride=%d, dataFormat=0x%x, x=%d, y=%d, width=%d, height=%d", |
|
702 image, data, dataStride, dataFormat, x, y, width, height); |
|
703 |
|
704 TGuestOpenVg::vgGetImageSubData(image, data, dataStride, dataFormat, x, y, width, height); |
|
705 } |
|
706 |
|
707 /* |
|
708 Copy pixel data from the drawing surface without the creation of a VGImage object. |
|
709 Pixel values are written starting at the address given by the pointer data; adjacent |
|
710 scanlines are separated by dataStride bytes. Negative or zero values of |
|
711 dataStride are allowed. The region to be read is given by x, y, width, and |
|
712 height, which must define a positive region. |
|
713 |
|
714 Pixel values in memory are formatted according to the dataFormat parameter, which |
|
715 must contain a value from the VGImageFormat enumeration. The data pointer |
|
716 alignment and the pixel layout in memory is as described for vgImageSubData. |
|
717 |
|
718 Pixels whose source lies outside of the bounds of the drawing surface are |
|
719 ignored. Pixel format conversion is applied as needed. The scissoring region |
|
720 does not affect the reading of pixels. |
|
721 |
|
722 ERRORS |
|
723 VG_UNSUPPORTED_IMAGE_FORMAT_ERROR |
|
724 if dataFormat is not a valid value from the VGImageFormat enumeration |
|
725 VG_ILLEGAL_ARGUMENT_ERROR |
|
726 if width or height is less than or equal to 0 |
|
727 if data is NULL |
|
728 if data is not properly aligned |
|
729 */ |
|
730 EXPORT_C void |
|
731 vgReadPixels(void * data, VGint dataStride, |
|
732 VGImageFormat dataFormat, |
|
733 VGint sx, VGint sy, |
|
734 VGint width, VGint height) |
|
735 { |
|
736 OPENVG_TRACE("vgReadPixels data=0x%x, dataStride=%d, dataFormat=0x%x, sx=%d, sy=%d, width=%d, height=%d", |
|
737 data, dataStride, dataFormat, sx, sy, width, height); |
|
738 |
|
739 TGuestOpenVg::vgReadPixels(data, dataStride, dataFormat, sx, sy, width, height); |
|
740 } |
|
741 |
|
742 /* |
|
743 Returns an axis-aligned bounding box that tightly bounds the interior of the given |
|
744 path. Stroking parameters are ignored. If path is empty, minX and minY are set to 0 |
|
745 and width and height are set to -1. If path contains a single point, minX and minY |
|
746 are set to the coordinates of the point and width and height are set to 0. |
|
747 |
|
748 The VG_PATH_CAPABILITY_PATH_BOUNDS capability must be enabled for path. |
|
749 |
|
750 ERRORS |
|
751 VG_BAD_HANDLE_ERROR |
|
752 if path is not a valid path handle, or is not shared with the current context |
|
753 VG_ILLEGAL_ARGUMENT_ERROR |
|
754 if minX, minY, width, or height is NULL |
|
755 if minX, minY, width, or height is not properly aligned |
|
756 VG_PATH_CAPABILITY_ERROR |
|
757 if VG_PATH_CAPABILITY_PATH_BOUNDS is not enabled for path |
|
758 */ |
|
759 EXPORT_C void |
|
760 vgPathBounds(VGPath path, |
|
761 VGfloat * minX, |
|
762 VGfloat * minY, |
|
763 VGfloat * width, |
|
764 VGfloat * height) |
|
765 { |
|
766 OPENVG_TRACE("vgPathBounds path=0x%x, minX=0x%x, minY=0x%x, width=0x%x, height=0x%x", |
|
767 path, minX, minY, width, height); |
|
768 |
|
769 TGuestOpenVg::vgPathBounds(path, minX, minY, width, height); |
|
770 } |
|
771 |
|
772 /* |
|
773 The vgPathTransformedBounds function returns an axis-aligned bounding box |
|
774 that is guaranteed to enclose the geometry of the given path following |
|
775 transformation by the current path-user-to-surface transform. The returned |
|
776 bounding box is not guaranteed to fit tightly around the path geometry. If path |
|
777 is empty, minX and minY are set to 0 and width and height are set to -1. If |
|
778 path contains a single point, minX and minY are set to the transformed |
|
779 coordinates of the point and width and height are set to 0. |
|
780 The VG_PATH_CAPABILITY_PATH_TRANSFORMED_BOUNDS capability must be |
|
781 enabled for path. |
|
782 |
|
783 ERRORS |
|
784 VG_BAD_HANDLE_ERROR |
|
785 if path is not a valid path handle, or is not shared with the current context |
|
786 VG_ILLEGAL_ARGUMENT_ERROR |
|
787 if minX, minY, width, or height is NULL |
|
788 if minX, minY, width, or height is not properly aligned |
|
789 VG_PATH_CAPABILITY_ERROR |
|
790 if VG_PATH_CAPABILITY_PATH_TRANSFORMED_BOUNDS is not enabled |
|
791 for path |
|
792 */ |
|
793 EXPORT_C void |
|
794 vgPathTransformedBounds(VGPath path, |
|
795 VGfloat * minX, |
|
796 VGfloat * minY, |
|
797 VGfloat * width, |
|
798 VGfloat * height) |
|
799 { |
|
800 OPENVG_TRACE("vgPathTransformedBounds path=0x%x, minX=0x%x, minY=0x%x, width=0x%x, height=0x%x", |
|
801 path, minX, minY, width, height); |
|
802 |
|
803 TGuestOpenVg::vgPathTransformedBounds(path, minX, minY, width, height); |
|
804 } |
|
805 |
|
806 //////////////////////////////////////////////////////////////////////////////////////////// |
|
807 //Syncing methods |
|
808 //////////////////////////////////////////////////////////////////////////////////////////// |
|
809 |
|
810 /* |
|
811 Ensures that all outstanding requests on the current context will complete in finite time. |
|
812 vgFlush may return prior to the actual completion of all requests. |
|
813 */ |
|
814 EXPORT_C void |
|
815 vgFlush(void) |
|
816 { |
|
817 // ToDo comment |
|
818 OPENVG_TRACE("vgFlush"); |
|
819 |
|
820 MVgContext* vgContext = CVghwUtils::VgContext(); |
|
821 if (vgContext) |
|
822 { |
|
823 vgContext->ExecuteVgFlushCommand(); |
|
824 } |
|
825 } |
|
826 |
|
827 /* |
|
828 The vgFinish function forces all outstanding requests on the current context to |
|
829 complete, returning only when the last request has completed. |
|
830 */ |
|
831 EXPORT_C void |
|
832 vgFinish(void) |
|
833 { |
|
834 // ToDo comment |
|
835 OPENVG_TRACE("vgFinish"); |
|
836 |
|
837 MVgContext* vgContext = CVghwUtils::VgContext(); |
|
838 if (vgContext) |
|
839 { |
|
840 vgContext->ExecuteVgFinishCommand(); |
|
841 } |
|
842 } |
|
843 |
|
844 //////////////////////////////////////////////////////////////////////////////////////////// |
|
845 //Functions not returning value (possible to buffer) |
|
846 //////////////////////////////////////////////////////////////////////////////////////////// |
|
847 /* Getters and Setters */ |
|
848 |
|
849 /* |
|
850 The vgSet functions set the value of a parameter on the current context. |
|
851 |
|
852 ERRORS |
|
853 VG_ILLEGAL_ARGUMENT_ERROR |
|
854 if paramType is not a valid value from the VGParamType enumeration |
|
855 if paramType refers to a vector parameter in vgSetf or vgSeti |
|
856 if value is not a legal enumerated value for the given parameter in vgSetf or |
|
857 vgSeti |
|
858 */ |
|
859 EXPORT_C void |
|
860 vgSetf (VGParamType type, VGfloat value) |
|
861 { |
|
862 OPENVG_TRACE("vgSetf type=0x%x, value=%f", type, value); |
|
863 |
|
864 TGuestOpenVg::vgSetf(type, value); |
|
865 } |
|
866 |
|
867 EXPORT_C void |
|
868 vgSeti (VGParamType type, VGint value) |
|
869 { |
|
870 OPENVG_TRACE("vgSeti type=0x%x, value=%d", type, value); |
|
871 |
|
872 TGuestOpenVg::vgSeti(type, value); |
|
873 } |
|
874 |
|
875 /* |
|
876 The vgSet functions set the value of a parameter on the current context. |
|
877 |
|
878 ERRORS |
|
879 VG_ILLEGAL_ARGUMENT_ERROR |
|
880 if paramType is not a valid value from the VGParamType enumeration |
|
881 if paramType refers to a scalar parameter in vgSetfv or vgSetiv and count is |
|
882 not equal to 1 |
|
883 if values[i] is not a legal enumerated value for the given parameter in vgSetfv |
|
884 or vgSetiv for 0 <= i < count |
|
885 if values is NULL in vgSetfv or vgSetiv and count is greater than 0 |
|
886 if values is not properly aligned in vgSetfv or vgSetiv |
|
887 if count is less than 0 in vgSetfv or vgSetiv |
|
888 if count is not a valid value for the given parameter |
|
889 */ |
|
890 EXPORT_C void |
|
891 vgSetfv(VGParamType type, VGint count, |
|
892 const VGfloat * values) |
|
893 { |
|
894 OPENVG_TRACE("vgSetfv type=0x%x, count=%d, values=0x%x", type, count, values); |
|
895 |
|
896 TGuestOpenVg::vgSetfv(type, count, values); |
|
897 } |
|
898 |
|
899 EXPORT_C void |
|
900 vgSetiv(VGParamType type, VGint count, |
|
901 const VGint * values) |
|
902 { |
|
903 OPENVG_TRACE("vgSetiv type=0x%x, count=%d, values=0x%x", type, count, values); |
|
904 |
|
905 TGuestOpenVg::vgSetiv(type, count, values); |
|
906 } |
|
907 |
|
908 /* |
|
909 For vgSetParameterf and vgSetParameteri. |
|
910 |
|
911 The vgSetParameter functions set the value of a parameter on a given VGHandlebased |
|
912 object. |
|
913 |
|
914 ERRORS |
|
915 VG_BAD_HANDLE_ERROR |
|
916 if object is not a valid handle, or is not shared with the current context |
|
917 VG_ILLEGAL_ARGUMENT_ERROR |
|
918 if paramType is not a valid value from the appropriate enumeration |
|
919 if paramType refers to a vector parameter in vgSetParameterf or |
|
920 vgSetParameteri |
|
921 if value is not a legal enumerated value for the given parameter in |
|
922 vgSetParameterf or vgSetParameteri |
|
923 */ |
|
924 EXPORT_C void |
|
925 vgSetParameterf(VGHandle object, |
|
926 VGint paramType, |
|
927 VGfloat value) |
|
928 { |
|
929 OPENVG_TRACE("vgSetParameterf object=0x%x, paramType=0x%x, value=%f -->", object, paramType, value); |
|
930 |
|
931 TGuestOpenVg::vgSetParameterf(object, paramType, value); |
|
932 } |
|
933 |
|
934 EXPORT_C void |
|
935 vgSetParameteri(VGHandle object, |
|
936 VGint paramType, |
|
937 VGint value) |
|
938 { |
|
939 OPENVG_TRACE("vgSetParameteri object=0x%x, paramType=0x%x, value=0x%x", object, paramType, value); |
|
940 |
|
941 TGuestOpenVg::vgSetParameteri(object, paramType, value); |
|
942 } |
|
943 |
|
944 /* |
|
945 For vgSetParameterfv and vgSetParameteriv. |
|
946 |
|
947 The vgSetParameter functions set the value of a parameter on a given VGHandlebased |
|
948 object. |
|
949 |
|
950 ERRORS |
|
951 VG_BAD_HANDLE_ERROR |
|
952 if object is not a valid handle, or is not shared with the current context |
|
953 VG_ILLEGAL_ARGUMENT_ERROR |
|
954 if paramType is not a valid value from the appropriate enumeration |
|
955 if paramType refers to a scalar parameter in vgSetParameterfv or |
|
956 vgSetParameteriv and count is not equal to 1 |
|
957 if values[i] is not a legal enumerated value for the given parameter |
|
958 in vgSetParameterfv or vgSetParameteriv for 0 <= i < count |
|
959 if values is NULL in vgSetParameterfv or vgSetParameteriv and count is |
|
960 greater than 0 |
|
961 if values is not properly aligned in vgSetParameterfv or vgSetParameteriv |
|
962 if count is less than 0 in vgSetParameterfv or vgSetParameteriv |
|
963 if count is not a valid value for the given parameter |
|
964 */ |
|
965 EXPORT_C void |
|
966 vgSetParameterfv(VGHandle object, |
|
967 VGint paramType, |
|
968 VGint count, |
|
969 const VGfloat * values) |
|
970 { |
|
971 OPENVG_TRACE("vgSetParameterfv object=0x%x, paramType=%d, count=%d, values=0x%x", object, paramType, count, values); |
|
972 |
|
973 TGuestOpenVg::vgSetParameterfv(object, paramType, count, values); |
|
974 } |
|
975 |
|
976 EXPORT_C void |
|
977 vgSetParameteriv(VGHandle object, |
|
978 VGint paramType, |
|
979 VGint count, |
|
980 const VGint * values) |
|
981 { |
|
982 OPENVG_TRACE("vgSetParameteriv object=0x%x, paramType=%d, count=%d, values=0x%x", object, paramType, count, values); |
|
983 |
|
984 TGuestOpenVg::vgSetParameteriv(object, paramType, count, values); |
|
985 } |
|
986 |
|
987 /* Matrix Manipulation */ |
|
988 |
|
989 /* |
|
990 Sets the current matrix M to the identity matrix: |
|
991 */ |
|
992 EXPORT_C void |
|
993 vgLoadIdentity(void) |
|
994 { |
|
995 OPENVG_TRACE("vgLoadIdentity"); |
|
996 |
|
997 TGuestOpenVg::vgLoadIdentity(); |
|
998 } |
|
999 |
|
1000 /* |
|
1001 Loads an arbitrary set of matrix values into the current |
|
1002 matrix. Nine matrix values are read from m, in the order: |
|
1003 { sx, shy, w0, shx, sy, w1, tx, ty, w2 } |
|
1004 However, if the targeted matrix is affine (i.e., the matrix mode is not |
|
1005 VG_MATRIX_IMAGE_USER_TO_SURFACE), the values { w0, w1, w2 } are ignored and |
|
1006 replaced by the values { 0, 0, 1 }. |
|
1007 |
|
1008 ERRORS |
|
1009 VG_ILLEGAL_ARGUMENT_ERROR |
|
1010 if m is NULL |
|
1011 if m is not properly aligned |
|
1012 */ |
|
1013 EXPORT_C void |
|
1014 vgLoadMatrix(const VGfloat * m) |
|
1015 { |
|
1016 OPENVG_TRACE("vgLoadMatrix m=0x%x", m); |
|
1017 |
|
1018 TGuestOpenVg::vgLoadMatrix(m); |
|
1019 } |
|
1020 |
|
1021 /* |
|
1022 Right-multiplies the current matrix M by a given matrix: |
|
1023 Nine matrix values are read from m in the order: |
|
1024 { sx, shy, w0, shx, sy, w1, tx, ty, w2 } |
|
1025 and the current matrix is multiplied by the resulting matrix. However, if the |
|
1026 targeted matrix is affine (i.e., the matrix mode is not |
|
1027 VG_MATRIX_IMAGE_USER_TO_SURFACE), the values { w0, w1, w2 } are ignored |
|
1028 and replaced by the values { 0, 0, 1 } prior to multiplication. |
|
1029 |
|
1030 ERRORS |
|
1031 VG_ILLEGAL_ARGUMENT_ERROR |
|
1032 if m is NULL |
|
1033 if m is not properly aligned |
|
1034 */ |
|
1035 EXPORT_C void |
|
1036 vgMultMatrix(const VGfloat * m) |
|
1037 { |
|
1038 OPENVG_TRACE("vgMultMatrix m=0x%x", m); |
|
1039 |
|
1040 TGuestOpenVg::vgMultMatrix(m); |
|
1041 } |
|
1042 |
|
1043 /* |
|
1044 Modifies the current transformation by appending a translation. This is equivalent |
|
1045 to right-multiplying the current matrix M by a translation matrix: |
|
1046 [ 1 0 tx ] |
|
1047 [ 0 1 ty ] |
|
1048 [ 0 0 1 ] |
|
1049 */ |
|
1050 EXPORT_C void |
|
1051 vgTranslate(VGfloat tx, VGfloat ty) |
|
1052 { |
|
1053 OPENVG_TRACE("vgTranslate tx=%f, ty=%f", tx, ty); |
|
1054 |
|
1055 TGuestOpenVg::vgTranslate(tx, ty); |
|
1056 } |
|
1057 |
|
1058 /* |
|
1059 Modifies the current transformation by appending a scale. This is equivalent to |
|
1060 right-multiplying the current matrix M by a scale matrix: |
|
1061 [ sx 0 0 ] |
|
1062 [ 0 sy 0 ] |
|
1063 [ 0 0 1 ] |
|
1064 */ |
|
1065 EXPORT_C void |
|
1066 vgScale(VGfloat sx, VGfloat sy) |
|
1067 { |
|
1068 OPENVG_TRACE("vgScale sx=%f, sy=%f", sx, sy); |
|
1069 |
|
1070 TGuestOpenVg::vgScale(sx, sy); |
|
1071 } |
|
1072 |
|
1073 /* |
|
1074 Modifies the current transformation by appending a shear. This is equivalent to |
|
1075 right-multiplying the current matrix M by a shear matrix: |
|
1076 [ 1 shx 0 ] |
|
1077 [ shy 1 0 ] |
|
1078 [ 0 0 1 ] |
|
1079 */ |
|
1080 EXPORT_C void |
|
1081 vgShear(VGfloat shx, VGfloat shy) |
|
1082 { |
|
1083 OPENVG_TRACE("vgShear shx=%f, shy=%f", shx, shy); |
|
1084 |
|
1085 TGuestOpenVg::vgShear(shx, shy); |
|
1086 } |
|
1087 |
|
1088 /* |
|
1089 Modifies the current transformation by appending a counterclockwise rotation by a given |
|
1090 angle (expressed in degrees) about the origin. This is equivalent to right-multiplying |
|
1091 the current matrix M by the following matrix (using the symbol a to represent the value |
|
1092 of the angle parameter): |
|
1093 [ cos(a) -sin(a) 0 ] |
|
1094 [ sin(a) cos(a) 0 ] |
|
1095 [ 0 0 1 ] |
|
1096 */ |
|
1097 EXPORT_C void |
|
1098 vgRotate(VGfloat angle) |
|
1099 { |
|
1100 OPENVG_TRACE("vgRotate angle=%f"); |
|
1101 |
|
1102 TGuestOpenVg::vgRotate(angle); |
|
1103 } |
|
1104 |
|
1105 /* |
|
1106 Modifies the drawing surface mask values according to a given operation, possibly |
|
1107 using coverage values taken from a mask layer or bitmap image given by the mask |
|
1108 parameter. If no mask is configured for the current drawing surface, vgMask has |
|
1109 no effect. |
|
1110 |
|
1111 ERRORS |
|
1112 VG_BAD_HANDLE_ERROR |
|
1113 if operation is not VG_CLEAR_MASK or VG_FILL_MASK, and mask is not a |
|
1114 valid mask layer or image handle, or is not shared with the current context |
|
1115 VG_IMAGE_IN_USE_ERROR |
|
1116 if mask is a VGImage that is currently a rendering target |
|
1117 VG_ILLEGAL_ARGUMENT_ERROR |
|
1118 if operation is not a valid value from the VGMaskOperation |
|
1119 enumeration |
|
1120 if width or height is less than or equal to 0 |
|
1121 if mask is a VGMaskLayer and is not compatible with the current surface |
|
1122 mask |
|
1123 */ |
|
1124 EXPORT_C void |
|
1125 vgMask(VGHandle mask, VGMaskOperation operation, |
|
1126 VGint x, VGint y, |
|
1127 VGint width, VGint height) |
|
1128 { |
|
1129 OPENVG_TRACE("vgMask mask=0x%x, operation=0x%x, x=%d, y=%d, width=%d, height=%d", |
|
1130 mask, operation, x, y, width, height); |
|
1131 |
|
1132 TGuestOpenVg::vgMask(mask, operation, x, y, width, height); |
|
1133 } |
|
1134 |
|
1135 /* |
|
1136 Modifies the current surface mask by applying the given operation to the set of |
|
1137 coverage values associated with the rendering of the given path. If paintModes |
|
1138 contains VG_FILL_PATH, the path is filled; if it contains VG_STROKE_PATH, the path |
|
1139 is stroked. If both are present, the mask operation is performed in two passes, |
|
1140 first on the filled path geometry, then on the stroked path geometry. |
|
1141 |
|
1142 ERRORS |
|
1143 VG_BAD_HANDLE_ERROR |
|
1144 if path is not a valid path handle |
|
1145 VG_ILLEGAL_ARGUMENT_ERROR |
|
1146 if paintModes is not a valid bitwise OR of values from the VGPaintMode |
|
1147 enumeration |
|
1148 if operation is not a valid value from the VGMaskOperation enumeration |
|
1149 */ |
|
1150 EXPORT_C void |
|
1151 vgRenderToMask(VGPath path, |
|
1152 VGbitfield paintModes, |
|
1153 VGMaskOperation operation) |
|
1154 { |
|
1155 OPENVG_TRACE("vgRenderToMask path=0x%x, paintModes=0x%x, operation=0x%x", path, paintModes, operation); |
|
1156 |
|
1157 TGuestOpenVg::vgRenderToMask(path, paintModes, operation); |
|
1158 } |
|
1159 |
|
1160 /* |
|
1161 Deallocate the resources associated with a mask layer. Following the call, |
|
1162 the maskLayer handle is no longer valid in the current context. |
|
1163 |
|
1164 ERRORS |
|
1165 VG_BAD_HANDLE_ERROR |
|
1166 if maskLayer is not a valid mask handle |
|
1167 */ |
|
1168 EXPORT_C void vgDestroyMaskLayer(VGMaskLayer maskLayer) |
|
1169 { |
|
1170 OPENVG_TRACE("vgDestroyMaskLayer maskLayer=0x%x", maskLayer); |
|
1171 |
|
1172 TGuestOpenVg::vgDestroyMaskLayer(maskLayer); |
|
1173 } |
|
1174 |
|
1175 /* |
|
1176 Set the values of a given maskLayer within a given rectangular region to a given |
|
1177 value. The floating-point value value must be between 0 and 1. The value is rounded |
|
1178 to the closest available value supported by the mask layer. If two values are equally |
|
1179 close, the larger value is used. |
|
1180 |
|
1181 ERRORS |
|
1182 VG_BAD_HANDLE_ERROR |
|
1183 if maskLayer is not a valid mask layer handle, or is not shared with the |
|
1184 current context |
|
1185 VG_ILLEGAL_ARGUMENT_ERROR |
|
1186 if value is less than 0 or greater than 1 |
|
1187 if width or height is less than or equal to 0 |
|
1188 if x or y is less than 0 |
|
1189 if x + width is greater than the width of the mask |
|
1190 if y + height is greater than the height of the mask |
|
1191 */ |
|
1192 EXPORT_C void |
|
1193 vgFillMaskLayer(VGMaskLayer maskLayer, |
|
1194 VGint x, VGint y, |
|
1195 VGint width, VGint height, |
|
1196 VGfloat value) |
|
1197 { |
|
1198 OPENVG_TRACE("vgFillMaskLayer maskLayer=0x%x, x=%d, y=%d, width=%d, height=%d, value=%f", |
|
1199 maskLayer, x, y, width, height, value); |
|
1200 |
|
1201 TGuestOpenVg::vgFillMaskLayer(maskLayer, x, y, width, height, value); |
|
1202 } |
|
1203 |
|
1204 /* |
|
1205 Copies a portion of the current surface mask into a VGMaskLayer object. The source |
|
1206 region starts at (sx, sy) in the surface mask, and the destination region starts |
|
1207 at (dx, dy) in the destination maskLayer. The copied region is clipped to the given |
|
1208 width and height and the bounds of the source and destination. If the current context |
|
1209 does not contain a surface mask, vgCopyMask does nothing. |
|
1210 |
|
1211 ERRORS |
|
1212 VG_BAD_HANDLE_ERROR |
|
1213 if maskLayer is not a valid mask layer handle |
|
1214 VG_ILLEGAL_ARGUMENT_ERROR |
|
1215 if width or height are less than or equal to 0 |
|
1216 if maskLayer is not compatible with the current surface mask |
|
1217 */ |
|
1218 EXPORT_C void |
|
1219 vgCopyMask(VGMaskLayer maskLayer, |
|
1220 VGint sx, VGint sy, |
|
1221 VGint dx, VGint dy, |
|
1222 VGint width, VGint height) |
|
1223 { |
|
1224 OPENVG_TRACE("vgCopyMask maskLayer=0x%x, sx=%d, sy=%d, dx=%d, dy=%d, width=%d, height=%d", |
|
1225 maskLayer, sx, sy, dx, dy, width, height); |
|
1226 |
|
1227 TGuestOpenVg::vgCopyMask(maskLayer, sx, sy, dx, dy, width, height); |
|
1228 } |
|
1229 |
|
1230 /* |
|
1231 Fills the portion of the drawing surface intersecting the rectangle extending from |
|
1232 pixel (x, y) and having the given width and height with a constant color value, taken |
|
1233 from the VG_CLEAR_COLOR parameter. The color value is expressed in non-premultiplied |
|
1234 sRGBA (sRGB color plus alpha)format. Values outside the [0, 1] range are interpreted |
|
1235 as the nearest endpoint of the range. The color is converted to the destination color |
|
1236 space in the same manner as if a rectangular path were being filled. Clipping and |
|
1237 scissoring take place in the usual fashion, but antialiasing, masking, and blending |
|
1238 do not occur. |
|
1239 |
|
1240 ERRORS |
|
1241 VG_ILLEGAL_ARGUMENT_ERROR |
|
1242 if width or height is less than or equal to 0 |
|
1243 */ |
|
1244 EXPORT_C void |
|
1245 vgClear(VGint x, VGint y, |
|
1246 VGint width, VGint height) |
|
1247 { |
|
1248 OPENVG_TRACE("vgClear x=%d, y=%d, width=%d, height=%d", x, y, width, height); |
|
1249 |
|
1250 TGuestOpenVg::vgClear(x, y, width, height); |
|
1251 } |
|
1252 |
|
1253 |
|
1254 /* Paths */ |
|
1255 |
|
1256 /* |
|
1257 Remove all segment command and coordinate data associated with a path. The handle |
|
1258 continues to be valid for use in the future, and the path format and datatype retain |
|
1259 their existing values. The capabilities argument is a bitwise OR of the desired |
|
1260 VGPathCapabilities values. Bits of capabilities that do not correspond to values from |
|
1261 VGPathCapabilities have no effect. Using vgClearPath may be more efficient than |
|
1262 destroying and re-creating a path for short-lived paths. |
|
1263 |
|
1264 ERRORS |
|
1265 VG_BAD_HANDLE_ERROR |
|
1266 if path is not a valid path handle, or is not shared with the current context |
|
1267 */ |
|
1268 EXPORT_C void |
|
1269 vgClearPath(VGPath path, VGbitfield capabilities) |
|
1270 { |
|
1271 OPENVG_TRACE("vgClearPath path=0x%x, capabilities=0x%x", path, capabilities); |
|
1272 |
|
1273 TGuestOpenVg::vgClearPath(path, capabilities); |
|
1274 } |
|
1275 |
|
1276 /* |
|
1277 Release any resources associated with path, and makes the handle invalid in all |
|
1278 contexts that shared it. |
|
1279 |
|
1280 ERRORS |
|
1281 VG_BAD_HANDLE_ERROR |
|
1282 if path is not a valid path handle, or is not shared with the current context |
|
1283 */ |
|
1284 EXPORT_C void vgDestroyPath(VGPath path) |
|
1285 { |
|
1286 OPENVG_TRACE("vgDestroyPath path=0x%x", path); |
|
1287 |
|
1288 TGuestOpenVg::vgDestroyPath(path); |
|
1289 } |
|
1290 |
|
1291 /* |
|
1292 Requests the set of capabilities specified in the capabilities argument to |
|
1293 be disabled for the given path. The capabilities argument is a bitwise OR of |
|
1294 the VGPathCapabilities values whose removal is requested. Attempting to |
|
1295 remove a capability that is already disabled has no effect. Bits of |
|
1296 capabilities that do not correspond to values from VGPathCapabilities have |
|
1297 no effect. |
|
1298 |
|
1299 ERRORS |
|
1300 VG_BAD_HANDLE_ERROR |
|
1301 if path is not a valid path handle, or is not shared with the current context |
|
1302 */ |
|
1303 EXPORT_C void |
|
1304 vgRemovePathCapabilities(VGPath path, |
|
1305 VGbitfield capabilities) |
|
1306 { |
|
1307 OPENVG_TRACE("vgRemovePathCapabilities path=0x%x, capabilities=0x%x", path, capabilities); |
|
1308 |
|
1309 TGuestOpenVg::vgRemovePathCapabilities(path, capabilities); |
|
1310 } |
|
1311 |
|
1312 /* |
|
1313 Appends a copy of all path segments from srcPath onto the end of the existing |
|
1314 data in dstPath. It is legal for srcPath and dstPath to be handles to the same |
|
1315 path object, in which case the contents of the path are duplicated. If srcPath |
|
1316 and dstPath are handles to distinct path objects, the contents of srcPath will |
|
1317 not be affected by the call. |
|
1318 |
|
1319 ERRORS |
|
1320 VG_BAD_HANDLE_ERROR |
|
1321 if either dstPath or srcPath is not a valid path handle, or is not shared |
|
1322 with the current context |
|
1323 VG_PATH_CAPABILITY_ERROR |
|
1324 if VG_PATH_CAPABILITY_APPEND_FROM is not enabled for srcPath |
|
1325 if VG_PATH_CAPABILITY_APPEND_TO is not enabled for dstPath |
|
1326 */ |
|
1327 EXPORT_C void |
|
1328 vgAppendPath(VGPath dstPath, VGPath srcPath) |
|
1329 { |
|
1330 OPENVG_TRACE("vgAppendPath dstPath=0x%x, srcPath=0x%x", dstPath, srcPath); |
|
1331 |
|
1332 TGuestOpenVg::vgAppendPath(dstPath, srcPath); |
|
1333 } |
|
1334 |
|
1335 /* |
|
1336 Appends data taken from pathData to the given path dstPath. The data are formatted |
|
1337 using the path format of dstPath (as returned by querying the paths VG_PATH_FORMAT |
|
1338 parameter using vgGetParameteri). The numSegments parameter gives the total number |
|
1339 of entries in the pathSegments array, and must be greater than 0. Legal values for |
|
1340 the pathSegments array are the values from the VGPathCommand enumeration as well as |
|
1341 VG_CLOSE_PATH and (VG_CLOSE_PATH | VG_RELATIVE) (which are synonymous). |
|
1342 |
|
1343 The pathData pointer must be aligned on a 1-, 2-, or 4-byte boundary (as defined in |
|
1344 the Bytes column of Open VG spec Table 7) depending on the size of the coordinate |
|
1345 datatype (as returned by querying the paths VG_PATH_DATATYPE parameter using |
|
1346 vgGetParameteri). The VG_PATH_CAPABILITY_APPEND_TO capability must be enabled for |
|
1347 path. |
|
1348 |
|
1349 ERRORS |
|
1350 VG_BAD_HANDLE_ERROR |
|
1351 if dstPath is not a valid path handle, or is not shared with the current |
|
1352 context |
|
1353 VG_PATH_CAPABILITY_ERROR |
|
1354 if VG_PATH_CAPABILITY_APPEND_TO is not enabled for dstPath |
|
1355 VG_ILLEGAL_ARGUMENT_ERROR |
|
1356 if pathSegments or pathData is NULL |
|
1357 if pathData is not properly aligned |
|
1358 if numSegments is less than or equal to 0 |
|
1359 if pathSegments contains an illegal command |
|
1360 */ |
|
1361 EXPORT_C void |
|
1362 vgAppendPathData(VGPath dstPath, |
|
1363 VGint numSegments, |
|
1364 const VGubyte * pathSegments, |
|
1365 const void * pathData) |
|
1366 { |
|
1367 OPENVG_TRACE("vgAppendPathData dstPath=0x%x, numSegments=%d, pathSegments=0x%x, pathData=0x%x", |
|
1368 dstPath, numSegments, pathSegments, pathData); |
|
1369 |
|
1370 TGuestOpenVg::vgAppendPathData(dstPath, numSegments, pathSegments, pathData); |
|
1371 } |
|
1372 |
|
1373 /* |
|
1374 Modifies the coordinate data for a contiguous range of segments of dstPath, starting |
|
1375 at startIndex (where 0 is the index of the first path segment) and having length |
|
1376 numSegments. The data in pathData must be formatted in exactly the same manner as the |
|
1377 original coordinate data for the given segment range, unless the path has been |
|
1378 transformed using vgTransformPath or interpolated using vgInterpolatePath. In these |
|
1379 cases, the path will have been subject to the segment promotion rules specified in |
|
1380 those functions. |
|
1381 |
|
1382 The pathData pointer must be aligned on a 1-, 2-, or 4-byte boundary |
|
1383 depending on the size of the coordinate datatype (as returned by querying the |
|
1384 paths VG_PATH_DATATYPE parameter using vgGetParameteri). The |
|
1385 VG_PATH_CAPABILITY_MODIFY capability must be enabled for path. |
|
1386 |
|
1387 ERRORS |
|
1388 VG_BAD_HANDLE_ERROR |
|
1389 if dstPath is not a valid path handle, or is not shared with the current |
|
1390 context |
|
1391 VG_PATH_CAPABILITY_ERROR |
|
1392 if VG_PATH_CAPABILITY_MODIFY is not enabled for dstPath |
|
1393 VG_ILLEGAL_ARGUMENT_ERROR |
|
1394 if pathData is NULL |
|
1395 if pathData is not properly aligned |
|
1396 if startIndex is less than 0 |
|
1397 if numSegments is less than or equal to 0 |
|
1398 if startIndex + numSegments is greater than the number of segments in the path |
|
1399 */ |
|
1400 EXPORT_C void |
|
1401 vgModifyPathCoords(VGPath dstPath, |
|
1402 VGint startIndex, |
|
1403 VGint numSegments, |
|
1404 const void * pathData) |
|
1405 { |
|
1406 OPENVG_TRACE("vgModifyPathCoords dstPath=0x%x, startIndex=%d, numSegments=%d, pathData=0x%x", |
|
1407 dstPath, startIndex, numSegments, pathData); |
|
1408 |
|
1409 TGuestOpenVg::vgModifyPathCoords(dstPath, startIndex, numSegments, pathData); |
|
1410 } |
|
1411 |
|
1412 /* |
|
1413 Appends a transformed copy of srcPath to the current contents of dstPath. |
|
1414 The appended path is equivalent to the results of applying the current |
|
1415 pathuser-to-surface transformation (VG_MATRIX_PATH_USER_TO_SURFACE) to srcPath. |
|
1416 |
|
1417 It is legal for srcPath and dstPath to be handles to the same path object, in |
|
1418 which case the transformed path will be appended to the existing path. If |
|
1419 srcPath and dstPath are handles to distinct path objects, the contents of |
|
1420 srcPath will not be affected by the call. |
|
1421 |
|
1422 ERRORS |
|
1423 VG_BAD_HANDLE_ERROR |
|
1424 if either dstPath or srcPath is not a valid path handle, or is not shared with |
|
1425 the current context |
|
1426 VG_PATH_CAPABILITY_ERROR |
|
1427 if VG_PATH_CAPABILITY_TRANSFORM_FROM is not enabled for srcPath |
|
1428 if VG_PATH_CAPABILITY_TRANSFORM_TO is not enabled for dstPath |
|
1429 */ |
|
1430 EXPORT_C void |
|
1431 vgTransformPath(VGPath dstPath, VGPath srcPath) |
|
1432 { |
|
1433 OPENVG_TRACE("vgTransformPath dstPath=0x%x, srcPath=0x%x", dstPath, srcPath); |
|
1434 |
|
1435 TGuestOpenVg::vgTransformPath(dstPath, srcPath); |
|
1436 } |
|
1437 |
|
1438 /* |
|
1439 Returns the point lying a given distance along a given portion of a path and |
|
1440 the unit-length tangent vector at that point. Only the subpath consisting of the |
|
1441 numSegments path segments beginning with startSegment (where the initial path |
|
1442 segment has index 0) is used. For the remainder of this section we refer only to |
|
1443 this subpath when discussing paths. |
|
1444 |
|
1445 ERRORS |
|
1446 VG_BAD_HANDLE_ERROR |
|
1447 if path is not a valid path handle, or is not shared with the current context |
|
1448 VG_PATH_CAPABILITY_ERROR |
|
1449 If x and y are both non-NULL, and the VG_PATH_CAPABILITY_POINT_ALONG_PATH is |
|
1450 not enabled for path |
|
1451 If tangentX and tangentY are both non-NULL, and the |
|
1452 VG_PATH_CAPABILITY_TANGENT_ALONG_PATH capability is not enabled for path |
|
1453 VG_ILLEGAL_ARGUMENT_ERROR |
|
1454 if startSegment is less than 0 or greater than the index of the final path |
|
1455 segment |
|
1456 if numSegments is less than or equal to 0 |
|
1457 if (startSegment + numSegments 1) is less than 0 or greater than the index |
|
1458 of the final path segment |
|
1459 if x, y, tangentX or tangentY is not properly aligned |
|
1460 */ |
|
1461 EXPORT_C void |
|
1462 vgPointAlongPath(VGPath path, |
|
1463 VGint startSegment, |
|
1464 VGint numSegments, |
|
1465 VGfloat distance, |
|
1466 VGfloat * x, VGfloat * y, |
|
1467 VGfloat * tangentX, |
|
1468 VGfloat * tangentY) |
|
1469 { |
|
1470 OPENVG_TRACE("vgPointAlongPath path=0x%x, startSeg=%d, numSegs=%d, distance=%f, x=0x%x, y=0x%x, tangentX=0x%x, tangentY=0x%x", |
|
1471 path, startSegment, numSegments, distance, x, y, tangentX, tangentY); |
|
1472 |
|
1473 TGuestOpenVg::vgPointAlongPath(path, startSegment, numSegments, distance, x, y, tangentX, tangentY); |
|
1474 } |
|
1475 |
|
1476 /* |
|
1477 Performs filling and stroking. The paintModes argument is a bitwise OR of |
|
1478 values from the VGPaintMode enumeration, determining whether the path is to be |
|
1479 filled (VG_FILL_PATH), stroked (VG_STROKE_PATH), or both (VG_FILL_PATH | |
|
1480 VG_STROKE_PATH). If both filling and stroking are to be performed, the path is |
|
1481 first filled, then stroked. |
|
1482 |
|
1483 ERRORS |
|
1484 VG_BAD_HANDLE_ERROR |
|
1485 if path is not a valid path handle, or is not shared with the current context |
|
1486 VG_ILLEGAL_ARGUMENT_ERROR |
|
1487 if paintModes is not a valid bitwise OR of values from the VGPaintMode |
|
1488 enumeration |
|
1489 */ |
|
1490 EXPORT_C void |
|
1491 vgDrawPath(VGPath path, VGbitfield paintModes) |
|
1492 { |
|
1493 OPENVG_TRACE("vgDrawPath path=0x%x paintModes=0x%x", path, paintModes); |
|
1494 |
|
1495 TGuestOpenVg::vgDrawPath(path, paintModes); |
|
1496 } |
|
1497 |
|
1498 /* Paint */ |
|
1499 |
|
1500 /* |
|
1501 Deallocates the resources associated with a paint object. Following the call, the |
|
1502 paint handle is no longer valid in any of the contexts that shared it. If the paint |
|
1503 object is currently active in a drawing context, the context continues to access it |
|
1504 until it is replaced or the context is destroyed. |
|
1505 |
|
1506 ERRORS |
|
1507 VG_BAD_HANDLE_ERROR |
|
1508 if paint is not a valid paint handle, or is not shared with the current context |
|
1509 */ |
|
1510 EXPORT_C void vgDestroyPaint(VGPaint paint) |
|
1511 { |
|
1512 OPENVG_TRACE("vgDestroyPaint paint=0x%x", paint); |
|
1513 |
|
1514 TGuestOpenVg::vgDestroyPaint(paint); |
|
1515 } |
|
1516 |
|
1517 /* |
|
1518 Set paint definitions on the current context. The paintModes argument is a |
|
1519 bitwise OR of values from the VGPaintMode enumeration, determining whether |
|
1520 the paint object is to be used for filling (VG_FILL_PATH), stroking |
|
1521 (VG_STROKE_PATH), or both (VG_FILL_PATH | VG_STROKE_PATH). The current paint |
|
1522 replaces the previously set paint object, if any, for the given paint mode |
|
1523 or modes. If paint is equal to VG_INVALID_HANDLE, the previously set paint |
|
1524 object for the given mode (if present) is removed and the paint settings are |
|
1525 restored to their default values. |
|
1526 |
|
1527 ERRORS |
|
1528 VG_BAD_HANDLE_ERROR |
|
1529 if paint is neither a valid paint handle nor equal to VG_INVALID_HANDLE, |
|
1530 or is not shared with the current context |
|
1531 VG_ILLEGAL_ARGUMENT_ERROR |
|
1532 if paintModes is not a valid bitwise OR of values from the VGPaintMode |
|
1533 enumeration |
|
1534 */ |
|
1535 EXPORT_C void |
|
1536 vgSetPaint(VGPaint paint, VGbitfield paintModes) |
|
1537 { |
|
1538 OPENVG_TRACE("vgSetPaint paint=0x%x, paintModes=0x%x", paint, paintModes); |
|
1539 |
|
1540 TGuestOpenVg::vgSetPaint(paint, paintModes); |
|
1541 } |
|
1542 |
|
1543 /* |
|
1544 As a shorthand, the vgSetColor function allows the VG_PAINT_COLOR parameter of a |
|
1545 given paint object to be set using a 32-bit non-premultiplied sRGBA_8888 |
|
1546 representation. The rgba parameter is a VGuint with 8 bits of red starting at the |
|
1547 most significant bit, followed by 8 bits each of green, blue, and alpha. Each color |
|
1548 or alpha channel value is conceptually divided by 255. So as to obtain a value |
|
1549 between 0 and 1. |
|
1550 |
|
1551 ERRORS |
|
1552 VG_BAD_HANDLE_ERROR |
|
1553 if paint is not a valid paint handle, or is not shared with the current context |
|
1554 */ |
|
1555 EXPORT_C void |
|
1556 vgSetColor(VGPaint paint, VGuint rgba) |
|
1557 { |
|
1558 OPENVG_TRACE("vgSetColor paint=0x%x, rgba=0x%x", paint, rgba); |
|
1559 |
|
1560 TGuestOpenVg::vgSetColor(paint, rgba); |
|
1561 } |
|
1562 |
|
1563 /* |
|
1564 Replaces any previous pattern image defined on the given paint object for the given |
|
1565 set of paint modes with a new pattern image. A value of VG_INVALID_HANDLE for the |
|
1566 pattern parameter removes the current pattern image from the paint object. |
|
1567 If the current paint object has its VG_PAINT_TYPE parameter set to VG_PAINT_TYPE_PATTERN, |
|
1568 but no pattern image is set, the paint object behaves as if VG_PAINT_TYPE were set to |
|
1569 VG_PAINT_TYPE_COLOR. While an image is set as the paint pattern for any paint object, it |
|
1570 may not be used as a rendering target. Conversely, an image that is currently a rendering |
|
1571 target may not be set as a paint pattern. |
|
1572 |
|
1573 ERRORS |
|
1574 VG_BAD_HANDLE_ERROR |
|
1575 if paint is not a valid paint handle, or is not shared with the current context |
|
1576 if pattern is neither a valid image handle nor equal to VG_INVALID_HANDLE, or is not |
|
1577 shared with the current context |
|
1578 VG_IMAGE_IN_USE_ERROR |
|
1579 if pattern is currently a rendering target |
|
1580 */ |
|
1581 EXPORT_C void |
|
1582 vgPaintPattern(VGPaint paint, VGImage pattern) |
|
1583 { |
|
1584 OPENVG_TRACE("vgPaintPattern paint=0x%x, pattern=0x%x", paint, pattern); |
|
1585 |
|
1586 TGuestOpenVg::vgPaintPattern(paint, pattern); |
|
1587 } |
|
1588 |
|
1589 /* Images */ |
|
1590 |
|
1591 /* |
|
1592 Deallocates the resources associated with an image. Following the call, the image |
|
1593 handle is no longer valid in any context that shared it. If the image is currently |
|
1594 in use as a rendering target, is the ancestor of another image (see vgChildImage), |
|
1595 is set as a paint pattern image on a VGPaint object, or is set as a glyph an a |
|
1596 VGFont object, its definition remains available to those consumers as long as they |
|
1597 remain valid, but the handle may no longer be used. When those uses cease, the |
|
1598 images resources will automatically be deallocated. |
|
1599 |
|
1600 ERRORS |
|
1601 VG_BAD_HANDLE_ERROR |
|
1602 if image is not a valid image handle, or is not shared with the current |
|
1603 context |
|
1604 */ |
|
1605 EXPORT_C void vgDestroyImage(VGImage image) |
|
1606 { |
|
1607 OPENVG_TRACE("vgDestroyImage image=0x%x -->", image); |
|
1608 |
|
1609 TGuestOpenVg::vgDestroyImage(image); |
|
1610 OPENVG_TRACE("vgDestroyImage <--"); |
|
1611 } |
|
1612 |
|
1613 /* |
|
1614 Fills a given rectangle of an image with the color specified by the VG_CLEAR_COLOR parameter. |
|
1615 The rectangle to be cleared is given by x, y, width, and height, which must define a positive |
|
1616 region. The rectangle is clipped to the bounds of the image. |
|
1617 |
|
1618 ERRORS |
|
1619 VG_BAD_HANDLE_ERROR |
|
1620 if image is not a valid image handle, or is not shared with the current |
|
1621 context |
|
1622 VG_IMAGE_IN_USE_ERROR |
|
1623 if image is currently a rendering target |
|
1624 VG_ILLEGAL_ARGUMENT_ERROR |
|
1625 if width or height is less than or equal to 0 |
|
1626 */ |
|
1627 EXPORT_C void |
|
1628 vgClearImage(VGImage image, |
|
1629 VGint x, VGint y, |
|
1630 VGint width, VGint height) |
|
1631 { |
|
1632 OPENVG_TRACE("vgClearImage image=0x%x, x=%d, y=%d, width=%d, height=%d", |
|
1633 image, x, y, width, height); |
|
1634 |
|
1635 TGuestOpenVg::vgClearImage(image, x, y, width, height); |
|
1636 } |
|
1637 |
|
1638 /* |
|
1639 Read pixel values from memory, perform format conversion if necessary, and store |
|
1640 the resulting pixels into a rectangular portion of an image. |
|
1641 |
|
1642 Pixel values are read starting at the address given by the pointer data; adjacent |
|
1643 scanlines are separated by dataStride bytes. Negative or zero values of |
|
1644 dataStride are allowed. The region to be written is given by x, y, width, and |
|
1645 height, which must define a positive region. Pixels that fall outside the bounds |
|
1646 of the image are ignored. |
|
1647 |
|
1648 Pixel values in memory are formatted according to the dataFormat parameter, which |
|
1649 must contain a value from the VGImageFormat enumeration. The data pointer must |
|
1650 be aligned according to the number of bytes of the pixel format specified by |
|
1651 dataFormat, unless dataFormat is equal to VG_BW_1, VG_A_1, or VG_A_4, in |
|
1652 which case 1 byte alignment is sufficient. Each pixel is converted into the format of |
|
1653 the destination image as it is written. |
|
1654 |
|
1655 ERRORS |
|
1656 VG_BAD_HANDLE_ERROR |
|
1657 if image is not a valid image handle, or is not shared with the current |
|
1658 context |
|
1659 VG_IMAGE_IN_USE_ERROR |
|
1660 if image is currently a rendering target |
|
1661 VG_UNSUPPORTED_IMAGE_FORMAT_ERROR |
|
1662 if dataFormat is not a valid value from the VGImageFormat enumeration |
|
1663 VG_ILLEGAL_ARGUMENT_ERROR |
|
1664 if width or height is less than or equal to 0 |
|
1665 if data is NULL |
|
1666 if data is not properly aligned |
|
1667 */ |
|
1668 EXPORT_C void |
|
1669 vgImageSubData(VGImage image, |
|
1670 const void * data, |
|
1671 VGint dataStride, |
|
1672 VGImageFormat dataFormat, |
|
1673 VGint x, VGint y, |
|
1674 VGint width, VGint height) |
|
1675 { |
|
1676 OPENVG_TRACE("vgImageSubData image=0x%x, data=0x%x, dataStride=%d, dataFormat=0x%x, x=%d, y=%d, width=%d, height=%d", |
|
1677 image, data, dataStride, dataFormat, x, y, width, height); |
|
1678 |
|
1679 TGuestOpenVg::vgImageSubData(image, data, dataStride, dataFormat, x, y, width, height); |
|
1680 } |
|
1681 |
|
1682 /* |
|
1683 Copies pixels between images. The source image pixel (sx + i, sy + j) is copied |
|
1684 to the destination image pixel (dx + i, dy + j), for 0 <= i < width and |
|
1685 0 <= j < height. Pixels whose source or destination lie outside of the bounds |
|
1686 of the respective image are ignored. Pixel format conversion is applied as needed. |
|
1687 |
|
1688 ERRORS |
|
1689 VG_BAD_HANDLE_ERROR |
|
1690 if either dst or src is not a valid image handle, or is not shared with the |
|
1691 current context |
|
1692 VG_IMAGE_IN_USE_ERROR |
|
1693 if either dst or src is currently a rendering target |
|
1694 VG_ILLEGAL_ARGUMENT_ERROR |
|
1695 if width or height is less than or equal to 0 |
|
1696 */ |
|
1697 EXPORT_C void |
|
1698 vgCopyImage(VGImage dst, VGint dx, VGint dy, |
|
1699 VGImage src, VGint sx, VGint sy, |
|
1700 VGint width, VGint height, |
|
1701 VGboolean dither) |
|
1702 { |
|
1703 OPENVG_TRACE("vgCopyImage dst=0x%x, dx=%d, dy=%d, src=0x%x, sx=%d, sy=%d, width=%d, height=%d, dither=%d", |
|
1704 dst, dx, dy, src, sx, sy, width, height, dither); |
|
1705 |
|
1706 TGuestOpenVg::vgCopyImage(dst, dx, dy, src, sx, sy, width, height, dither); |
|
1707 } |
|
1708 |
|
1709 /* |
|
1710 Draw an image to the current drawing surface. The current image-user-to-surface |
|
1711 transformation Ti is applied to the image, so that the image pixel centered at |
|
1712 (px + 0.5, py + 0.5) is mapped to the point (Ti)(px + 0.5, py + 0.5). In practice, |
|
1713 backwards mapping may be used. That is, a sample located at (x, y) in the surface |
|
1714 coordinate system is colored according to an interpolated image pixel value at the |
|
1715 point (Ti)-1(x, y) in the image coordinate system. If Ti is non-invertible (or nearly |
|
1716 so, within the limits of numerical accuracy), no drawing occurs. |
|
1717 |
|
1718 ERRORS |
|
1719 VG_BAD_HANDLE_ERROR |
|
1720 if image is not a valid image handle, or is not shared with the current |
|
1721 context |
|
1722 VG_IMAGE_IN_USE_ERROR |
|
1723 if image is currently a rendering target |
|
1724 */ |
|
1725 EXPORT_C void |
|
1726 vgDrawImage(VGImage image) |
|
1727 { |
|
1728 OPENVG_TRACE("vgDrawImage image=0x%x", image); |
|
1729 |
|
1730 TGuestOpenVg::vgDrawImage(image); |
|
1731 } |
|
1732 |
|
1733 /* |
|
1734 Copies pixel data from the image src onto the drawing surface. The image pixel |
|
1735 (sx + i, sy + j) is copied to the drawing surface pixel (dx + i, dy + j), for |
|
1736 0 <= i < width and 0 <= j < height. Pixels whose source lies outside of the |
|
1737 bounds of src or whose destination lies outside the bounds of the drawing surface |
|
1738 are ignored. Pixel format conversion is applied as needed. Scissoring takes place |
|
1739 normally. Transformations, masking, and blending are not applied. |
|
1740 |
|
1741 ERRORS |
|
1742 VG_BAD_HANDLE_ERROR |
|
1743 if src is not a valid image handle, or is not shared with the current context |
|
1744 VG_IMAGE_IN_USE_ERROR |
|
1745 if src is currently a rendering target |
|
1746 VG_ILLEGAL_ARGUMENT_ERROR |
|
1747 if width or height is less than or equal to 0 |
|
1748 */ |
|
1749 EXPORT_C void |
|
1750 vgSetPixels(VGint dx, VGint dy, |
|
1751 VGImage src, VGint sx, VGint sy, |
|
1752 VGint width, VGint height) |
|
1753 { |
|
1754 OPENVG_TRACE("vgSetPixels dx=%d, dy=%d, src==0x%x, sx=%d, sy=%d, width=%d, height=%d", |
|
1755 dx, dy, src, sx, sy, width, height); |
|
1756 |
|
1757 TGuestOpenVg::vgSetPixels(dx, dy, src, sx, sy, width, height); |
|
1758 } |
|
1759 |
|
1760 /* |
|
1761 Copy pixel data to the drawing surface without the creation of a VGImage object. The pixel |
|
1762 values to be drawn are taken from the data pointer at the time of the vgWritePixels call, |
|
1763 so future changes to the data have no effect. The effects of changes to the data by another |
|
1764 thread at the time of the call to vgWritePixels are undefined. |
|
1765 |
|
1766 ERRORS |
|
1767 VG_UNSUPPORTED_IMAGE_FORMAT_ERROR |
|
1768 if dataFormat is not a valid value from the VGImageFormat enumeration |
|
1769 VG_ILLEGAL_ARGUMENT_ERROR |
|
1770 if width or height is less than or equal to 0 |
|
1771 if data is NULL |
|
1772 if data is not properly aligned |
|
1773 */ |
|
1774 EXPORT_C void |
|
1775 vgWritePixels(const void * data, VGint dataStride, |
|
1776 VGImageFormat dataFormat, |
|
1777 VGint dx, VGint dy, |
|
1778 VGint width, VGint height) |
|
1779 { |
|
1780 OPENVG_TRACE("vgWritePixels data=0x%x, dataStride=%d, dataFormat=0x%x, dx=%d, dy=%d, width=%d, height=%d", |
|
1781 data, dataStride, dataFormat, dx, dy, width, height); |
|
1782 |
|
1783 TGuestOpenVg::vgWritePixels(data, dataStride, dataFormat, dx, dy, width, height); |
|
1784 } |
|
1785 |
|
1786 /* |
|
1787 Retrieves pixel data from the drawing surface into the image dst. The drawing surface |
|
1788 pixel (sx + i, sy + j) is copied to pixel (dx + i, dy + j) of the image dst, for |
|
1789 0 <= i < width and 0 <= j < height. Pixels whose source lies outside of the bounds of |
|
1790 the drawing surface or whose destination lies outside the bounds of dst are ignored. |
|
1791 Pixel format conversion is applied as needed. The scissoring region does not affect |
|
1792 the reading of pixels. |
|
1793 |
|
1794 ERRORS |
|
1795 VG_BAD_HANDLE_ERROR |
|
1796 if dst is not a valid image handle, or is not shared with the current context |
|
1797 VG_IMAGE_IN_USE_ERROR |
|
1798 if dst is currently a rendering target |
|
1799 VG_ILLEGAL_ARGUMENT_ERROR |
|
1800 if width or height is less than or equal to 0 |
|
1801 */ |
|
1802 EXPORT_C void |
|
1803 vgGetPixels(VGImage dst, VGint dx, VGint dy, |
|
1804 VGint sx, VGint sy, |
|
1805 VGint width, VGint height) |
|
1806 { |
|
1807 OPENVG_TRACE("vgGetPixels dst=0x%x, dx=%d, dy=%d, sx=%d, sy=%d, width=%d, height=%d", |
|
1808 dst, dx, dy, sx, sy, width, height); |
|
1809 |
|
1810 TGuestOpenVg::vgGetPixels(dst, dx, dy, sx, sy, width, height); |
|
1811 } |
|
1812 |
|
1813 /* |
|
1814 Copy pixels from one region of the drawing surface to another. Copies between |
|
1815 overlapping regions are allowed and always produce consistent results identical to |
|
1816 copying the entire source region to a scratch buffer followed by copying the scratch |
|
1817 buffer into the destination region. The drawing surface pixel (sx + i, sy + j) is |
|
1818 copied to pixel (dx + i, dy + j) for 0 <= i < width and 0 <= j < height. Pixels whose |
|
1819 source or destination lies outside of the bounds of the drawing surface are ignored. |
|
1820 Transformations, masking, and blending are not applied. Scissoring is applied to the |
|
1821 destination, but does not affect the reading of pixels. |
|
1822 |
|
1823 ERRORS |
|
1824 VG_ILLEGAL_ARGUMENT_ERROR |
|
1825 if width or height is less than or equal to 0 |
|
1826 */ |
|
1827 EXPORT_C void |
|
1828 vgCopyPixels(VGint dx, VGint dy, |
|
1829 VGint sx, VGint sy, |
|
1830 VGint width, VGint height) |
|
1831 { |
|
1832 OPENVG_TRACE("vgCopyPixels dx=%d, dy=%d, sx=%d, sy=%d, width=%d, height=%d", |
|
1833 dx, dy, sx, sy, width, height); |
|
1834 |
|
1835 TGuestOpenVg::vgCopyPixels(dx, dy, sx, sy, width, height); |
|
1836 } |
|
1837 |
|
1838 /* |
|
1839 Destroys the VGFont object pointed to by the font argument. |
|
1840 Note that vgDestroyFont will not destroy underlying objects that were used to |
|
1841 define glyphs in the font. It is the responsibility of an application to destroy all |
|
1842 VGPath or VGImage objects that were used in a VGFont, if they are no longer in |
|
1843 use. |
|
1844 |
|
1845 ERRORS |
|
1846 VG_BAD_HANDLE_ERROR |
|
1847 if font is not a valid font handle, or is not shared with the current context |
|
1848 */ |
|
1849 EXPORT_C void |
|
1850 vgDestroyFont(VGFont font) |
|
1851 { |
|
1852 OPENVG_TRACE("vgDestroyFont font=0x%x", font); |
|
1853 |
|
1854 TGuestOpenVg::vgDestroyFont(font); |
|
1855 } |
|
1856 |
|
1857 /* |
|
1858 Creates a new glyph and assigns the given path to a glyph associated with the |
|
1859 glyphIndex in a font object. The glyphOrigin argument defines the coordinates of |
|
1860 the glyph origin within the path, and the escapement parameter determines the |
|
1861 advance width for this glyph. Both glyphOrigin and escapement coordinates are |
|
1862 defined in the same coordinate system as the path. For glyphs that have no |
|
1863 visual representation (e.g., the <space> character), a value of VG_INVALID_HANDLE |
|
1864 is used for path. The reference count for the path is incremented. |
|
1865 |
|
1866 The path object may define either an original glyph outline, or an outline that |
|
1867 has been scaled and hinted to a particular size (in surface coordinate units); this |
|
1868 is defined by the isHinted parameter, which can be used by implementation |
|
1869 for text-specific optimizations (e.g., heuristic auto-hinting of unhinted outlines). |
|
1870 When isHinted is equal to VG_TRUE, the implementation will never apply |
|
1871 auto-hinting; otherwise, auto hinting will be applied at the implementation's |
|
1872 discretion. |
|
1873 |
|
1874 ERRORS |
|
1875 VG_BAD_HANDLE_ERROR |
|
1876 if font is not a valid font handle, or is not shared with the current context |
|
1877 if path is not a valid font handle or VG_INVALID_HANDLE, or is not shared |
|
1878 with the current context |
|
1879 VG_ILLEGAL_ARGUMENT_ERROR |
|
1880 if the pointer to glyphOrigin or escapement is NULL or is not properly |
|
1881 aligned |
|
1882 */ |
|
1883 EXPORT_C void |
|
1884 vgSetGlyphToPath(VGFont font, |
|
1885 VGuint glyphIndex, |
|
1886 VGPath path, |
|
1887 VGboolean isHinted, |
|
1888 const VGfloat glyphOrigin [2], |
|
1889 const VGfloat escapement[2]) |
|
1890 { |
|
1891 OPENVG_TRACE("vgSetGlyphToPath font=0x%x, glyphIndex=%u, path=0x%x, isHinted=%d, glyphOrigin=0x%x, escapement=0x%x", |
|
1892 font, glyphIndex, path, isHinted, glyphOrigin, escapement); |
|
1893 |
|
1894 TGuestOpenVg::vgSetGlyphToPath(font, glyphIndex, path, isHinted, glyphOrigin, escapement); |
|
1895 } |
|
1896 |
|
1897 /* |
|
1898 Creates a new glyph and assigns the given image into a glyph associated with |
|
1899 the glyphIndex in a font object. The glyphOrigin argument defines the |
|
1900 coordinates of the glyph origin within the image, and the escapement parameter |
|
1901 determines the advance width for this glyph. Both glyphOrigin and escapement |
|
1902 coordinates are defined in the image coordinate system. Applying transformations |
|
1903 to an image (other than translations mapped to pixel grid in surface coordinate |
|
1904 system) should be avoided as much as possible. For glyphs that have no visual |
|
1905 representation (e.g., the <space> character), a value of VG_INVALID_HANDLE is |
|
1906 used for image. The reference count for the image is incremented. |
|
1907 |
|
1908 ERRORS |
|
1909 VG_BAD_HANDLE_ERROR |
|
1910 if font is not a valid font handle, or is not shared with the current context |
|
1911 if image is not a valid image handle or VG_INVALID_HANDLE, or is not |
|
1912 shared with the current context |
|
1913 VG_ILLEGAL_ARGUMENT_ERROR |
|
1914 if the pointer to glyphOrigin or escapement is NULL or is not properly |
|
1915 aligned |
|
1916 VG_IMAGE_IN_USE_ERROR |
|
1917 if image is currently a rendering target |
|
1918 */ |
|
1919 EXPORT_C void |
|
1920 vgSetGlyphToImage(VGFont font, |
|
1921 VGuint glyphIndex, |
|
1922 VGImage image, |
|
1923 const VGfloat glyphOrigin [2], |
|
1924 const VGfloat escapement[2]) |
|
1925 { |
|
1926 OPENVG_TRACE("vgSetGlyphToImage font=0x%x, glyphIndex=%d, image=0x%x, glyphOrigin=0x%x, escapement=0x%x", |
|
1927 font, glyphIndex, image, (void*)glyphOrigin, (void*)escapement); |
|
1928 |
|
1929 TGuestOpenVg::vgSetGlyphToImage(font, glyphIndex, image, glyphOrigin, escapement); |
|
1930 } |
|
1931 |
|
1932 /* |
|
1933 Deletes the glyph defined by a glyphIndex parameter from a font. The reference count |
|
1934 for the VGPath or VGImage object to which the glyph was previously set is decremented, |
|
1935 and the object's resources are released if the count has fallen to 0. |
|
1936 |
|
1937 ERRORS |
|
1938 VG_BAD_HANDLE_ERROR |
|
1939 if font is not a valid font handle, or is not shared with the current context |
|
1940 VG_ILLEGAL_ARGUMENT_ERROR |
|
1941 if glyphIndex is not defined for the font |
|
1942 */ |
|
1943 EXPORT_C void |
|
1944 vgClearGlyph(VGFont font, |
|
1945 VGuint glyphIndex) |
|
1946 { |
|
1947 OPENVG_TRACE("vgClearGlyph font=0x%x, glyphIndex=%u", font, glyphIndex); |
|
1948 |
|
1949 TGuestOpenVg::vgClearGlyph(font, glyphIndex); |
|
1950 } |
|
1951 |
|
1952 /* |
|
1953 Renders a glyph defined by the glyphIndex using the given font object. The |
|
1954 user space position of the glyph (the point where the glyph origin will be |
|
1955 placed) is determined by value of VG_GLYPH_ORIGIN. vgDrawGlyph calculates the |
|
1956 new text origin by translating the glyph origin by the escapement vector of |
|
1957 the glyph defined by glyphIndex. Following the call, the VG_GLYPH_ORIGIN |
|
1958 parameter will be updated with the new origin. |
|
1959 |
|
1960 ERRORS |
|
1961 VG_BAD_HANDLE_ERROR |
|
1962 if font is not a valid font handle, or is not shared with the current context |
|
1963 VG_ILLEGAL_ARGUMENT_ERROR |
|
1964 if glyphIndex has not been defined for a given font object |
|
1965 if paintModes is not a valid bitwise OR of values from the VGPaintMode |
|
1966 enumeration, or 0 |
|
1967 */ |
|
1968 EXPORT_C void |
|
1969 vgDrawGlyph(VGFont font, |
|
1970 VGuint glyphIndex, |
|
1971 VGbitfield paintModes, |
|
1972 VGboolean allowAutoHinting) |
|
1973 { |
|
1974 OPENVG_TRACE("vgDrawGlyph font=0x%x, glyphIndex=%u, paintModes=0x%x, allowAutoHinting=%d", |
|
1975 font, glyphIndex, paintModes, allowAutoHinting); |
|
1976 |
|
1977 TGuestOpenVg::vgDrawGlyph(font, glyphIndex, paintModes, allowAutoHinting); |
|
1978 } |
|
1979 |
|
1980 /* |
|
1981 Renders a sequence of glyphs defined by the array pointed to by glyphIndices |
|
1982 using the given font object. The values in the adjustments_x and adjustments_y |
|
1983 arrays define positional adjustment values for each pair of glyphs defined by |
|
1984 the glyphIndices array. The glyphCount parameter defines the number of elements |
|
1985 in the glyphIndices and adjustments_x and adjustments_y arrays. The adjustment |
|
1986 values defined in these arrays may represent kerning or other positional adjustments |
|
1987 required for each pair of glyphs. If no adjustments for glyph positioning in a |
|
1988 particular axis are required (all horizontal and/or vertical adjustments are zero), |
|
1989 NULL pointers may be passed for either or both of adjustment_x and |
|
1990 adjustment_y. The adjustments values should be defined in the same |
|
1991 coordinate system as the font glyphs; if the glyphs are defined by path objects |
|
1992 with path data scaled (e.g., by a factor of 1/units-per-EM), the values in the |
|
1993 adjustment_x and adjustment_y arrays are scaled using the same scale factor. |
|
1994 |
|
1995 ERRORS |
|
1996 VG_BAD_HANDLE_ERROR |
|
1997 if font is not a valid font handle, or is not shared with the current context |
|
1998 VG_ILLEGAL_ARGUMENT_ERROR |
|
1999 if glyphCount is zero or a negative value |
|
2000 if the pointer to the glyphIndices array is NULL or is not properly |
|
2001 aligned |
|
2002 if a pointer to either of the adjustments_x or adjustments_y arrays are |
|
2003 non-NULL and are not properly aligned |
|
2004 if any of the glyphIndices has not been defined in a given font object |
|
2005 if paintModes is not a valid bitwise OR of values from the VGPaintMode |
|
2006 enumeration, or 0 |
|
2007 */ |
|
2008 EXPORT_C void |
|
2009 vgDrawGlyphs(VGFont font, |
|
2010 VGint glyphCount, |
|
2011 const VGuint * glyphIndices, |
|
2012 const VGfloat * adjustments_x, |
|
2013 const VGfloat * adjustments_y, |
|
2014 VGbitfield paintModes, |
|
2015 VGboolean allowAutoHinting) |
|
2016 { |
|
2017 OPENVG_TRACE("vgDrawGlyphs font=0x%x, glyphCount=%d, glyphIndices=0x%x, adjustments_y=0x%x, " |
|
2018 "adjustments_x=0x%x, paintModes=0x%x, allowAutoHinting=%d", |
|
2019 font, glyphCount, (void*)glyphIndices, (void*)adjustments_x, (void*)adjustments_y, paintModes, allowAutoHinting); |
|
2020 |
|
2021 TGuestOpenVg::vgDrawGlyphs(font, glyphCount, glyphIndices, adjustments_x, adjustments_y, paintModes, allowAutoHinting); |
|
2022 } |
|
2023 |
|
2024 /* Image Filters */ |
|
2025 |
|
2026 /* |
|
2027 Computes a linear combination of color and alpha values (Rsrc, Gsrc, Bsrc, |
|
2028 ALPHAsrc) from the normalized source image src at each pixel. |
|
2029 |
|
2030 ERRORS |
|
2031 VG_BAD_HANDLE_ERROR |
|
2032 if either dst or src is not a valid image handle, or is not shared with the |
|
2033 current context |
|
2034 VG_IMAGE_IN_USE_ERROR |
|
2035 if either dst or src is currently a rendering target |
|
2036 VG_ILLEGAL_ARGUMENT_ERROR |
|
2037 if src and dst overlap |
|
2038 if matrix is NULL |
|
2039 if matrix is not properly aligned |
|
2040 */ |
|
2041 EXPORT_C void |
|
2042 vgColorMatrix(VGImage dst, VGImage src, |
|
2043 const VGfloat * matrix) |
|
2044 { |
|
2045 OPENVG_TRACE("vgColorMatrix dst=0x%x, src=0x%x, matrix=0x%x", dst, src, matrix); |
|
2046 |
|
2047 TGuestOpenVg::vgColorMatrix(dst, src, matrix); |
|
2048 } |
|
2049 |
|
2050 /* |
|
2051 Applies a user-supplied convolution kernel to a normalized source image src. The |
|
2052 dimensions of the kernel are given by kernelWidth and kernelHeight; the kernel values |
|
2053 are specified as kernelWidth*kernelHeight VGshorts in column-major order. That is, |
|
2054 the kernel entry (i, j) is located at position i*kernelHeight + j in the input sequence. |
|
2055 The shiftX and shiftY parameters specify a translation between the source and |
|
2056 destination images. The result of the convolution is multiplied by a scale factor, and |
|
2057 a bias is added. |
|
2058 |
|
2059 ERRORS |
|
2060 VG_BAD_HANDLE_ERROR |
|
2061 if either dst or src is not a valid image handle, or is not shared with the |
|
2062 current context |
|
2063 VG_IMAGE_IN_USE_ERROR |
|
2064 if either dst or src is currently a rendering target |
|
2065 VG_ILLEGAL_ARGUMENT_ERROR |
|
2066 if src and dst overlap |
|
2067 if kernelWidth or kernelHeight is less than or equal to 0 or greater than |
|
2068 VG_MAX_KERNEL_SIZE |
|
2069 if kernel is NULL |
|
2070 if kernel is not properly aligned |
|
2071 if tilingMode is not one of the values from the VGTilingMode enumeration |
|
2072 */ |
|
2073 EXPORT_C void |
|
2074 vgConvolve(VGImage dst, VGImage src, |
|
2075 VGint kernelWidth, VGint kernelHeight, |
|
2076 VGint shiftX, VGint shiftY, |
|
2077 const VGshort * kernel, |
|
2078 VGfloat scale, |
|
2079 VGfloat bias, |
|
2080 VGTilingMode tilingMode) |
|
2081 { |
|
2082 OPENVG_TRACE("vgConvolve dst=0x%x, src=0x%x, kW=%d, kH=%d, shX=%d, shY=%d, kernel=0x%x, scale=%f, bias=%f, tiling=0x%x", |
|
2083 dst, src, kernelWidth, kernelHeight, shiftX, shiftY, kernel, scale, bias, tilingMode); |
|
2084 |
|
2085 TGuestOpenVg::vgConvolve(dst, src, kernelWidth, kernelHeight, shiftX, shiftY, kernel, scale, bias, tilingMode); |
|
2086 } |
|
2087 |
|
2088 /* |
|
2089 Applies a user-supplied separable convolution kernel to a normalized source image src. |
|
2090 A separable kernel is a two-dimensional kernel in which each entry kij is equal to a |
|
2091 product kxi * kyj of elements from two one dimensional kernels, one horizontal and one |
|
2092 vertical. |
|
2093 |
|
2094 ERRORS |
|
2095 VG_BAD_HANDLE_ERROR |
|
2096 if either dst or src is not a valid image handle, or is not shared with the |
|
2097 current context |
|
2098 VG_IMAGE_IN_USE_ERROR |
|
2099 if either dst or src is currently a rendering target |
|
2100 VG_ILLEGAL_ARGUMENT_ERROR |
|
2101 if src and dst overlap |
|
2102 if kernelWidth or kernelHeight is less than or equal to 0 or greater than |
|
2103 VG_MAX_SEPARABLE_KERNEL_SIZE |
|
2104 if kernelX or kernelY is NULL |
|
2105 if kernelX or kernelY is not properly aligned |
|
2106 if tilingMode is not one of the values from the VGTilingMode |
|
2107 enumeration |
|
2108 */ |
|
2109 EXPORT_C void |
|
2110 vgSeparableConvolve(VGImage dst, VGImage src, |
|
2111 VGint kernelWidth, |
|
2112 VGint kernelHeight, |
|
2113 VGint shiftX, VGint shiftY, |
|
2114 const VGshort * kernelX, |
|
2115 const VGshort * kernelY, |
|
2116 VGfloat scale, |
|
2117 VGfloat bias, |
|
2118 VGTilingMode tilingMode) |
|
2119 { |
|
2120 OPENVG_TRACE("vgSeparableConvolve dst=0x%x, src=0x%x, kW=%d, kH=%d, shX=%d, shY=%d, kX=0x%x, kY=0x%x, scale=%f, bias=%f, tiling=0x%x", |
|
2121 dst, src, kernelWidth, kernelHeight, shiftX, shiftY, kernelX, kernelY, scale, bias, tilingMode); |
|
2122 |
|
2123 TGuestOpenVg::vgSeparableConvolve(dst, src, kernelWidth, kernelHeight, shiftX, shiftY, kernelX, kernelY, scale, bias, tilingMode); |
|
2124 } |
|
2125 |
|
2126 /* |
|
2127 Computes the convolution of a normalized source image src with a separable kernel |
|
2128 defined in each dimension by the Gaussian function G(x, s). |
|
2129 |
|
2130 ERRORS |
|
2131 VG_BAD_HANDLE_ERROR |
|
2132 if either dst or src is not a valid image handle, or is not shared with the |
|
2133 current context |
|
2134 VG_IMAGE_IN_USE_ERROR |
|
2135 if either dst or src is currently a rendering target |
|
2136 VG_ILLEGAL_ARGUMENT_ERROR |
|
2137 if src and dst overlap |
|
2138 if stdDeviationX or stdDeviationY is less than or equal to 0 or greater |
|
2139 than VG_MAX_GAUSSIAN_STD_DEVIATION |
|
2140 if tilingMode is not one of the values from the VGTilingMode |
|
2141 enumeration |
|
2142 */ |
|
2143 EXPORT_C void |
|
2144 vgGaussianBlur(VGImage dst, VGImage src, |
|
2145 VGfloat stdDeviationX, |
|
2146 VGfloat stdDeviationY, |
|
2147 VGTilingMode tilingMode) |
|
2148 { |
|
2149 OPENVG_TRACE("vgGaussianBlur dst=0x%x, src=0x%x, stdDeviationX=%f, stdDeviationY=%f, tilingMode=%d", |
|
2150 dst, src, stdDeviationX, stdDeviationY, tilingMode); |
|
2151 |
|
2152 TGuestOpenVg::vgGaussianBlur(dst, src, stdDeviationX, stdDeviationY, tilingMode); |
|
2153 } |
|
2154 |
|
2155 /* |
|
2156 Passes each image channel of the normalized source image src through a separate lookup |
|
2157 table. |
|
2158 |
|
2159 Each channel of the normalized source pixel is used as an index into the lookup table for |
|
2160 that channel by multiplying the normalized value by 255 and rounding to obtain an 8-bit |
|
2161 integral value. Each LUT parameter should contain 256 VGubyte entries. The |
|
2162 outputs of the lookup tables are concatenated to form an RGBA_8888 pixel |
|
2163 value, which is interpreted as lRGBA_8888, lRGBA_8888_PRE, sRGBA_8888, |
|
2164 or sRGBA_8888_PRE, depending on the values of outputLinear and outputPremultiplied. |
|
2165 |
|
2166 The resulting pixels are converted into the destination format using the normal |
|
2167 pixel format conversion rules. |
|
2168 |
|
2169 ERRORS |
|
2170 VG_BAD_HANDLE_ERROR |
|
2171 if either dst or src is not a valid image handle, or is not shared with the |
|
2172 current context |
|
2173 VG_IMAGE_IN_USE_ERROR |
|
2174 if either dst or src is currently a rendering target |
|
2175 VG_ILLEGAL_ARGUMENT_ERROR |
|
2176 if src and dst overlap |
|
2177 if any pointer parameter is NULL |
|
2178 */ |
|
2179 EXPORT_C void |
|
2180 vgLookup(VGImage dst, VGImage src, |
|
2181 const VGubyte * redLUT, |
|
2182 const VGubyte * greenLUT, |
|
2183 const VGubyte * blueLUT, |
|
2184 const VGubyte * alphaLUT, |
|
2185 VGboolean outputLinear, |
|
2186 VGboolean outputPremultiplied) |
|
2187 { |
|
2188 OPENVG_TRACE("vgLookup dst=0x%x, src=0x%x, redLUT=0x%x, greenLUT=0x%x, blueLUT=0x%x, alphaLUT=0x%x, opLin=%d, opPremul=%d", |
|
2189 dst, src, redLUT, greenLUT, blueLUT, alphaLUT, outputLinear, outputPremultiplied); |
|
2190 |
|
2191 TGuestOpenVg::vgLookup(dst, src, redLUT, greenLUT, blueLUT, alphaLUT, outputLinear, outputPremultiplied); |
|
2192 } |
|
2193 |
|
2194 /* |
|
2195 Passes a single image channel of the normalized source image src, selected by the |
|
2196 sourceChannel parameter, through a combined lookup table that produces whole pixel |
|
2197 values. Each normalized source channel value is multiplied by 255 and rounded to |
|
2198 obtain an 8 bit integral value. |
|
2199 |
|
2200 ERRORS |
|
2201 VG_BAD_HANDLE_ERROR |
|
2202 if either dst or src is not a valid image handle, or is not shared with the |
|
2203 current context |
|
2204 VG_IMAGE_IN_USE_ERROR |
|
2205 if either dst or src is currently a rendering target |
|
2206 VG_ILLEGAL_ARGUMENT_ERROR |
|
2207 if src and dst overlap |
|
2208 if src is in an RGB pixel format and sourceChannel is not one of VG_RED, |
|
2209 VG_GREEN, VG_BLUE or VG_ALPHA from the VGImageChannel enumeration |
|
2210 if lookupTable is NULL |
|
2211 if lookupTable is not properly aligned |
|
2212 */ |
|
2213 EXPORT_C void |
|
2214 vgLookupSingle(VGImage dst, VGImage src, |
|
2215 const VGuint * lookupTable, |
|
2216 VGImageChannel sourceChannel, |
|
2217 VGboolean outputLinear, |
|
2218 VGboolean outputPremultiplied) |
|
2219 { |
|
2220 OPENVG_TRACE("vgLookupSingle dst=0x%x, src=0x%x, lookupTable=0x%x, sourceChannel=0x%x, opLin=%d, opPremul=%d", |
|
2221 dst, src, lookupTable, sourceChannel, outputLinear, outputPremultiplied); |
|
2222 |
|
2223 TGuestOpenVg::vgLookupSingle(dst, src, lookupTable, sourceChannel, outputLinear, outputPremultiplied); |
|
2224 } |
|
2225 |
|
2226 // guest support for OpenVG extension #4, KHR_EGL_image - vgCreateEGLImageTargetKHR(VGeglImageKHR image) |
|
2227 /* |
|
2228 Creates an EGLImage target VGImage object from the provided EGLImage |
|
2229 <image>. <image> should be of type EGLImageKHR, cast into the type |
|
2230 VGeglImageKHR. Assuming no errors are generated in this function, |
|
2231 the resulting VGImage will be an EGLImage target of the specified |
|
2232 EGLImage <image>. As a side-effect of the referencing operation, |
|
2233 all of the pixel data in the <buffer> used as the EGLImage source |
|
2234 resource (i.e., the <buffer> parameter passed to the CreateImageKHR |
|
2235 command that returned <image>) will become undefined. |
|
2236 |
|
2237 ERRORS |
|
2238 VG_UNSUPPORTED_IMAGE_FORMAT_ERROR |
|
2239 - if the OpenVG implementation is not able to create a VGImage |
|
2240 compatible with the provided VGeglImageKHR for an implementation- |
|
2241 dependent reason (this could be caused by, but not limited to, |
|
2242 reasons such as unsupported pixel formats, anti-aliasing quality, |
|
2243 etc.). |
|
2244 |
|
2245 VG_ILLEGAL_ARGUMENT_ERROR |
|
2246 - if <image> is not a valid VGeglImageKHR. |
|
2247 */ |
|
2248 VGImage vgCreateEGLImageTargetKHR(VGeglImageKHR image) |
|
2249 { |
|
2250 OPENVG_TRACE("vgCreateEGLImageTargetKHR image=0x%x -->", image); |
|
2251 |
|
2252 VGImage imageHandle = TGuestOpenVg::vgCreateEGLImageTargetKHR(image); |
|
2253 OPENVG_TRACE("vgCreateEGLImageTargetKHR imageHandle=0x%x <--", imageHandle); |
|
2254 return imageHandle; |
|
2255 } |
|
2256 |
|
2257 |
|
2258 } /* extern "C" */ |
|
2259 |
|
2260 // end of file openvg.cpp |