From: Flightgear-commitlogs <ma...@hy...> - 2012-10-25 00:04:22
|
The branch, next has been updated - Log ----------------------------------------------------------------- commit d0ae09c7e2e13d289ca820c3fb3775aa1ba5bc87 Author: Thomas Geymayer Date: Thu Oct 25 01:00:37 2012 +0200 Link with ShivaVG commit a25bd0613858cc0824276200525dc36c11187add Author: Thomas Geymayer Date: Fri Sep 21 22:03:44 2012 +0200 ShivaVG: Support for pseudo non-zero fillrule commit 1b5507689732889c84332525a9e58894f6170d37 Author: James Turner Date: Wed Sep 19 15:55:49 2012 +0100 Fix a Clang warning in Shiva. commit 5eac7974c90910f6bfac445847817865b122051d Author: Thomas Geymayer Date: Tue Jul 3 15:48:11 2012 +0200 Add missing glx.h include and fix some warnings. commit 3afd6e9f516dd3b62e58893230d3d163bccb980f Author: James Turner Date: Sun Jun 17 21:12:47 2012 +0100 Fix OS-X compilation. commit 05c107ba9c35772772edcfc5a843448583aedc71 Author: Thomas Geymayer Date: Thu Jun 7 00:11:10 2012 +0200 Allow filling paths and do some clean up/fixing. commit 99b00daf87e551b48495dafb0860aa81af5e75d2 Author: Thomas Geymayer Date: Wed Jun 6 11:32:02 2012 +0200 Add ShivaVG sources - Summary ------------------------------------------------------------- simgear/CMakeLists.txt | 1 + simgear/canvas/CMakeLists.txt | 2 + simgear/canvas/ShivaVG/AUTHORS | 12 + COPYING => simgear/canvas/ShivaVG/COPYING | 217 +++-- simgear/canvas/ShivaVG/ChangeLog | 67 ++ simgear/canvas/ShivaVG/MYTODO | 80 ++ simgear/canvas/ShivaVG/NEWS | 38 + simgear/canvas/ShivaVG/README | 252 +++++ simgear/canvas/ShivaVG/TODO | 42 + simgear/canvas/ShivaVG/include/vg/openvg.h | 632 +++++++++++++ simgear/canvas/ShivaVG/include/vg/vgu.h | 104 +++ simgear/canvas/ShivaVG/src/CMakeLists.txt | 48 + simgear/canvas/ShivaVG/src/shArrayBase.h | 370 ++++++++ simgear/canvas/ShivaVG/src/shArrays.c | 50 + simgear/canvas/ShivaVG/src/shArrays.h | 55 ++ simgear/canvas/ShivaVG/src/shConfig.h | 41 + simgear/canvas/ShivaVG/src/shContext.c | 493 ++++++++++ simgear/canvas/ShivaVG/src/shContext.h | 169 ++++ simgear/canvas/ShivaVG/src/shDefs.h | 179 ++++ simgear/canvas/ShivaVG/src/shExtensions.c | 131 +++ simgear/canvas/ShivaVG/src/shExtensions.h | 64 ++ simgear/canvas/ShivaVG/src/shGeometry.c | 936 +++++++++++++++++++ simgear/canvas/ShivaVG/src/shGeometry.h | 33 + simgear/canvas/ShivaVG/src/shImage.c | 1238 ++++++++++++++++++++++++ simgear/canvas/ShivaVG/src/shImage.h | 154 +++ simgear/canvas/ShivaVG/src/shPaint.c | 789 ++++++++++++++++ simgear/canvas/ShivaVG/src/shPaint.h | 82 ++ simgear/canvas/ShivaVG/src/shParams.c | 1402 ++++++++++++++++++++++++++++ simgear/canvas/ShivaVG/src/shPath.c | 1304 ++++++++++++++++++++++++++ simgear/canvas/ShivaVG/src/shPath.h | 142 +++ simgear/canvas/ShivaVG/src/shPipeline.c | 595 ++++++++++++ simgear/canvas/ShivaVG/src/shVectors.c | 135 +++ simgear/canvas/ShivaVG/src/shVectors.h | 275 ++++++ simgear/canvas/ShivaVG/src/shVgu.c | 425 +++++++++ 34 files changed, 10460 insertions(+), 97 deletions(-) create mode 100644 simgear/canvas/ShivaVG/AUTHORS copy COPYING => simgear/canvas/ShivaVG/COPYING (74%) create mode 100644 simgear/canvas/ShivaVG/ChangeLog create mode 100644 simgear/canvas/ShivaVG/MYTODO create mode 100644 simgear/canvas/ShivaVG/NEWS create mode 100644 simgear/canvas/ShivaVG/README create mode 100644 simgear/canvas/ShivaVG/TODO create mode 100644 simgear/canvas/ShivaVG/include/vg/openvg.h create mode 100644 simgear/canvas/ShivaVG/include/vg/vgu.h create mode 100644 simgear/canvas/ShivaVG/src/CMakeLists.txt create mode 100644 simgear/canvas/ShivaVG/src/shArrayBase.h create mode 100644 simgear/canvas/ShivaVG/src/shArrays.c create mode 100644 simgear/canvas/ShivaVG/src/shArrays.h create mode 100644 simgear/canvas/ShivaVG/src/shConfig.h create mode 100644 simgear/canvas/ShivaVG/src/shContext.c create mode 100644 simgear/canvas/ShivaVG/src/shContext.h create mode 100644 simgear/canvas/ShivaVG/src/shDefs.h create mode 100644 simgear/canvas/ShivaVG/src/shExtensions.c create mode 100644 simgear/canvas/ShivaVG/src/shExtensions.h create mode 100644 simgear/canvas/ShivaVG/src/shGeometry.c create mode 100644 simgear/canvas/ShivaVG/src/shGeometry.h create mode 100644 simgear/canvas/ShivaVG/src/shImage.c create mode 100644 simgear/canvas/ShivaVG/src/shImage.h create mode 100644 simgear/canvas/ShivaVG/src/shPaint.c create mode 100644 simgear/canvas/ShivaVG/src/shPaint.h create mode 100644 simgear/canvas/ShivaVG/src/shParams.c create mode 100644 simgear/canvas/ShivaVG/src/shPath.c create mode 100644 simgear/canvas/ShivaVG/src/shPath.h create mode 100644 simgear/canvas/ShivaVG/src/shPipeline.c create mode 100644 simgear/canvas/ShivaVG/src/shVectors.c create mode 100644 simgear/canvas/ShivaVG/src/shVectors.h create mode 100644 simgear/canvas/ShivaVG/src/shVgu.c - Diff ---------------------------------------------------------------- diff --git a/simgear/CMakeLists.txt b/simgear/CMakeLists.txt index fd83c89..d505998 100644 --- a/simgear/CMakeLists.txt +++ b/simgear/CMakeLists.txt @@ -79,6 +79,7 @@ if(SIMGEAR_SHARED) target_link_libraries(SimGearScene SimGearCore + ShivaVG ${ZLIB_LIBRARY} ${OPENSCENEGRAPH_LIBRARIES} ${OPENAL_LIBRARY} diff --git a/simgear/canvas/CMakeLists.txt b/simgear/canvas/CMakeLists.txt index 430c482..dac03ab 100644 --- a/simgear/canvas/CMakeLists.txt +++ b/simgear/canvas/CMakeLists.txt @@ -8,4 +8,6 @@ set(SOURCES ODGauge.cxx ) +add_subdirectory(ShivaVG/src) + simgear_scene_component(canvas canvas "${SOURCES}" "${HEADERS}") diff --git a/simgear/canvas/ShivaVG/AUTHORS b/simgear/canvas/ShivaVG/AUTHORS new file mode 100644 index 0000000..cbb9163 --- /dev/null +++ b/simgear/canvas/ShivaVG/AUTHORS @@ -0,0 +1,12 @@ +=============================================================================== +ShivaVG - an open-source LGPL ANSI C implementation of the OpenVG specification +=============================================================================== + +Lead developer: + + Ivan Leben <iva...@gm...> + +Occasional patches: + + Daniel Turing + Vincenzo Pupillo diff --git a/COPYING b/simgear/canvas/ShivaVG/COPYING similarity index 74% copy from COPYING copy to simgear/canvas/ShivaVG/COPYING index c167b1f..1837b0a 100644 --- a/COPYING +++ b/simgear/canvas/ShivaVG/COPYING @@ -1,112 +1,125 @@ - GNU LIBRARY GENERAL PUBLIC LICENSE - Version 2, June 1991 + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 - Copyright (C) 1991 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. -[This is the first released version of the library GPL. It is - numbered 2 because it goes with version 2 of the ordinary GPL.] +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] - Preamble + Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. - This license, the Library General Public License, applies to some -specially designated Free Software Foundation software, and to any -other libraries whose authors decide to use it. You can use it for -your libraries, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if -you distribute copies of the library, or if you modify it. +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source -code. If you link a program with the library, you must provide -complete object files to the recipients so that they can relink them -with the library, after making changes to the library and recompiling +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. - Our method of protecting your rights has two steps: (1) copyright -the library, and (2) offer you this license which gives you legal + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. - Also, for each distributor's protection, we want to make certain -that everyone understands that there is no warranty for this free -library. If the library is modified by someone else and passed on, we -want its recipients to know that what they have is not the original -version, so that any problems introduced by others will not reflect on -the original authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that companies distributing free -software will individually obtain patent licenses, thus in effect -transforming the program into proprietary software. To prevent this, -we have made it clear that any patent must be licensed for everyone's -free use or not licensed at all. - - Most GNU software, including some libraries, is covered by the ordinary -GNU General Public License, which was designed for utility programs. This -license, the GNU Library General Public License, applies to certain -designated libraries. This license is quite different from the ordinary -one; be sure to read it in full, and don't assume that anything in it is -the same as in the ordinary license. - - The reason we have a separate public license for some libraries is that -they blur the distinction we usually make between modifying or adding to a -program and simply using it. Linking a program with a library, without -changing the library, is in some sense simply using the library, and is -analogous to running a utility program or application program. However, in -a textual and legal sense, the linked executable is a combined work, a -derivative of the original library, and the ordinary General Public License -treats it as such. - - Because of this blurred distinction, using the ordinary General -Public License for libraries did not effectively promote software -sharing, because most developers did not use the libraries. We -concluded that weaker conditions might promote sharing better. - - However, unrestricted linking of non-free programs would deprive the -users of those programs of all benefit from the free status of the -libraries themselves. This Library General Public License is intended to -permit developers of non-free programs to use free libraries, while -preserving your freedom as a user of such programs to change the free -libraries that are incorporated in them. (We have not seen how to achieve -this as regards changes in header files, but we have achieved it as regards -changes in the actual functions of the Library.) The hope is that this -will lead to faster development of free libraries. + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The -former contains code derived from the library, while the latter only -works together with the library. - - Note that it is possible for a library to be covered by the ordinary -General Public License rather than by this special one. +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. - GNU LIBRARY GENERAL PUBLIC LICENSE + GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - 0. This License Agreement applies to any software library which -contains a notice placed by the copyright holder or other authorized -party saying it may be distributed under the terms of this Library -General Public License (also called "this License"). Each licensee is -addressed as "you". + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs @@ -255,7 +268,7 @@ distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. - 6. As an exception to the Sections above, you may also compile or + 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit @@ -282,23 +295,31 @@ of these things: Library will not necessarily be able to recompile the application to use the modified definitions.) - b) Accompany the work with a written offer, valid for at + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. - c) If distribution of the work is made by offering access to copy + d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. - d) Verify that the user has already received a copy of these + e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, -the source code distributed need not include anything that is normally -distributed (in either source or binary form) with the major +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. @@ -347,7 +368,7 @@ Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to +You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent @@ -390,7 +411,7 @@ excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new -versions of the Library General Public License from time to time. +versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. @@ -411,7 +432,7 @@ decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. @@ -434,7 +455,7 @@ FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS + END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries @@ -453,18 +474,18 @@ convey the exclusion of warranty; and each file should have at least the Copyright (C) <year> <name of author> This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public + modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. + version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. @@ -479,3 +500,5 @@ necessary. Here is a sample; alter the names: Ty Coon, President of Vice That's all there is to it! + + diff --git a/simgear/canvas/ShivaVG/ChangeLog b/simgear/canvas/ShivaVG/ChangeLog new file mode 100644 index 0000000..1541e46 --- /dev/null +++ b/simgear/canvas/ShivaVG/ChangeLog @@ -0,0 +1,67 @@ +04 Feb 2008 Ivan Leben <iva...@gm...> + + * shImage.c: shCopyPixels uses memcpy when formats are + equal. + +04 Feb 2008 Ivan Leben <iva...@gm...> + + * openvg.h: changed typedef of VGHandle to void*. Code + compiles with no warnings on 64-bit systems now and + it's much safer anyway. + +03 Feb 2008 Ivan Leben <iva...@gm...> + + * shContest.c: fixed a bug in SHContext destructor where + resource deletion loop was iterating image array while + freeing paint objects + +03 Feb 2008 Ivan Leben <iva...@gm...> + + * a patch by Vincenzo Pupillo fixes array constructor behavior + when it runs out of memory plus makes its destructor a bit + more robust + +03 Feb 2008 Ivan Leben <iva...@gm...> + + * autogen.sh: added --force to autoreconf call + +03 Feb 2008 Ivan Leben <iva...@gm...> + + * Removed automake/autoconf generated files. Added autogen.sh + to generate them. + +03 Feb 2008 Ivan Leben <iva...@gm...> + + * configure.in: changed order of checks for glut library and + glXGetProcAddress in -lGL so that latter doesn't fail when + glut is not installed. + +30 Jan 2008 Ivan Leben <iva...@gm...> + + * shGeometry.c: shStrokePath() fixed to handle zero-length line + segments gracefully + + * fixed the image color component ordering to be valid against the + spec + + * shImage.c, shImage.h: completely overhauled to support multiple + image formats. Everything but _PRE and _BW_1 now supported. + +24 Jan 2008 Ivan Leben <iva...@gm...> + + * Moved release-related info from ChangeLog to NEWS. ChangeLog will + now include info regarding each commit to repository + + * Rearranged the path tesselletaion and user-to-surface transformation + steps in the pipeline to produce higher curve resolution when path is + scaled up + + * Using new pipeline design, transformed bound-box query can now return + really tight bounds + + * Inserted empty/nop definitions for all non-implemented function so + that linking against the library doesn't fail. + +22 Jan 2008 Ivan Leben <iva...@gm...> + + * Fixed a bug where vgGetError would always return VG_NO_ERROR diff --git a/simgear/canvas/ShivaVG/MYTODO b/simgear/canvas/ShivaVG/MYTODO new file mode 100644 index 0000000..a0d2211 --- /dev/null +++ b/simgear/canvas/ShivaVG/MYTODO @@ -0,0 +1,80 @@ +shIsValid* functions do a search through array!!! +That is required because user handles are actually pointers and need to be found in the valid path array. Solution would be to use indices into an array of pointers for internal handle-to-pointer conversion. When a path is deleted, an empty space would be left in the array and used when the next path is created. + +How to speed up image upload / manipulation +============================================= + +1) shCopyPixels uses memcpy + +First, manipulation can be speeded up by modifying shCopyPixels +to copy lines using memcpy directly when source and target +formats are equal. If stride is same too, than we can memcpy +the whole block of memory. + +2) What about mapping image manipulation directly to OpenGL +texture manipulation calls? Which formats could support this? + +PROBLEM: if NOPS textures are not supported, then writing +and reading the image data back results in a precision loss! +Even if PBO available we'd need to gluScaleImage into it. + +--> means: no NOPS, need intermediate buffer anyway + +=== Solution1: PBO are available ==== + +Extension required: EXT_pixel_buffer_object (ARB_pixel_buffer_object ?) + +Complexity of implementation: really easy - PBO simply +replaces the buffer that would be used if NOPS were not there + +Cannot just glBindBuffer(GL_PIXEL_UNPACK_BUFFER) and then +glReadPixels into client memory, because glPixelStore +doesn't allow for random row byte size ("stride" must be +a multiple of pixel byte size). + +We can safely glMapBuffer and copy from it whatever we want +however we want, and do any kind of conversion inbetween. +Is glMapBuffer + memcpy into user memory faster than just +glGetTexImage? Probably yes, since glGetTexImage probably +first downloads the data from GPU anyway. + +glMapBuffer better anyway, because we can directly do the format +conversions unsupported by OpenGL (premultiplied to unpremultiplied, +grayscale conversion with different per component coefficients +instead of simple averaging etc.). We use all the exact same code +as when NOPS not supported. + + +=== Solution2: no PBOs === + +- vgImageSubData => glTexSubImage2D +- vgGetImageSubData => glGetTexImage +- vgCopyImage => glGetTexImage, glTexSubImage2D +- vgSetPixels => glGetTexImage, glDrawPixels + + (PROBLEM: for glGetTexImage, row length in glPixelStore must + be a multiple of pixel byte size!) + +- when copying pixels to/from the texture, we still need to + manually clip the working pixel region to the intersection + of the source and destination rectangles, since opengl spec + says INVALID_VALUE error is generated for invalid regions + (e.g. dstX + copyW > dstW) + + +How to solve great slow-down when scaled up? +============================================= + +Reasons: +- cpu is subdividing a loooong path +- fill-rate is a bad thing + +1. By writing gradient shaders, there would be no need to +draw into stencil first and then fill the whole area where stencil +odd - at least not when drawing stroke (optimizes half of the pipeline) + +2. Real tesselation would reduce fill rate for filled paths, but does +the CPU bottleneck outweight the gain? + +3. Early path discarding (transformed bounds outside surface? maybe +early convex-hull rule removal?) diff --git a/simgear/canvas/ShivaVG/NEWS b/simgear/canvas/ShivaVG/NEWS new file mode 100644 index 0000000..4ae5984 --- /dev/null +++ b/simgear/canvas/ShivaVG/NEWS @@ -0,0 +1,38 @@ +version 0.2.0 to 0.2.1 (20 Mar 2009): + * Implemented scissoring for 1 scissor rectangle + +version 0.2.0 (20 Jan 2008): + * Fixed a bug where rotation in the paint-to-user matrix broke radial + gradient fill. + + * vgCreateContextSH interface changed to allow for specification of + surface width and height + + * new extension: vgResizeSurfaceSH to be called whenever the surface + needs to be resized to match the new window size + + * #define GL_GLEXT_LEGACY in shExtensions.h prior to including gl.h + so it doesn't include glext.h automatically, which enables us to + check for OpenGL version and define OpenGL extension functions + manually. + + * Optimized image uploading by replacing the call to gluBuild2DMipmaps + with glTexImage2D and changing the filter used to GL_LINEAR + + * Added detection of ARB_texture_non_power_of_two extension to upload + rectangular images directly instead of scaling them and loosing + precision + + * Pattern paint implemented + + * Include folder changed to "vg" (lowercase) + + * Added a message to test_blend program to notify the user that it + has not been implemented yet (black screen is therefore fine) + + * All the calls to glLoadMatrix replaced with glPushMatrix, + glMultMatrix, glPopMatrix. + + * Replaced images used in example programs for royalty-free + + * README file written diff --git a/simgear/canvas/ShivaVG/README b/simgear/canvas/ShivaVG/README new file mode 100644 index 0000000..8853e9b --- /dev/null +++ b/simgear/canvas/ShivaVG/README @@ -0,0 +1,252 @@ +ShivaVG +============================= + +See AUTHORS for the list of contributors + +ShivaVG is an open-source LGPL ANSI C implementation of the Khronos +Group OpenVG specification. + +I. BUILD +II. TESTING +III. IMPLEMENTATION STATUS +IV. EXTENSIONS + + +I. BUILD +============================= + + * Prerequisites: + + OpenGL development libraries and headers should be installed. + Othe than that, since it's ANSI C should compile with any modern + C compiler. jpeglib needs to be installed for example programs + that use images. + + * Compiling under UNIX systems: + + Read the INSTALL file for more detailed (though generic) directions. + This library uses the standard ./configure ; make. The example + programs are automatically compiled. However, compilation of each + example program can be toggled by ./configure --with-example-xxx + command where xxx denotes the name of the example. Run ./configure + --help for a list of such options. + + * Compiling on Mac: + + No XCode project files provided yet. The easiest way is by just + using gcc, in which case look under UNIX compiling section. + + * Compiling natively on Windows platform: + + Solution files are provided for Visual C++ version 7 and 8. For + the example programs using images to compile, you will need the + appropriate build of jpeglib to match your Visual C++ version. + + * Compiling in mingw / cygwin environment: + + Might work just as fine as any UNIX-flavored system, but hasn't + been tested yet. + + +II. TESTING +============================= + +There is no real testing suite yet. The example programs are there +just to play with what the implementation can currently do, but +can hardly provide any proper validation, since no reference images +are provided. Here is a description of each example program and +what features it highlights: + +* test_vgu + + Constructs some path primitives using the VGU API. + +* test_tiger + + The most simple performance test. It draws the well known svg + tiger using just simple stroke and fill of solid colors. It + consists of 240 paths. + +* test_dash + + Shows different stroke dashing modes. + +* test_linear + + A rectangle drawn using 3-color linear gradient fill paint + +* test_radial + + A rectangle drawn using 3-color radial gradient fill paint + +* test_interpolate + + Interpolates between two paths - an apple and a pear. + +* test_image + + Images are drawn using VG_DRAW_IMAGE_MULTIPLY image mode to be + multiplied with radial gradient fill paint. + +* test_pattern + + An image is drawn in multiply mode with an image pattern fill + paint. + + +III. IMPLEMENTATION STATUS +============================= + +Khronos states in the OpenVG specification, that the contexts for all +their client APIs are expected to be created via the EGL API. Since +EGL to use with ShivaVG has not been implemented yet, there is a set +of extension functions provided for the task of creating, maintaining +and destroying the OpenVG context. (See next section EXTENSIONS for +details.) + +What follows is a description of which functions or to what extent +a certain function has been implemented. When a function is marked +as PARTIALLY implemented, the TODO file or the comments in the code +itself would provide further clues. + + +* General: + +vgGetError ............................ FULLY implemented +vgFlush ............................... FULLY implemented +vgFinish .............................. FULLY implemented + +* Getters and setters: + +vgSet ................................. FULLY implemented +vgSeti ................................ FULLY implemented +vgSetfv ............................... FULLY implemented +vgSetiv ............................... FULLY implemented +vgGetf ................................ FULLY implemented +vgGeti ................................ FULLY implemented +vgGetVectorSize ....................... FULLY implemented +vgGetfv ............................... FULLY implemented +vgGetiv ............................... FULLY implemented +vgSetParameterf ....................... FULLY implemented +vgSetParameteri ....................... FULLY implemented +vgSetParameterfv ...................... FULLY implemented +vgSetParameteriv ...................... FULLY implemented +vgGetParameterf ....................... FULLY implemented +vgGetParameteri ....................... FULLY implemented +vgGetParameterVectorSize............... FULLY implemented +vgGetParameterfv ...................... FULLY implemented +vgGetParameteriv ...................... FULLY implemented + +* Matrix Manipulation: + +vgLoadIdentity ........................ FULLY implemented +vgLoadMatrix .......................... FULLY implemented +vgGetMatrix ........................... FULLY implemented +vgMultMatrix .......................... FULLY implemented +vgTranslate ........................... FULLY implemented +vgScale ............................... FULLY implemented +vgShear ............................... FULLY implemented +vgRotate .............................. FULLY implemented + +* Masking and Clearing: + +vgMask ................................ NOT implemented +vgClear ............................... FULLY implemented + +* Paths: + +vgCreatePath .......................... FULLY implemented +vgClearPath ........................... FULLY implemented +vgDestroyPath ......................... FULLY implemented +vgRemovePathCapabilities .............. FULLY implemented +vgGetPathCapabilities ................. FULLY implemented +vgAppendPath .......................... FULLY implemented +vgAppendPathData ...................... FULLY implemented +vgModifyPathCoords .................... FULLY implemented +vgTransformPath ....................... FULLY implemented +vgInterpolatePath ..................... FULLY implemented +vgPathLength .......................... NOT implemented +vgPointAlongPath ...................... NOT implemented +vgPathBounds .......................... FULLY implemented +vgPathTransformedBounds ............... FULLY implemented +vgDrawPath ............................ PARTIALLY implemented + +* Paint: + +vgCreatePaint ......................... FULLY implemented +vgDestroyPaint ........................ FULLY implemented +vgSetPaint ............................ FULLY implemented +vgGetPaint ............................ FULLY implemented +vgSetColor ............................ FULLY implemented +vgGetColor ............................ FULLY implemented +vgPaintPattern ........................ FULLY implemented + +* Images: + +vgCreateImage ......................... PARTIALLY implemented +vgDestroyImage ........................ FULLY implemented +vgClearImage .......................... FULLY implemented +vgImageSubData ........................ PARTIALLY implemented +vgGetImageSubData ..................... PARTIALLY implemented +vgChildImage .......................... NOT implemented +vgGetParent ........................... NOT implemented +vgCopyImage ........................... FULLY implemented +vgDrawImage ........................... PARTIALLY implemented +vgSetPixels ........................... FULLY implemented +vgWritePixels ......................... FULLY implemented +vgGetPixels ........................... FULLY implemented +vgReadPixels .......................... FULLY implemented +vgCopyPixels .......................... FULLY implemented + +* Image Filters: + +vgColorMatrix ......................... NOT implemented +vgConvolve ............................ NOT implemented +vgSeparableConvolve ................... NOT implemented +vgGaussianBlur ........................ NOT implemented +vgLookup .............................. NOT implemented +vgLookupSingle ........................ NOT implemented + +* Hardware Queries: + +vgHardwareQuery ....................... NOT implemented + +* Renderer and Extension Information: + +vgGetString ........................... FULLY implemented + +* VGU + +vguLine ............................... FULLY implemented +vguPolygon ............................ FULLY implemented +vguRect ............................... FULLY implemented +vguRoundRect .......................... FULLY implemented +vguEllipse ............................ FULLY implemented +vguArc ................................ FULLY implemented +vguComputeWarpQuadToSquare ............ NOT implemented +vguComputeWarpSquareToQuad ............ NOT implemented +vguComputeWarpQuadToQuad .............. NOT implemented + + +IV. EXTENSIONS +============================= + +There are three extensions to the API that manipulate the OpenVG +context as a temporary replacement for EGL: + +VGboolean vgCreateContextSH(VGint width, VGint height) + + Creates an OpenVG context on top of an existing OpenGL context + that should have been manually initialized by the user of the + library. Width and height specify the size of the rendering + surface. No multi-threading support has been implemented yet. + The context is created once per process. + +void vgResizeSurfaceSH(VGint width, VGint height) + + Should be called whenever the size of the surface changes (e.g. + the owner window of the OpenGL context is resized). + +void vgDestroyContextSH() + + Destroys the OpenVG context associated with the calling process. diff --git a/simgear/canvas/ShivaVG/TODO b/simgear/canvas/ShivaVG/TODO new file mode 100644 index 0000000..1cda778 --- /dev/null +++ b/simgear/canvas/ShivaVG/TODO @@ -0,0 +1,42 @@ +---------- +Known bugs +---------- + +- outofmemory in arrays silently ignored +- blending doesn't use premultiplied colors (not porter-duff model) +- gradient color ramp is not interpolated in linear space +- linear and non-linear image formats behave both linearly +- radial gradient circle has got a fixed step instead of + proportional to its radius + +------------------------- +Incomplete functionality: +------------------------- + +- non-zero fill mode +- proper porter-duff blending +- masking +- scissoring +- child images +- VG_DRAW_IMAGE_STENCIL +- _PRE and BW_1 image formats +- VGU warp matrices +- EGL (image drawing targets) +- boundbox / point-on-path / tangent-on-path queries +- RENDERING_QUALITY_FASTER == RENDERING_QUALITY_BETTER + +--------------------------- +Possible portability issues +--------------------------- + +- GL_UNSIGNED_INT_8_8_8_8 and other for images +- GL_MIRRORED_REPEAT for gradients +- GL_CLAMP_TO_EDGE for gradients and pattern paints +- GL_CLAMP_TO_BORDER for pattern paints +- multitexturing for VG_DRAW_IMAGE_MULTIPLY, VG_DRAW_IMAGE_STENCIL + +------ +Bonus: +------ + +- gradient shaders? antialiasing shader? diff --git a/simgear/canvas/ShivaVG/include/vg/openvg.h b/simgear/canvas/ShivaVG/include/vg/openvg.h new file mode 100644 index 0000000..795d66e --- /dev/null +++ b/simgear/canvas/ShivaVG/include/vg/openvg.h @@ -0,0 +1,632 @@ +/* + * Copyright (c) 2007 Ivan Leben + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library in the file COPYING; + * if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef _OPENVG_H +#define _OPENVG_H + +#define OPENVG_VERSION_1_0_1 1 + +/* Type definitions */ +/* TODO: we can't use config.h in this header so there + must be some other technique to assert the proper + size of the basic types */ + +typedef float VGfloat; +typedef char VGbyte; +typedef unsigned char VGubyte; +typedef short VGshort; +typedef int VGint; +typedef unsigned int VGuint; +typedef unsigned int VGbitfield; + +typedef enum { + VG_FALSE = 0, + VG_TRUE = 1 +} VGboolean; + +#define VG_MAXSHORT ((VGshort)((~((unsigned)0)) >> 1)) +#define VG_MAXINT ((VGint)((~((unsigned)0)) >> 1)) + +/* Define handle to be of same length as any pointer */ + +typedef void * VGHandle; +#define VG_INVALID_HANDLE ((VGHandle)NULL) + +/* Enumerations */ + +typedef enum { + VG_NO_ERROR = 0, + VG_BAD_HANDLE_ERROR = 0x1000, + VG_ILLEGAL_ARGUMENT_ERROR = 0x1001, + VG_OUT_OF_MEMORY_ERROR = 0x1002, + VG_PATH_CAPABILITY_ERROR = 0x1003, + VG_UNSUPPORTED_IMAGE_FORMAT_ERROR = 0x1004, + VG_UNSUPPORTED_PATH_FORMAT_ERROR = 0x1005, + VG_IMAGE_IN_USE_ERROR = 0x1006, + VG_NO_CONTEXT_ERROR = 0x1007 +} VGErrorCode; + +typedef enum { + /* Mode settings */ + VG_MATRIX_MODE = 0x1100, + VG_FILL_RULE = 0x1101, + VG_IMAGE_QUALITY = 0x1102, + VG_RENDERING_QUALITY = 0x1103, + VG_BLEND_MODE = 0x1104, + VG_IMAGE_MODE = 0x1105, + + /* Scissoring rectangles */ + VG_SCISSOR_RECTS = 0x1106, + + /* Stroke parameters */ + VG_STROKE_LINE_WIDTH = 0x1110, + VG_STROKE_CAP_STYLE = 0x1111, + VG_STROKE_JOIN_STYLE = 0x1112, + VG_STROKE_MITER_LIMIT = 0x1113, + VG_STROKE_DASH_PATTERN = 0x1114, + VG_STROKE_DASH_PHASE = 0x1115, + VG_STROKE_DASH_PHASE_RESET = 0x1116, + + /* Edge fill color for VG_TILE_FILL tiling mode */ + VG_TILE_FILL_COLOR = 0x1120, + + /* Color for vgClear */ + VG_CLEAR_COLOR = 0x1121, + + /* Enable/disable alpha masking and scissoring */ + VG_MASKING = 0x1130, + VG_SCISSORING = 0x1131, + + /* Pixel layout information */ + VG_PIXEL_LAYOUT = 0x1140, + VG_SCREEN_LAYOUT = 0x1141, + + /* Source format selection for image filters */ + VG_FILTER_FORMAT_LINEAR = 0x1150, + VG_FILTER_FORMAT_PREMULTIPLIED = 0x1151, + + /* Destination write enable mask for image filters */ + VG_FILTER_CHANNEL_MASK = 0x1152, + + /* Implementation limits (read-only) */ + VG_MAX_SCISSOR_RECTS = 0x1160, + VG_MAX_DASH_COUNT = 0x1161, + VG_MAX_KERNEL_SIZE = 0x1162, + VG_MAX_SEPARABLE_KERNEL_SIZE = 0x1163, + VG_MAX_COLOR_RAMP_STOPS = 0x1164, + VG_MAX_IMAGE_WIDTH = 0x1165, + VG_MAX_IMAGE_HEIGHT = 0x1166, + VG_MAX_IMAGE_PIXELS = 0x1167, + VG_MAX_IMAGE_BYTES = 0x1168, + VG_MAX_FLOAT = 0x1169, + VG_MAX_GAUSSIAN_STD_DEVIATION = 0x116A +} VGParamType; + +typedef enum { + VG_RENDERING_QUALITY_NONANTIALIASED = 0x1200, + VG_RENDERING_QUALITY_FASTER = 0x1201, + VG_RENDERING_QUALITY_BETTER = 0x1202 /* Default */ +} VGRenderingQuality; + +typedef enum { + VG_PIXEL_LAYOUT_UNKNOWN = 0x1300, + VG_PIXEL_LAYOUT_RGB_VERTICAL = 0x1301, + VG_PIXEL_LAYOUT_BGR_VERTICAL = 0x1302, + VG_PIXEL_LAYOUT_RGB_HORIZONTAL = 0x1303, + VG_PIXEL_LAYOUT_BGR_HORIZONTAL = 0x1304 +} VGPixelLayout; + +typedef enum { + VG_MATRIX_PATH_USER_TO_SURFACE = 0x1400, + VG_MATRIX_IMAGE_USER_TO_SURFACE = 0x1401, + VG_MATRIX_FILL_PAINT_TO_USER = 0x1402, + VG_MATRIX_STROKE_PAINT_TO_USER = 0x1403 +} VGMatrixMode; + +typedef enum { + VG_CLEAR_MASK = 0x1500, + VG_FILL_MASK = 0x1501, + VG_SET_MASK = 0x1502, + VG_UNION_MASK = 0x1503, + VG_INTERSECT_MASK = 0x1504, + VG_SUBTRACT_MASK = 0x1505 +} VGMaskOperation; + +#define VG_PATH_FORMAT_STANDARD 0 + +typedef enum { + VG_PATH_DATATYPE_S_8 = 0, + VG_PATH_DATATYPE_S_16 = 1, + VG_PATH_DATATYPE_S_32 = 2, + VG_PATH_DATATYPE_F = 3 +} VGPathDatatype; + +typedef enum { + VG_ABSOLUTE = 0, + VG_RELATIVE = 1 +} VGPathAbsRel; + +typedef enum { + VG_CLOSE_PATH = ( 0 << 1), + VG_MOVE_TO = ( 1 << 1), + VG_LINE_TO = ( 2 << 1), + VG_HLINE_TO = ( 3 << 1), + VG_VLINE_TO = ( 4 << 1), + VG_QUAD_TO = ( 5 << 1), + VG_CUBIC_TO = ( 6 << 1), + VG_SQUAD_TO = ( 7 << 1), + VG_SCUBIC_TO = ( 8 << 1), + VG_SCCWARC_TO = ( 9 << 1), + VG_SCWARC_TO = (10 << 1), + VG_LCCWARC_TO = (11 << 1), + VG_LCWARC_TO = (12 << 1) +} VGPathSegment; + +typedef enum { + VG_MOVE_TO_ABS = VG_MOVE_TO | VG_ABSOLUTE, + VG_MOVE_TO_REL = VG_MOVE_TO | VG_RELATIVE, + VG_LINE_TO_ABS = VG_LINE_TO | VG_ABSOLUTE, + VG_LINE_TO_REL = VG_LINE_TO | VG_RELATIVE, + VG_HLINE_TO_ABS = VG_HLINE_TO | VG_ABSOLUTE, + VG_HLINE_TO_REL = VG_HLINE_TO | VG_RELATIVE, + VG_VLINE_TO_ABS = VG_VLINE_TO | VG_ABSOLUTE, + VG_VLINE_TO_REL = VG_VLINE_TO | VG_RELATIVE, + VG_QUAD_TO_ABS = VG_QUAD_TO | VG_ABSOLUTE, + VG_QUAD_TO_REL = VG_QUAD_TO | VG_RELATIVE, + VG_CUBIC_TO_ABS = VG_CUBIC_TO | VG_ABSOLUTE, + VG_CUBIC_TO_REL = VG_CUBIC_TO | VG_RELATIVE, + VG_SQUAD_TO_ABS = VG_SQUAD_TO | VG_ABSOLUTE, + VG_SQUAD_TO_REL = VG_SQUAD_TO | VG_RELATIVE, + VG_SCUBIC_TO_ABS = VG_SCUBIC_TO | VG_ABSOLUTE, + VG_SCUBIC_TO_REL = VG_SCUBIC_TO | VG_RELATIVE, + VG_SCCWARC_TO_ABS = VG_SCCWARC_TO | VG_ABSOLUTE, + VG_SCCWARC_TO_REL = VG_SCCWARC_TO | VG_RELATIVE, + VG_SCWARC_TO_ABS = VG_SCWARC_TO | VG_ABSOLUTE, + VG_SCWARC_TO_REL = VG_SCWARC_TO | VG_RELATIVE, + VG_LCCWARC_TO_ABS = VG_LCCWARC_TO | VG_ABSOLUTE, + VG_LCCWARC_TO_REL = VG_LCCWARC_TO | VG_RELATIVE, + VG_LCWARC_TO_ABS = VG_LCWARC_TO | VG_ABSOLUTE, + VG_LCWARC_TO_REL = VG_LCWARC_TO | VG_RELATIVE +} VGPathCommand; + +typedef VGHandle VGPath; + +typedef enum { + VG_PATH_CAPABILITY_APPEND_FROM = (1 << 0), + VG_PATH_CAPABILITY_APPEND_TO = (1 << 1), + VG_PATH_CAPABILITY_MODIFY = (1 << 2), + VG_PATH_CAPABILITY_TRANSFORM_FROM = (1 << 3), + VG_PATH_CAPABILITY_TRANSFORM_TO = (1 << 4), + VG_PATH_CAPABILITY_INTERPOLATE_FROM = (1 << 5), + VG_PATH_CAPABILITY_INTERPOLATE_TO = (1 << 6), + VG_PATH_CAPABILITY_PATH_LENGTH = (1 << 7), + VG_PATH_CAPABILITY_POINT_ALONG_PATH = (1 << 8), + VG_PATH_CAPABILITY_TANGENT_ALONG_PATH = (1 << 9), + VG_PATH_CAPABILITY_PATH_BOUNDS = (1 << 10), + VG_PATH_CAPABILITY_PATH_TRANSFORMED_BOUNDS = (1 << 11), + VG_PATH_CAPABILITY_ALL = (1 << 12) - 1 +} VGPathCapabilities; + +typedef enum { + VG_PATH_FORMAT = 0x1600, + VG_PATH_DATATYPE = 0x1601, + VG_PATH_SCALE = 0x1602, + VG_PATH_BIAS = 0x1603, + VG_PATH_NUM_SEGMENTS = 0x1604, + VG_PATH_NUM_COORDS = 0x1605 +} VGPathParamType; + +typedef enum { + VG_CAP_BUTT = 0x1700, + VG_CAP_ROUND = 0x1701, + VG_CAP_SQUARE = 0x1702 +} VGCapStyle; + +typedef enum { + VG_JOIN_MITER = 0x1800, + VG_JOIN_ROUND = 0x1801, + VG_JOIN_BEVEL = 0x1802 +} VGJoinStyle; + +typedef enum { + VG_EVEN_ODD = 0x1900, + VG_NON_ZERO = 0x1901 +} VGFillRule; + +typedef enum { + VG_STROKE_PATH = (1 << 0), + VG_FILL_PATH = (1 << 1) +} VGPaintMode; + +typedef VGHandle VGPaint; + +typedef enum { + /* Color paint parameters */ + VG_PAINT_TYPE = 0x1A00, + VG_PAINT_COLOR = 0x1A01, + VG_PAINT_COLOR_RAMP_SPREAD_MODE = 0x1A02, + VG_PAINT_COLOR_RAMP_PREMULTIPLIED = 0x1A07, + VG_PAINT_COLOR_RAMP_STOPS = 0x1A03, + + /* Linear gradient paint parameters */ + VG_PAINT_LINEAR_GRADIENT = 0x1A04, + + /* Radial gradient paint parameters */ + VG_PAINT_RADIAL_GRADIENT = 0x1A05, + + /* Pattern paint parameters */ + VG_PAINT_PATTERN_TILING_MODE = 0x1A06 +} VGPaintParamType; + +typedef enum { + VG_PAINT_TYPE_COLOR = 0x1B00, + VG_PAINT_TYPE_LINEAR_GRADIENT = 0x1B01, + VG_PAINT_TYPE_RADIAL_GRADIENT = 0x1B02, + VG_PAINT_TYPE_PATTERN = 0x1B03 +} VGPaintType; + +typedef enum { + VG_COLOR_RAMP_SPREAD_PAD = 0x1C00, + VG_COLOR_RAMP_SPREAD_REPEAT = 0x1C01, + VG_COLOR_RAMP_SPREAD_REFLECT = 0x1C02 +} VGColorRampSpreadMode; + +typedef enum { + VG_TILE_FILL = 0x1D00, + VG_TILE_PAD = 0x1D01, + VG_TILE_REPEAT = 0x1D02, + VG_TILE_REFLECT = 0x1D03 +} VGTilingMode; + +typedef enum { + /* RGB{A,X} channel ordering */ + VG_sRGBX_8888 = 0, + VG_sRGBA_8888 = 1, + VG_sRGBA_8888_PRE = 2, + VG_sRGB_565 = 3, + VG_sRGBA_5551 = 4, + VG_sRGBA_4444 = 5, + VG_sL_8 = 6, + VG_lRGBX_8888 = 7, + VG_lRGBA_8888 = 8, + VG_lRGBA_8888_PRE = 9, + VG_lL_8 = 10, + VG_A_8 = 11, + VG_BW_1 = 12, + + /* {A,X}RGB channel ordering */ + VG_sXRGB_8888 = 0 | (1 << 6), + VG_sARGB_8888 = 1 | (1 << 6), + VG_sARGB_8888_PRE = 2 | (1 << 6), + VG_sARGB_1555 = 4 | (1 << 6), + VG_sARGB_4444 = 5 | (1 << 6), + VG_lXRGB_8888 = 7 | (1 << 6), + VG_lARGB_8888 = 8 | (1 << 6), + VG_lARGB_8888_PRE = 9 | (1 << 6), + + /* BGR{A,X} channel ordering */ + VG_sBGRX_8888 = 0 | (1 << 7), + VG_sBGRA_8888 = 1 | (1 << 7), + VG_sBGRA_8888_PRE = 2 | (1 << 7), + VG_sBGR_565 = 3 | (1 << 7), + VG_sBGRA_5551 = 4 | (1 << 7), + VG_sBGRA_4444 = 5 | (1 << 7), + VG_lBGRX_8888 = 7 | (1 << 7), + VG_lBGRA_8888 = 8 | (1 << 7), + VG_lBGRA_8888_PRE = 9 | (1 << 7), + + /* {A,X}BGR channel ordering */ + VG_sXBGR_8888 = 0 | (1 << 6) | (1 << 7), + VG_sABGR_8888 = 1 | (1 << 6) | (1 << 7), + VG_sABGR_8888_PRE = 2 | (1 << 6) | (1 << 7), + VG_sABGR_1555 = 4 | (1 << 6) | (1 << 7), + VG_sABGR_4444 = 5 | (1 << 6) | (1 << 7), + VG_lXBGR_8888 = 7 | (1 << 6) | (1 << 7), + VG_lABGR_8888 = 8 | (1 << 6) | (1 << 7), + VG_lABGR_8888_PRE = 9 | (1 << 6) | (1 << 7) +} VGImageFormat; + +typedef VGHandle VGImage; + +typedef enum { + VG_IMAGE_QUALITY_NONANTIALIASED = (1 << 0), + VG_IMAGE_QUALITY_FASTER = (1 << 1), + VG_IMAGE_QUALITY_BETTER = (1 << 2) +} VGImageQuality; + +typedef enum { + VG_IMAGE_FORMAT = 0x1E00, + VG_IMAGE_WIDTH = 0x1E01, + VG_IMAGE_HEIGHT = 0x1E02 +} VGImageParamType; + +typedef enum { + VG_DRAW_IMAGE_NORMAL = 0x1F00, + VG_DRAW_IMAGE_MULTIPLY = 0x1F01, + VG_DRAW_IMAGE_STENCIL = 0x1F02 +} VGImageMode; + +typedef enum { + VG_RED = (1 << 3), + VG_GREEN = (1 << 2), + VG_BLUE = (1 << 1), + VG_ALPHA = (1 << 0) +} VGImageChannel; + +typedef enum { + VG_BLEND_SRC = 0x2000, + VG_BLEND_SRC_OVER = 0x2001, + VG_BLEND_DST_OVER = 0x2002, + VG_BLEND_SRC_IN = 0x2003, + VG_BLEND_DST_IN = 0x2004, + VG_BLEND_MULTIPLY = 0x2005, + VG_BLEND_SCREEN = 0x2006, + VG_BLEND_DARKEN = 0x2007, + VG_BLEND_LIGHTEN = 0x2008, + VG_BLEND_ADDITIVE = 0x2009, + VG_BLEND_SRC_OUT_SH = 0x200A, + VG_BLEND_DST_OUT_SH = 0x200B, + VG_BLEND_SRC_ATOP_SH = 0x200C, + VG_BLEND_DST_ATOP_SH = 0x200D +} VGBlendMode; + +typedef enum { + VG_IMAGE_FORMAT_QUERY = 0x2100, + VG_PATH_DATATYPE_QUERY = 0x2101 +} VGHardwareQueryType; + +typedef enum { + VG_HARDWARE_ACCELERATED = 0x2200, + VG_HARDWARE_UNACCELERATED = 0x2201 +} VGHardwareQueryResult; + +typedef enum { + VG_VENDOR = 0x2300, + VG_RENDERER = 0x2301, + VG_VERSION = 0x2302, + VG_EXTENSIONS = 0x2303 +} VGStringID; + +/* Function Prototypes */ + +#if defined(_WIN32) || defined(__VC32__) +# if defined(VG_API_EXPORT) +# define VG_API_CALL __declspec(dllexport) +# else +# define VG_API_CALL __declspec(dllimport) +# endif +#else +# define VG_API_CALL extern +#endif + +#if defined (__cplusplus) +extern "C" { +#endif + +VG_API_CALL VGErrorCode vgGetError(void); + +VG_API_CALL void vgFlush(void); +VG_API_CALL void vgFinish(void); + +/* Getters and Setters */ +VG_API_CALL void vgSetf (VGParamType type, VGfloat value); +VG_API_CALL void vgSeti (VGParamType type, VGint value); +VG_API_CALL void vgSetfv(VGParamType type, VGint count, + const VGfloat * values); +VG_API_CALL void vgSetiv(VGParamType type, VGint count, + const VGint * values); + +VG_API_CALL VGfloat vgGetf(VGParamType type); +VG_API_CALL VGint vgGeti(VGParamType type); +VG_API_CALL VGint vgGetVectorSize(VGParamType type); +VG_API_CALL void vgGetfv(VGParamType type, VGint count, VGfloat * values); +VG_API_CALL void vgGetiv(VGParamType type, VGint count, VGint * values); + +VG_API_CALL void vgSetParameterf(VGHandle object, + ... [truncated message content] |