cairo 1.0.0 copy "cairo: ^1.0.0" to clipboard
cairo: ^1.0.0 copied to clipboard

outdated

Dart bindings to the Cairo C graphics library

Cairo Dart #

Dart bindings to the Cairo C graphics library.

Features #

  • 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 #

Currently, you have to compile Cairo directly. However, it may be changed in the future.

Usage #

// Load the cairo c library
CairoLib.load();

// 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;
img.fill();

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

// destroy the image data in the RAM
img.destroy();

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.

3
likes
0
points
12
downloads

Publisher

verified publishermanim-web.hugos29.dev

Weekly Downloads

Dart bindings to the Cairo C graphics library

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

ffi

More

Packages that depend on cairo