Mercurial > projects > doodle
comparison doodle/gtk/cairo_renderer.d @ 132:bc5baa585b32
Updated to dmd 2.060
author | David Bryant <bagnose@gmail.com> |
---|---|
date | Thu, 02 Aug 2012 15:32:43 +0930 |
parents | 467febed7367 |
children |
comparison
equal
deleted
inserted
replaced
130:1bc3475624d3 | 132:bc5baa585b32 |
---|---|
34 void setColor(in Color color) { _cr.setSourceRgba(color.r, color.g, color.b, color.a); } | 34 void setColor(in Color color) { _cr.setSourceRgba(color.r, color.g, color.b, color.a); } |
35 | 35 |
36 void translate(in Point p) { _cr.translate(p.x, p.y); } | 36 void translate(in Point p) { _cr.translate(p.x, p.y); } |
37 void scale(in double s) { _cr.scale(s, s); } | 37 void scale(in double s) { _cr.scale(s, s); } |
38 | 38 |
39 void pushState() { _cr.save; } | 39 void pushState() { _cr.save(); } |
40 void popState() { _cr.restore; } | 40 void popState() { _cr.restore(); } |
41 | 41 |
42 void drawRectangle(in Rectangle rectangle, bool fill = false) { | 42 void drawRectangle(in Rectangle rectangle, bool fill = false) { |
43 _cr.rectangle(rectangle.position.x, rectangle.position.y, | 43 _cr.rectangle(rectangle.position.x, rectangle.position.y, |
44 rectangle.size.x, rectangle.size.y); | 44 rectangle.size.x, rectangle.size.y); |
45 if (fill) { _cr.fill; } else { _cr.stroke; } | 45 if (fill) { _cr.fill(); } else { _cr.stroke(); } |
46 } | 46 } |
47 | 47 |
48 void drawEllipse(in Rectangle rectangle, bool fill = false) { | 48 void drawEllipse(in Rectangle rectangle, bool fill = false) { |
49 // NYI | 49 // NYI |
50 } | 50 } |
51 | 51 |
52 void drawSegment(in Segment segment) { | 52 void drawSegment(in Segment segment) { |
53 _cr.moveTo(segment.begin.x, segment.begin.y); | 53 _cr.moveTo(segment.begin.x, segment.begin.y); |
54 _cr.lineTo(segment.end.x, segment.end.y); | 54 _cr.lineTo(segment.end.x, segment.end.y); |
55 _cr.stroke; | 55 _cr.stroke(); |
56 } | 56 } |
57 | 57 |
58 void drawHLine(in double y, in double x0, in double x1) { | 58 void drawHLine(in double y, in double x0, in double x1) { |
59 _cr.moveTo(x0, y); | 59 _cr.moveTo(x0, y); |
60 _cr.lineTo(x1, y); | 60 _cr.lineTo(x1, y); |
61 _cr.stroke; | 61 _cr.stroke(); |
62 } | 62 } |
63 | 63 |
64 void drawVLine(in double x, in double y0, in double y1) { | 64 void drawVLine(in double x, in double y0, in double y1) { |
65 _cr.moveTo(x, y0); | 65 _cr.moveTo(x, y0); |
66 _cr.lineTo(x, y1); | 66 _cr.lineTo(x, y1); |
67 _cr.stroke; | 67 _cr.stroke(); |
68 } | 68 } |
69 | 69 |
70 void drawPoly(in Point[] points, bool fill = false) { | 70 void drawPoly(in Point[] points, bool fill = false) { |
71 assert(points.length >= 2); | 71 assert(points.length >= 2); |
72 foreach(i, p; points) { | 72 foreach(i, p; points) { |
73 if (i == 0) { _cr.moveTo(p.x, p.y); } | 73 if (i == 0) { _cr.moveTo(p.x, p.y); } |
74 else { _cr.lineTo(p.x, p.y); } | 74 else { _cr.lineTo(p.x, p.y); } |
75 } | 75 } |
76 if (fill) { _cr.fill; } else { _cr.stroke; } | 76 if (fill) { _cr.fill(); } else { _cr.stroke(); } |
77 } | 77 } |
78 | 78 |
79 void setFontFace(in FontFace face) { | 79 void setFontFace(in FontFace face) { |
80 // NYI | 80 // NYI |
81 } | 81 } |