OSDN Git Service

many
[psychlops/silverlight.git] / dev3 / psychlops / core / graphic / shape.cs
index 2933260..cbafab0 100644 (file)
@@ -12,26 +12,44 @@ using System.Windows.Shapes;
 \r
 namespace Psychlops{\r
 \r
-       public interface Shape : Figure\r
+       public interface Shape : Internal.PrimitiveFigure\r
        {\r
-               void draw(Color c);\r
                Color fill { get; set; }\r
                Stroke stroke { get; set; }\r
        }\r
        public static class ShapeExtention\r
        {\r
-               /*\r
-               public static void draw(this Shape drawee)\r
+               public static void draw(this Shape drawee, Color c)\r
                {\r
-                       drawee.draw(Color.white);\r
+                       Color tmp_col = drawee.fill;\r
+                       Stroke tmp_strk = drawee.stroke;\r
+                       drawee.fill = c;\r
+                       drawee.stroke = new Stroke();\r
+                       drawee.draw();\r
+                       drawee.fill = tmp_col;\r
+                       drawee.stroke = tmp_strk;\r
+               }\r
+               public static void draw(this Shape drawee, Stroke strk)\r
+               {\r
+                       Color tmp_col = drawee.fill;\r
+                       Stroke tmp_strk = drawee.stroke;\r
+                       drawee.fill = new Color(0,0,1,1);\r
+                       drawee.stroke = strk;\r
+                       drawee.draw();\r
+                       drawee.fill = tmp_col;\r
+                       drawee.stroke = tmp_strk;\r
                }\r
-               */\r
        }\r
 \r
        public partial struct Stroke\r
        {\r
                public double thick;\r
                public Color color;\r
+               public Stroke(Color c, double t)\r
+               {\r
+                       color = c;\r
+                       thick = t;\r
+               }\r
                public void set(Color c, double t)\r
                {\r
                        color = c;\r
@@ -78,10 +96,6 @@ namespace Psychlops{
                        return this;\r
                }\r
 \r
-               public void draw(Color c)\r
-               {\r
-                       Main.drawable.line(this, c);\r
-               }\r
                public void draw()\r
                {\r
                        Main.drawable.line(this);\r
@@ -135,10 +149,6 @@ namespace Psychlops{
                        return this;\r
                }\r
 \r
-               public void draw(Color c)\r
-               {\r
-                       Main.drawable.rect(this, c);\r
-               }\r
                public void draw()\r
                {\r
                        Main.drawable.rect(this);\r
@@ -189,10 +199,6 @@ namespace Psychlops{
                        return this;\r
                }\r
 \r
-               public void draw(Color c)\r
-               {\r
-                       Main.drawable.ellipse(this, c);\r
-               }\r
                public void draw()\r
                {\r
                        Main.drawable.ellipse(this);\r
@@ -253,10 +259,6 @@ namespace Psychlops{
                        return this;\r
                }\r
 \r
-               public void draw(Color c)\r
-               {\r
-                       Main.drawable.polygon(this, c);\r
-               }\r
                public void draw()\r
                {\r
                        Main.drawable.polygon(this);\r