OSDN Git Service

12313
[psychlops/silverlight.git] / dev4 / psychlops / core / graphic / image.cs
index c56ea61..64f3c1e 100644 (file)
@@ -38,6 +38,11 @@ namespace Psychlops{
                        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
@@ -45,6 +50,12 @@ namespace Psychlops{
                        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
@@ -66,6 +77,30 @@ namespace Psychlops{
                        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
@@ -104,6 +139,15 @@ namespace Psychlops{
                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