Cairo Dart

Dart bindings to the Cairo C graphics library.


  • Rendering lines, arcs, B├ęzier curves (cubic and quadratic).
  • Saving to an image
  • Transformations (rotation, translation, scaling, and any other matrix-described transformation)
  • Fill and stroke (only solid color for now)

Getting started

1. Download Cairo

Detailed on cairo's website

2. Install

dart pub install cairo

3. That's all, enjoy!


// Load the cairo c library

// Create a 640x320 surface / canvas
final img = ImageSurface(
  format: ImageFormat.ARGB32,
  width: 640,
  height: 360,

// render a magenta background
img.rectangle(Point(0, 0), img.width, img.height);
img.sourceColor = Color.magenta;

// save the image'out.png');

// destroy the image data in the RAM

For more complicated examples, look at the example/ folder.

Additional information

Some of the functions cairo has aren't implemented yet. If you think a function needs to be added, you can create an issue explaining this.

This project is part of Manim Web.