This topic was published by DevynCJohnson and viewed 2071 times since "". The last page revision was "".
- Topics - 443
Cairo (http://cairographics.org/) is a popular graphics library that many open-source programs use. For instance, the desktop dock named "Cairo-Dock" uses Cairo for its graphics, hence the name "Cairo-Dock". Cairo is vector-based. In simple terms, this means the graphics uses equations and such to generate an image in contrast to bitmap-graphics (raster-graphics) which are pixels.
NOTE: There is a lot to know about vector-vs-bitmap. For those of you that want a detailed explanation of vector graphics and bitmap graphics, then you may want to read this Wikipedia article - http://en.wikipedia.org/wiki/Vector_graphics
The Cairo library is an API written in the C language. The code is platform-independent. Because of this fact, programmers do not need to rewrite Cairo code for each type of system that may use their application. Just because Cairo is a C-based library does not mean developers using other languages cannot use Cairo. There is this special thing called a "language binding" or "binding", depending on which term you prefer. Bindings allow programmers to use libraries and other code in multiple languages. For instance, a developer that uses Python code can use a Python-based Cairo binding so Cairo can be implemented into their program.
Cairo provides two-dimensional graphics, although with some clever designing, the end product can appear 3D. Cairo can be used with various GUI-toolkits like GTK, SDL, FLTK, and others. Cairo is also implemented in the Webkit and Gecko engines to manage SVG and "<canvas>" rendering. PDF and Postscript has also found a use for Cairo.
NOTE: <canvas> is an HTML5 tag that allows shapes to be displayed or drawn.
If you are a programmer interested in graphics, then you may want to learn Cairo or its binding that pertains to your preferred language. To use Cairo in C/C++ code, import Cairo using
Cairo is capable of producing text. However, some developers prefer Pango, a text renderer library (http://www.pango.org/). Yes, Pango can be used with Cairo without any conflicts. In fact, many developers recommend this including myself.
Cairo code for a C/C++ application looks no different than any other command or library for C/C++. For illustration,
cairo_rectangle(cr, 30, 30, 120, 80);makes a single rectangle by specifying the corners as parameters.
If you wish to learn Cairo coding, then I recommend going to Cairo's main website or learn here (http://zetcode.com/gfx/cairo/).
If you are doing graphics programming for your application and you are wondering why you may want to use Cairo instead of your other possible alternatives, then here are some facts to consider. Cairo is a cross-platform open-source library. Cairo uses vector graphics instead of raster/bitmap. Cairo is capable of hardware-acceleration. Cairo is stable and many binding are available.
In summary, Cairo is a popular and widely used vector-graphics library that is compatible with many programming languages.
- OpenGL and Other Graphics Libraries - http://dcjtech.info/topic/opengl-and-other-graphics-libraries/
- Linux Libraries (Paths, Files, and Commands) - http://dcjtech.info/topic/linux-libraries-paths-files-and-commands/
- Standard C Libraries - http://dcjtech.info/topic/standard-c-libraries/
- Standard C Library Headers - http://dcjtech.info/topic/standard-c-library-headers/