--- /dev/null
+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
+namespace Psychlops{\r
+\r
+\r
+ public partial class Image : Internal.PrimitiveFigure\r
+ {\r
+ public WriteableBitmap buffer;\r
+ public Point datum { get; set; }\r
+ public Point getDatum() { return datum; }\r
+ public Point setDatum(Point p) { datum = p; return datum; }\r
+ public Rectangle self_rect;\r
+ protected bool AsyncBool;\r
+\r
+ public Image() \r
+ {\r
+ self_rect = new Rectangle(1, 1);\r
+ initialize__(1, 1);\r
+ }\r
+\r
+ public Image(string uri)\r
+ {\r
+ self_rect = new Rectangle();\r
+ load__(uri);\r
+ }\r
+\r
+ public Image(int wid, int hei)\r
+ {\r
+ self_rect = new Rectangle(wid, hei);\r
+ initialize__(wid, hei);\r
+ }\r
+ public Image(double wid, double hei)\r
+ {\r
+ self_rect = new Rectangle(Math.round(wid), Math.round(hei));\r
+ initialize__((int)Math.round(wid), (int)Math.round(hei));\r
+ }\r
+\r
+ public Image set(int wid, int hei)\r
+ {\r
+ self_rect = new Rectangle(wid, hei);\r
+ initialize__(wid, hei);\r
+ return this;\r
+ }\r
+ public Image set(double wid, double hei)\r
+ {\r
+ self_rect = new Rectangle(Math.round(wid), Math.round(hei));\r
+ initialize__((int)Math.round(wid), (int)Math.round(hei));\r
+ return this;\r
+ }\r
+\r
+ public Figure shift(Point p)\r
+ {\r
+ datum = datum + p;\r
+ return this;\r
+ }\r
+ public Figure centering(Point p)\r
+ {\r
+ datum = new Point( p.x - width / 2.0, p.y - height / 2.0);\r
+ return this;\r
+ }\r
+ public Image move_to(Point p) { datum = p; return this; }\r
+ public Image move_to(double x, double y, double z) { datum = new Point(x, y, z); return this; }\r
+ public Image locate(Point p) { datum = p; return this; }\r
+ public Image locate(double x, double y, double z) { datum = new Point(x, y, z); return this; }\r
+\r
+ public void pix(int x, int y, Color col)\r
+ {\r
+ buffer.SetPixel(x, y, col);\r
+ }\r
+\r
+ public void release()\r
+ {\r
+ }\r
+\r
+ public void cache(bool on_off = true)\r
+ {\r
+ }\r
+\r
+ public void alpha(int x, int y, double a)\r
+ {\r
+ buffer.SetPixel(x, y, (byte)(a*255), buffer.GetPixel(x, y));\r
+ }\r
+\r
+ public void clear(Color col)\r
+ {\r
+ for (int y = 0; y < height; y++)\r
+ {\r
+ for (int x = 0; x < width; x++)\r
+ {\r
+ pix(x, y, col);\r
+ }\r
+ }\r
+ }\r
+\r
+\r
+ public void field(System.Func<int, int, System.Windows.Media.Color> func)\r
+ {\r
+ field__(func);\r
+ }\r
+ public void field(System.Func<int, int, System.Windows.Media.Color, System.Windows.Media.Color> func)\r
+ {\r
+ field__(func);\r
+ }\r
+ public void each(System.Func<int, int, System.Windows.Media.Color> func)\r
+ {\r
+ field__(func);\r
+ }\r
+ public void each(System.Func<int, int, System.Windows.Media.Color, System.Windows.Media.Color> func)\r
+ {\r
+ field__(func);\r
+ }\r
+\r
+ public void load(string uri)\r
+ {\r
+ load__(uri);\r
+ }\r
+\r
+ public void draw()\r
+ {\r
+ Main.drawable.image(this);\r
+ }\r
+\r
+\r
+ public double width { get { return self_rect.width; } }\r
+ public double height { get { return self_rect.height; } }\r
+ public Point center { get { return new Point(width/2.0, height/2.0); } }\r
+ public double getWidth() { return width; }\r
+ public double getHeight() { return height; }\r
+ public Point getCenter() { return center; }\r
+ public double getHcenter() { return width / 2.0; }\r
+ public double getVcenter() { return height / 2.0; }\r
+\r
+ public double left { get { return datum.x; } }\r
+ public double right { get { return datum.x + width; } }\r
+ public double top { get { return datum.y; } }\r
+ public double bottom { get { return datum.y + height; } }\r
+ public double getLeft() { return left; }\r
+ public double getRight() { return right; }\r
+ public double getTop() { return top; }\r
+ public double getBottom() { return bottom; }\r
+\r
+ }\r
+\r
+\r
+}
\ No newline at end of file