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

Revision 119, 0.7 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_stroke2;
2
3 private
4 {
5     import std.math;
6     import cairooo.all;
7     import snippets.common;
8 }
9
10 void snippet_fill_and_stroke2(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.moveTo(0.25, 0.1);
19     cr.relLineTo(0.2, 0.2);
20     cr.relLineTo(-0.2, 0.2);
21     cr.relLineTo(-0.2, -0.2);
22     cr.closePath();
23
24     cr.setSourceRGB(0, 0, 1);
25     cr.fillPreserve();
26     cr.setSourceRGB(0, 0, 0);
27     cr.stroke();
28 }
29
30 static this()
31 {
32     snippets_hash["fill_and_stroke2"] = &snippet_fill_and_stroke2;
33 }
Note: See TracBrowser for help on using the browser.