← Back to team overview

kicad-developers team mailing list archive

Research: Graphics Backends

 

Hi Wayne,

I've done a bit more research about graphics backends. I know that you're trying to port to wxGC - an alternative idea would be to support different graphics backends. 
That means, a "Graphics Abstraction Layer (GAL)" could be implemented, that makes it easy to adapt another backend without rewriting too much code (-> plugins). Perhaps it's possible for you to implement it this way.

Hot candidates are OpenVG over ShivaVG - because full hardware acceleration is used (for PCBNEW) and Cairo(Skia) for high quality drawing (EESchema).
I'll prepare a small javascript demo, to evaluate the drawing speed of Cairo/Skia for EESchema.

The Matrix class is another topic, I had a short look at wxGraphicsMatrix - but wasn't very impressed. No overloading of operators and many matrix operations are missing. I'd use either a BLAS variant like Boost::uBlas or a similar linear algebra package (I've written my own). At least if ever intelligent algorithms are needed (for placing etc.) you need a powerful numeric library.

Bye..
Torsten

------------------------------
Alternative Graphics Libraries
------------------------------

------
OpenVG
------

http://en.wikipedia.org/wiki/OpenVG
http://www.khronos.org/openvg/

"OpenVG is a standard API designed for hardware-accelerated 2D vector graphics. It is aimed primarily 
at cell phones, media and gaming consoles such as the PlayStation 3, and other consumer electronic devices. 
It will help manufacturers create flashier user interfaces that are less dependent on energy-hungry CPUs. 
OpenVG is well suited to accelerating Flash or SVG sequences. For a 3D match see OpenGL ES. 
OpenVG is managed by the not-for-profit technology consortium, the Khronos Group"

-> designed for fast 2D drawing, supports bésier curves, elliptical arcs, alpha blending etc.

+ An official standard

- Not many implementations yet

Implementations:
* ShivaVG
http://sourceforge.net/projects/shivavg/

I've tried that library, works very well under Linux Mint and uses full Open GL acceleration. 
The tiger example looks well with antialiasing enabled. Combining with wxWidgets should be 
easy with the existing wxGLCanvas.

* QT
http://labs.trolltech.com/blogs/2009/06/24/openvg-support-in-qt-46/
"Recently we’ve been working on writing an OpenVG graphics system for Qt 4.6, and now it is all ready to go!
Qt 4.5 added support for pluggable graphics systems, which allow the window drawing surfaces and their 
associated paint engines to be redirected to a plugin for handling. There are graphics systems for 
OpenGL 1.x and 2.x, and now for OpenVG!"

* AmanithVG a commercial implementation
http://www.amanithvg.com/screenshots.html

-----
Cairo
-----

http://en.wikipedia.org/wiki/Cairo_%28graphics%29
http://www.cairographics.org/

"Cairo is a 2D graphics library with support for multiple output devices. 
Currently supported output targets include the X Window System, Quartz, Win32, image buffers, 
PostScript, PDF, and SVG file output. Experimental backends include OpenGL (through glitz), XCB, BeOS, OS/2, and DirectFB."

+ Available on most platforms, because Firefox uses it for rendering
+ Easy to use, examples: http://www.cairographics.org/samples/
+ Integration into a wxWidgets context is easy too: http://code.google.com/p/wxcairo/
+ Direct drawing on a PDF, Postscript surface
- Slower drawing speed than other libraries

----
Skia
----

http://www.atoker.com/blog/2008/09/06/skia-graphics-library-in-chrome-first-impressions/
"With the release of the WebKit-based Chrome browser, Google also introduced a handful of new 
backends for the browser engine including a new HTTP stack and the Skia graphics library."
"The Skia Graphics Engine is a compact open source graphics library. It was originally 
developed by Skia Inc., which was subsequently acquired by Google, who then released the software as open source.
Now known as skia, it is used in Google's Chrome web browser and Android operating system."

+ Similar functions like Cairo
+ Faster than Cairo
+ Strong support from Google
- wxWidgets integration unknown (perhaps like Cairo)
- At an early stage

-------------------
Anti-Grain-Geometry
-------------------

http://antigrain.com/
http://en.wikipedia.org/wiki/Anti-Grain_Geometry
"Anti-Grain Geometry (AGG) is a high-quality 2D rendering library written in C++. It features 
anti-aliasing and sub-pixel resolution."

+ High quality
+ Fast drawing
- Seems to be outdated
- wxWidgets integration unknown

--------
- SFML -
--------

http://www.sfml-dev.org
http://en.wikipedia.org/wiki/Simple_and_Fast_Multimedia_Library
"Simple and Fast Multimedia Library (SFML) is an object-oriented, cross-platform, 
free and open source software multimedia API written in C++ by Laurent Gomila. 
It is intended as an more modern alternative to SDL with a greater emphasis on OOP."

+ Fast 2D drawing
+ Easy integration into wxWidgets
- Not enough graphics primitives
- Too large (?)
-- 
NEU: Mit GMX DSL über 1000,- ¿ sparen!
http://portal.gmx.net/de/go/dsl02






Follow ups

References