talira

2D vector graphics library in C with output to screens, images, PDF, PostScript and SVG

open sourceLGPL-2.1-only OR MPL-1.1free

cairo is a 2D graphics library written in C that draws the same way on several output targets: the X Window System (through Xlib and XCB), Quartz, Win32, image buffers, and PostScript, PDF and SVG files. Its drawing model follows PostScript and PDF, with stroking and filling Bézier paths, affine transforms, compositing translucent images and antialiased text, and it uses hardware acceleration where the display offers it. Bindings exist for many languages, among them pycairo for Python, rcairo for Ruby and cairomm for C++, and GTK draws with it. Install it from a Linux distribution (libcairo2-dev on Debian), Homebrew or MacPorts, or build it from the release tarballs with pixman.

Problems it solves

  • draw charts and vector shapes in a C program and save them as PDF or SVG
  • render the same 2D drawing to the screen and to a printable file
  • produce antialiased graphics and text for a Linux desktop app

Features

  • one drawing API for X11 (Xlib and XCB), Quartz, Win32, image buffers, PDF, PostScript and SVG
  • stroking and filling cubic Bézier paths, with affine transforms
  • compositing translucent images and antialiased text
  • uses display hardware acceleration where available, such as the X Render extension
  • bindings for Python, Ruby, C++, Haskell, Lua and other languages

Limitations

  • It draws only: windows, input and widgets come from a toolkit such as GTK, or from Xlib, Win32 or Quartz directly.1
  • Building from source needs the pixman library as well.2