OSDN Git Service

clock interval
[psychlops/silverlight.git] / dev3 / psychlops / core / graphic / module.cs
index 67bf68f..ac8000e 100644 (file)
@@ -1,19 +1,11 @@
 using System;\r
 using System.Windows;\r
-using System.Windows.Controls;\r
-using System.Windows.Documents;\r
-using System.Windows.Input;\r
-using System.Windows.Media;\r
-using System.Windows.Media.Animation;\r
-using System.Windows.Media.Imaging;\r
-using System.Windows.Shapes;\r
-\r
 \r
 \r
 namespace Psychlops\r
 {\r
 \r
-       public struct Point\r
+       public partial struct Point\r
        {\r
                public double x, y, z;\r
                public Point(double dx, double dy, double dz)\r
@@ -51,14 +43,14 @@ namespace Psychlops
                {\r
                        return new Point(lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z);\r
                }\r
-               public static implicit operator System.Windows.Point(Point d)\r
+               public override string ToString()\r
                {\r
-                       return new System.Windows.Point(d.x, d.y);\r
+                       return "X:"+ x.ToString() + " Y:"+ y.ToString() + " Z:"+ z.ToString();\r
                }\r
        }\r
 \r
 \r
-       public struct Color\r
+       public partial struct Color\r
        {\r
                public double r, g, b, a;\r
                public Color(double lum)\r
@@ -99,9 +91,10 @@ namespace Psychlops
                        b = blue;\r
                        a = alpha;\r
                }\r
-               public static implicit operator System.Windows.Media.Color(Color d)\r
+\r
+               public override string ToString()\r
                {\r
-                       return System.Windows.Media.Color.FromArgb((byte)(d.a * 255), (byte)(d.r * 255), (byte)(d.g * 255), (byte)(d.b * 255));\r
+                       return "R:" + r.ToString() + " G:" + g.ToString() + " B:" + b.ToString() + " A:" + a.ToString();\r
                }\r
 \r
                public static readonly Color\r
@@ -113,7 +106,8 @@ namespace Psychlops
                        magenta = new Color(1, 0, 1, 1),\r
                        cyan = new Color(0, 1, 1, 1),\r
                        white = new Color(1, 1, 1, 1),\r
-                       gray = new Color(.5, .5, .5, 1);\r
+                       gray = new Color(.5, .5, .5, 1),\r
+                       null_color = new Color(0, 0, 0, 0);\r
 \r
        }\r
 \r
@@ -123,11 +117,11 @@ namespace Psychlops
                Point getCenter();\r
                void clear(Color col);\r
                void pix(int x, int y, Color col);\r
-               void line(Line drawee, Color col);\r
-               void rect(Rectangle drawee, Color col);\r
-               void ellipse(Ellipse drawee, Color col);\r
-               void polygon(Polygon drawee, Color col);\r
-               void letters(Letters drawee, Color col);\r
+               void line(Line drawee);\r
+               void rect(Rectangle drawee);\r
+               void ellipse(Ellipse drawee);\r
+               void polygon(Polygon drawee);\r
+               void letters(Letters drawee);\r
                void image(Image drawee);\r
                void msg(string s, double x, double y, Color c);\r
        }\r
@@ -156,59 +150,11 @@ namespace Psychlops
                }\r
        }\r
 \r
-       public class Image : Figure\r
+       namespace Internal\r
        {\r
-               public WriteableBitmap buffer;\r
-               public Point datum;\r
-               public Rectangle self_rect;\r
-\r
-               public Image(int wid, int hei)\r
-               {\r
-                       buffer = new WriteableBitmap(wid, hei);\r
-                       self_rect = new Rectangle(wid, hei);\r
-               }\r
-\r
-               /*public Image shift(double x, double y)\r
-               {\r
-                       datum.x += x;\r
-                       datum.y += y;\r
-                       return this;\r
-               }*/\r
-               public Figure shift(Point p)\r
+               public interface PrimitiveFigure : Figure\r
                {\r
-                       datum += p;\r
-                       return this;\r
+                       UIElement toNative();\r
                }\r
-               public Figure centering(Point p)\r
-               {\r
-                       datum.x = p.x - width / 2.0;\r
-                       datum.y = p.y - height / 2.0;\r
-                       return this;\r
-               }\r
-\r
-               public void pix(int x, int y, Color col)\r
-               {\r
-                       buffer.SetPixel(x, y, col);\r
-               }\r
-\r
-\r
-               public void field(System.Func<int,int,System.Windows.Media.Color> func)\r
-               {\r
-                       buffer.ForEach(func);\r
-               }\r
-               public void field(System.Func<int, int, System.Windows.Media.Color, System.Windows.Media.Color> func)\r
-               {\r
-                       buffer.ForEach(func);\r
-               }\r
-\r
-               public void draw()\r
-               {\r
-                       Main.drawable.image(this);\r
-               }\r
-\r
-               public double width  { get { return self_rect.width; } }\r
-               public double height { get { return self_rect.height; } }\r
-\r
        }\r
-\r
 }
\ No newline at end of file