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

Revision 119, 0.6 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.curve_to;
2
3 private
4 {
5     import std.math;
6     import cairooo.all;
7     import snippets.common;
8 }
9
10 void snippet_curve_to(Context cr, int width, int height)
11 {
12     double x=0.1,  y=0.5;
13     double x1=0.4, y1=0.9,
14            x2=0.6, y2=0.1,
15            x3=0.9, y3=0.5;
16
17     cr.moveTo(x, y);
18     cr.curveTo(x1, y1, x2, y2, x3, y3);
19     cr.stroke();
20
21     cr.setSourceRGBA(1, 0.2, 0.2, 0.6);
22     cr.lineWidth = 0.03;
23     cr.moveTo(x, y);    cr.lineTo(x1, y1);
24     cr.moveTo(x2, y2);  cr.lineTo(x3, y3);
25     cr.stroke();
26 }
27
28 static this()
29 {
30     snippets_hash["curve_to"] = &snippet_curve_to;
31 }
Note: See TracBrowser for help on using the browser.