2003/09/27 07:08:02
[org.ibex.core.git] / src / org / xwt / VectorGraphics.java
index fc19ba4..e028caa 100644 (file)
@@ -20,7 +20,7 @@ import java.util.*;
         - mitre    (hard)
         - bevel    (easy)
         - bump     (easy, but requires 'round' Paint)
-    - subtree sharing? otherwise the memory consumption might be outrageous...  clone="" attribute?
+    - subtree sharing? otherwise the memory consumption might be outrageous... clone="" attribute?
     - better clipping
         - intersect clip regions (linearity)
         - clip on trapezoids, not pixels
@@ -191,6 +191,20 @@ public final class VectorGraphics {
        static final byte TYPE_CUBIC = 3;
        static final byte TYPE_QUADRADIC = 4;
 
+        // FEATURE: make this faster and cache it; also deal with negative coordinates
+        public int boundingBoxWidth() {
+            int ret = 0;
+            for(int i=0; i<numvertices; i++) ret = Math.max(ret, (int)Math.ceil(x[i]));
+            return ret;
+        }
+
+        // FEATURE: make this faster and cache it; also deal with negative coordinates
+        public int boundingBoxHeight() {
+            int ret = 0;
+            for(int i=0; i<numvertices; i++) ret = Math.max(ret, (int)Math.ceil(y[i]));
+            return ret;
+        }
+
         /** Creates a concrete vector path transformed through the given matrix. */
        public RasterPath realize(Affine a) {