From ed8c8e77f35b69a9084dc5b7327ffb5cbf406cff Mon Sep 17 00:00:00 2001 From: adam Date: Thu, 15 Apr 2004 11:15:57 +0000 Subject: [PATCH] re-enabled path support darcs-hash:20040415111557-5007d-cd0087c4ebc132588ce68113e0a7ff9afaa488f3.gz --- src/org/ibex/core/Box.java | 5 ++++- src/org/ibex/graphics/Path.java | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/org/ibex/core/Box.java b/src/org/ibex/core/Box.java index c34948d..c4c9fd8 100644 --- a/src/org/ibex/core/Box.java +++ b/src/org/ibex/core/Box.java @@ -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)); diff --git a/src/org/ibex/graphics/Path.java b/src/org/ibex/graphics/Path.java index 71063a2..7c0fd40 100644 --- a/src/org/ibex/graphics/Path.java +++ b/src/org/ibex/graphics/Path.java @@ -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; } } - - } -- 1.7.10.4