Using Cairo Features with Views

What is Cairo

Cairo is an open source library which performs 2D graphics rendering on multiple output devices. In Views, Cairo draws using the XRender extension, taking advantage of display hardware acceleration when available. It comes with interesting features such as transparency, anti-aliasing and gradients. For more information about Cairo, see http://www.cairographics.org.

Setting up Views to use Cairo

To use Cairo in Views, you must comply with the following requirements:

  • The Cairo shared library and its dependencies (Zlib, PNG, Pixman) must be accessible in your library path

  • The XRender shared library must be accessible in your library path

  • The ilvcairo shared library delivered with Views must be accessible in your library path

  • Use an X Window display with the XRender extension enabled

The required libraries can be complied by downloading tarballs for XRender, Cairo, and each of its dependencies from the Internet.

Views supports the Cairo 1.10 release. Views applications can use Cairo on every supported X Window platform.

Using Cairo in Views

Views uses dynamic library loading to enable applications to draw using Cairo, even if they are statically linked. At runtime, an application will perform the following steps:

  • Dynamically load the Cairo shared library

  • Dynamically load the ilvcairo shared library

  • Call XRenderQueryExtension to ask the X Window display if the XRender extension is available

If one of these steps fails, the application will not be able to draw using Cairo.

Cairo Features in Views

When Cairo is correctly set up, Views provides its benefits through a dedicated API to the IlvPalette, IlvPort, and IlvDisplay classes. The following methods have been added to handle transparency, anti-aliasing, and gradients:

  • IlvPort::setAntialiasingMode

  • IlvPort::getAntialiasingMode

See also sections Alpha Value , Anti-Aliasing Mode , and IlvGradientPattern class .