root/trunk/cairo/cairooo_snippets/snippets/fill_and_stroke.d

Revision 119, 0.5 kB (checked in by DRK, 6 years ago)

* Added bindings for the Glitz and Xlib backends.
* Checked in cairooo: an OO layer on top of the cairo binding.
* Added snippets directory for cairooo
* Added basic tutorial on how to use cairooo
* Added a simple demo program.
* Added scripts for building import libraries.
* Fixed several bugs.
* Drank WAAY too much coffee.

Line 
1 module snippets.fill_and_stroke;
2
3 private
4 {
5     import std.math;
6     import cairooo.all;
7     import snippets.common;
8 }
9
10 void snippet_fill_and_stroke(Context cr, int width, int height)
11 {
12     cr.moveTo(0.5, 0.1);
13     cr.lineTo(0.9, 0.9);
14     cr.relLineTo(-0.4, 0.0);
15     cr.curveTo(0.2, 0.9, 0.2, 0.5, 0.5, 0.5);
16     cr.closePath();
17
18     cr.setSourceRGB(0, 0, 1);
19     cr.fillPreserve();
20     cr.setSourceRGB(0, 0, 0);
21     cr.stroke();
22 }
23
24 static this()
25 {
26     snippets_hash["fill_and_stroke"] = &snippet_fill_and_stroke;
27 }
Note: See TracBrowser for help on using the browser.