2 using System.Windows;
\r
8 public partial struct Point
\r
10 public double x, y, z;
\r
11 public Point(double dx, double dy, double dz = 0.0)
\r
17 public Point set(double dx, double dy, double dz = 0.0)
\r
25 public static Point operator +(Point lhs, Point rhs)
\r
27 return new Point(lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z);
\r
29 public static Point operator -(Point lhs, Point rhs)
\r
31 return new Point(lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z);
\r
33 public override string ToString()
\r
35 return "X:"+ x.ToString() + " Y:"+ y.ToString() + " Z:"+ z.ToString();
\r
40 public partial struct Color
\r
42 public double r, g, b, a;
\r
43 public Color(double lum)
\r
48 public Color(double red, double green, double blue, double alpha = 1.0)
\r
55 public void set(double lum)
\r
60 public void set(double red, double green, double blue, double alpha = 1.0)
\r
68 public override string ToString()
\r
70 return "R:" + r.ToString() + " G:" + g.ToString() + " B:" + b.ToString() + " A:" + a.ToString();
\r
73 public static readonly Color
\r
74 black = new Color(0, 0, 0, 1),
\r
75 red = new Color(1, 0, 0, 1),
\r
76 green = new Color(0, 1, 0, 1),
\r
77 blue = new Color(0, 0, 1, 1),
\r
78 yellow = new Color(1, 1, 0, 1),
\r
79 magenta = new Color(1, 0, 1, 1),
\r
80 cyan = new Color(0, 1, 1, 1),
\r
81 white = new Color(1, 1, 1, 1),
\r
82 gray = new Color(.5, .5, .5, 1),
\r
83 null_color = new Color(0, 0, 0, 0);
\r
88 public interface Drawable
\r
91 void clear(Color col);
\r
92 void pix(int x, int y, Color col);
\r
93 void line(Line drawee);
\r
94 void rect(Rectangle drawee);
\r
95 void ellipse(Ellipse drawee);
\r
96 void polygon(Polygon drawee);
\r
97 void letters(Letters drawee);
\r
98 void image(Image drawee);
\r
99 void msg(string s, double x, double y, Color c);
\r
104 public interface Figure
\r
106 Point datum { get; set; }
\r
107 Figure shift(Point p);
\r
108 Figure centering(Point p);
\r
111 public static class FigureExtention
\r
113 public static Point getDatum(this Figure target)
\r
115 return target.datum;
\r
117 public static Point setDatum(this Figure target, Point p)
\r
120 return target.datum;
\r
122 public static Figure shift(this Figure target, double x, double y, double z = 0.0)
\r
124 return target.shift(new Point(x, y, z));
\r
126 public static Figure centering(this Figure target)
\r
128 return target.centering(Main.drawable.getCenter());
\r
130 public static Figure centering(this Figure target, double x, double y, double z = 0.0)
\r
132 return target.centering(new Point(x, y, z));
\r
138 public interface PrimitiveFigure : Figure
\r
140 UIElement toNative();
\r