changeset 76:78bc2046256e

And some more
author "David Bryant <bagnose@gmail.com>"
date Sun, 15 Aug 2010 01:21:14 +0930
parents 3cac0ee8ca35
children 15ca7d5cd1ed
files doodle/gtk/cairo.d doodle/tk/color.d doodle/tk/drawing.d
diffstat 3 files changed, 24 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/doodle/gtk/cairo.d	Sun Aug 15 01:14:26 2010 +0930
+++ b/doodle/gtk/cairo.d	Sun Aug 15 01:21:14 2010 +0930
@@ -5,7 +5,7 @@
 }
 
 /*
-final class CairoDrawing : Drawing {
+final class CairoDrawable : Drawable {
     this(Context cr) {
         assert(cr);
         _cr = cr;
@@ -13,13 +13,8 @@
 
     // Drawing overrides:
 
-    void pushState() {
-        _cr.save;
-    }
-
-    void popState() {
-        _cr.restore;
-    }
+    void pushState() { _cr.save; }
+    void popState() { _cr.restore; }
 
     private {
         Context _cr;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doodle/tk/color.d	Sun Aug 15 01:21:14 2010 +0930
@@ -0,0 +1,20 @@
+module doodle.tk.color;
+
+struct Color {
+    static immutable Color DEFAULT = Color(0.0, 0.0, 0.0, 1.0);
+
+    this(in double r, in double g, in double b, in double a) {
+        // XXX how to deal with out of range? Clamp/assert
+        _r = r;
+        _g = g;
+        _b = b;
+        _a = a;
+    }
+
+    // TODO
+    // hsv, grey, etc.
+
+    private {
+        double _r, _g, _b, _a;
+    }
+}
--- a/doodle/tk/drawing.d	Sun Aug 15 01:14:26 2010 +0930
+++ b/doodle/tk/drawing.d	Sun Aug 15 01:21:14 2010 +0930
@@ -4,7 +4,7 @@
     import doodle.tk.geometry;
 }
 
-interface Drawing {
+interface Drawable {
     enum LineStyle {
         SOLID,
         DASHED,