massive reworking of Box.java
[org.ibex.core.git] / src / org / ibex / graphics / Polygon.java
index a5221c7..8dc4bfd 100644 (file)
@@ -100,12 +100,13 @@ public final class Polygon {
     public void xor(Polygon p2) { clip(GPC_XOR, this, p2); }\r
     public void subtract(Polygon p2) { clip(GPC_DIFF, this, p2); }\r
     private static Polygon rectclipper = new Polygon();\r
-    public void addrect(float x1, float y1, float x2, float y2, Affine a) {\r
+    public Polygon addrect(float x1, float y1, float x2, float y2, Affine a) {\r
         add(a.multiply_px(x1, y1), a.multiply_py(x1, y1));\r
         add(a.multiply_px(x2, y1), a.multiply_py(x2, y1));\r
         add(a.multiply_px(x2, y2), a.multiply_py(x2, y2));\r
         add(a.multiply_px(x1, y2), a.multiply_py(x1, y2));\r
         closepath();\r
+        return this;\r
     }\r
     public void clipto(float x1, float y1, float x2, float y2, Affine a) {\r
         rectclipper.clear();\r
@@ -170,7 +171,7 @@ public final class Polygon {
             add(a.multiply_px(x, y), a.multiply_py(x, y));\r
         }\r
     }\r
-    public void transform(Affine a) {\r
+    public Polygon transform(Affine a) {\r
         maxx = Float.MIN_VALUE; maxy = Float.MIN_VALUE; minx = Float.MAX_VALUE; miny = Float.MIN_VALUE;\r
         int s = 0;\r
         for(int i=0; i<numvertices; i++) {\r
@@ -188,6 +189,7 @@ public final class Polygon {
             if (y > maxy) maxy = y;\r
             if (y < miny) miny = y;\r
         }\r
+        return this;\r
     }\r
 \r
     public void stroke(PixelBuffer buf, int color) {\r