2 using System.Windows;
\r
3 using System.Windows.Controls;
\r
4 using System.Windows.Documents;
\r
5 using System.Windows.Input;
\r
6 using System.Windows.Media;
\r
7 using System.Windows.Media.Animation;
\r
8 using System.Windows.Media.Imaging;
\r
9 using System.Windows.Shapes;
\r
12 namespace Psychlops{
\r
15 public partial class Image : Internal.PrimitiveFigure
\r
17 public WriteableBitmap buffer;
\r
18 public Point datum { get; set; }
\r
19 public Point getDatum() { return datum; }
\r
20 public Point setDatum(Point p) { datum = p; return datum; }
\r
21 public Rectangle self_rect;
\r
23 public Image(int wid, int hei)
\r
25 initialize__(wid, hei);
\r
26 self_rect = new Rectangle(wid, hei);
\r
29 /*public Image shift(double x, double y)
\r
35 public Figure shift(Point p)
\r
40 public Figure centering(Point p)
\r
42 datum = new Point( p.x - width / 2.0, p.y - height / 2.0);
\r
45 public Image move_to(Point p) { datum = p; return this; }
\r
46 public Image move_to(double x, double y, double z) { datum = new Point(x, y, z); return this; }
\r
47 public Image locate(Point p) { datum = p; return this; }
\r
48 public Image locate(double x, double y, double z) { datum = new Point(x, y, z); return this; }
\r
50 public void pix(int x, int y, Color col)
\r
52 buffer.SetPixel(x, y, col);
\r
56 public void field(System.Func<int, int, System.Windows.Media.Color> func)
\r
59 //buffer.ForEach(func);
\r
61 public void field(System.Func<int, int, System.Windows.Media.Color, System.Windows.Media.Color> func)
\r
64 //buffer.ForEach(func);
\r
66 public void each(System.Func<int, int, System.Windows.Media.Color> func)
\r
69 //buffer.ForEach(func);
\r
71 public void each(System.Func<int, int, System.Windows.Media.Color, System.Windows.Media.Color> func)
\r
74 //buffer.ForEach(func);
\r
79 Main.drawable.image(this);
\r
83 public double width { get { return self_rect.width; } }
\r
84 public double height { get { return self_rect.height; } }
\r
85 public Point center { get { return new Point(width/2.0, height/2.0); } }
\r
86 public double getWidth() { return width; }
\r
87 public double getHeight() { return height; }
\r
88 public Point getCenter() { return center; }
\r
89 public double getHcenter() { return width / 2.0; }
\r
90 public double getVcenter() { return height / 2.0; }
\r