re-enabled path support
authoradam <adam@megacz.com>
Thu, 15 Apr 2004 11:15:57 +0000 (11:15 +0000)
committeradam <adam@megacz.com>
Thu, 15 Apr 2004 11:15:57 +0000 (11:15 +0000)
darcs-hash:20040415111557-5007d-cd0087c4ebc132588ce68113e0a7ff9afaa488f3.gz

src/org/ibex/core/Box.java
src/org/ibex/graphics/Path.java

index c34948d..c4c9fd8 100644 (file)
@@ -126,8 +126,8 @@ public final class Box extends JSScope implements Task {
     private int contentwidth = 0;      // == max(minwidth, textwidth, sum(child.contentwidth))
     private int contentheight = 0;
 
+    private Path path = null;
     /*
-    private VectorGraphics.VectorPath path = null;
     private Affine transform = null;
     private VectorGraphics.RasterPath rpath = null;
     private Affine rtransform = null;
@@ -420,6 +420,8 @@ public final class Box extends JSScope implements Task {
             font.rasterizeGlyphs(text, buf, strokecolor, text_x, text_y, cx1, cy1, cx2, cy2);
         }
 
+        if (path != null) path.realize(Affine.translate(globalx, globaly)).stroke(buf, 1, strokecolor);
+
         for(Box b = getChild(0); b != null; b = b.nextSibling())
             b.render(globalx, globaly, cx1, cy1, cx2, cy2, buf, null);
     }
@@ -545,6 +547,7 @@ public final class Box extends JSScope implements Task {
         case "shrink":      CHECKSET_FLAG(HSHRINK | VSHRINK); RECONSTRAIN();
         case "hshrink":     CHECKSET_FLAG(HSHRINK); RECONSTRAIN();
         case "vshrink":     CHECKSET_FLAG(VSHRINK); RECONSTRAIN();
+        case "path":        path = Path.parse(toString(value)); DIRTY;
         case "width":       setWidth(toInt(value), toInt(value));
         case "height":      setHeight(toInt(value), toInt(value));
         case "maxwidth":    setWidth(minwidth, toInt(value));
index 71063a2..7c0fd40 100644 (file)
@@ -36,6 +36,7 @@ public class Path {
     static final byte TYPE_CUBIC = 3;
     static final byte TYPE_QUADRADIC = 4;
 
+    public static Path parse(String s) { return Tokenizer.parse(s); }
     public static class Tokenizer {
         // FIXME: check array bounds exception for improperly terminated string
         String s;
@@ -534,6 +535,4 @@ public class Path {
             return ret;
         }
     }
-
-
 }