// Rendering Properties ///////////////////////////////////////////////////////////
- //private SVG.VP path = null;
+ private VectorGraphics.VectorPath path = null;
//private SVG.Paint fill = null;
//private SVG.Paint stroke = null;
// Instance Methods /////////////////////////////////////////////////////////////////////
/** Adds the intersection of (x,y,w,h) and the node's current actual geometry to the Surface's dirty list */
- public final void dirty() { dirty(0, 0, width, height); }
+ public final void dirty() {
+ if ((flags & NOCLIP_FLAG) != 0 && parent != null) parent.dirty();
+ else dirty(0, 0, width, height);
+ }
public final void dirty(int x, int y, int w, int h) {
for(Box cur = this; cur != null; cur = cur.parent) {
if ((flags & NOCLIP_FLAG) == 0) {
if (numChildren() == 0) {
contentwidth = max(textwidth + 2 * hpad, minwidth);
contentheight = max(textheight + 2 * vpad, minheight);
+ if (path != null) {
+ contentwidth = max(contentwidth, path.boundingBoxWidth());
+ contentheight = max(contentheight, path.boundingBoxHeight());
+ }
return;
}
for(int col=0; col<numCols; col++) contentwidth += colWidth[col];
contentwidth = max(textwidth + 2 * hpad, contentwidth);
contentwidth = bound(minwidth, contentwidth, maxwidth);
+ if (path != null) {
+ contentwidth = max(contentwidth, path.boundingBoxWidth());
+ contentheight = max(contentheight, path.boundingBoxHeight());
+ }
//#end
}
// Rendering Pipeline /////////////////////////////////////////////////////////////////////
/** Renders self and children within the specified region. All rendering operations are clipped to xIn,yIn,wIn,hIn */
- void render(int parentx, int parenty, int clipx, int clipy, int clipw, int cliph, PixelBuffer buf) {
+ void render(int parentx, int parenty, int clipx, int clipy, int clipw, int cliph, PixelBuffer buf, VectorGraphics.Affine a) {
if (Surface.abort || (flags & INVISIBLE_FLAG) != 0) return;
int globalx = parentx + (parent == null ? 0 : x);
int globaly = parenty + (parent == null ? 0 : y);
if (text != null && !text.equals(""))
renderText(globalx, globaly, clipx, clipy, clipw, cliph, buf);
+ if (path != null) {
+ VectorGraphics.RasterPath rp = path.realize(a);
+ if ((strokecolor & 0xff000000) != 0) rp.stroke(buf, 1, strokecolor);
+ if ((fillcolor & 0xff000000) != 0) rp.fill(buf, new VectorGraphics.SingleColorPaint(fillcolor));
+ }
+
// now subtract the pad region from the clip region before proceeding
if ((flags & NOCLIP_FLAG) == 0) {
clipw = min(max(clipx, globalx + hpad) + clipw, globalx + width - hpad) - clipx;
clipy = max(clipy, globaly + vpad);
}
- for(Box b = getChild(0); b != null; b = b.nextSibling())
- b.render(globalx, globaly, clipx, clipy, clipw, cliph, buf);
+ for(Box b = getChild(0); b != null; b = b.nextSibling()) {
+ a.translate(b.x, b.y);
+ b.render(globalx, globaly, clipx, clipy, clipw, cliph, buf, a);
+ a.translate(-1 * b.x, -1 * b.y);
+ }
}
void renderStretchedImage(int globalx, int globaly, int clipx, int clipy, int clipw, int cliph, PixelBuffer buf) {
b.dirty();
} });
+ specialBoxProperties.put("path", new SpecialBoxProperty() {
+ public Object get(Box b) { throw new JS.Exn("cannot read from the path property"); }
+ public void put(Box b, Object value) {
+ String t = value == null ? "null" : value.toString();
+ b.path = value == null ? null : VectorGraphics.parseVectorPath(value.toString());
+ MARK_FOR_REFLOW_b;
+ b.dirty();
+ } });
+
specialBoxProperties.put("font", new SpecialBoxProperty() {
public Object get(Box b) { return b.font; }
public void put(Box b, Object value) {