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

Revision 119, 0.8 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.arc_negative;
2
3 private
4 {
5     import std.math;
6     import cairooo.all;
7     import snippets.common;
8 }
9
10 void snippet_arc_negative(Context cr, int width, int height)
11 {
12     double xc = 0.5;
13     double yc = 0.5;
14     double radius = 0.4;
15     double angle1 = 45.0  * (PI/180.0);
16     double angle2 = 180.0 * (PI/180.0);
17
18     cr.arcNegative(xc, yc, radius, angle1, angle2);
19     cr.stroke();
20    
21     // draw helping lines
22     cr.setSourceRGBA(1, 0.2, 0.2, 0.6);
23     cr.arc(xc, yc, 0.05, 0, 2*PI);
24     cr.fill();
25     cr.lineWidth = 0.03;
26     cr.arc(xc, yc, radius, angle1, angle1);
27     cr.lineTo(xc, yc);
28     cr.arc(xc, yc, radius, angle2, angle2);
29     cr.lineTo(xc, yc);
30     cr.stroke();
31 }
32
33 static this()
34 {
35     snippets_hash["arc_negative"] = &snippet_arc_negative;
36 }
Note: See TracBrowser for help on using the browser.