public float[] getStopFractions() { if (stopRef != null) { Gradient grad = (Gradient)diagram.getUniverse().getElement(stopRef); return grad.getStopFractions(); } if (stopFractions != null) return stopFractions; stopFractions = new float[stops.size()]; int idx = 0; for (Iterator it = stops.iterator(); it.hasNext();) { Stop stop = (Stop)it.next(); float val = stop.offset; if (idx != 0 && val < stopFractions[idx - 1]) val = stopFractions[idx - 1]; stopFractions[idx++] = val; } return stopFractions; }
public Color[] getStopColors() { if (stopRef != null) { Gradient grad = (Gradient)diagram.getUniverse().getElement(stopRef); return grad.getStopColors(); } if (stopColors != null) return stopColors; stopColors = new Color[stops.size()]; int idx = 0; for (Iterator it = stops.iterator(); it.hasNext();) { Stop stop = (Stop)it.next(); int stopColorVal = stop.color.getRGB(); Color stopColor = new Color((stopColorVal >> 16) & 0xff, (stopColorVal >> 8) & 0xff, stopColorVal & 0xff, clamp((int)(stop.opacity * 255), 0, 255)); stopColors[idx++] = stopColor; } return stopColors; }
public float[] getStopFractions() { if (stopRef != null) { Gradient grad = (Gradient) diagram.getUniverse().getElement(stopRef); return grad.getStopFractions(); } if (stopFractions != null) { return stopFractions; } stopFractions = new float[stops.size()]; int idx = 0; for (Iterator it = stops.iterator(); it.hasNext();) { Stop stop = (Stop) it.next(); float val = stop.offset; if (idx != 0 && val < stopFractions[idx - 1]) { val = stopFractions[idx - 1]; } stopFractions[idx++] = val; } return stopFractions; }
public Color[] getStopColors() { if (stopRef != null) { Gradient grad = (Gradient) diagram.getUniverse().getElement(stopRef); return grad.getStopColors(); } if (stopColors != null) { return stopColors; } stopColors = new Color[stops.size()]; int idx = 0; for (Iterator it = stops.iterator(); it.hasNext();) { Stop stop = (Stop) it.next(); int stopColorVal = stop.color.getRGB(); Color stopColor = new Color((stopColorVal >> 16) & 0xff, (stopColorVal >> 8) & 0xff, stopColorVal & 0xff, clamp((int) (stop.opacity * 255), 0, 255)); stopColors[idx++] = stopColor; } return stopColors; }
@Override public Shape getShape() { SVGElement ref = diagram.getUniverse().getElement(href); if (ref instanceof ShapeElement) { Shape shape = ((ShapeElement) ref).getShape(); shape = refXform.createTransformedShape(shape); shape = shapeToParent(shape); return shape; } return null; }
public Shape getShape() { SVGElement ref = diagram.getUniverse().getElement(href); if (ref instanceof ShapeElement) { Shape shape = ((ShapeElement) ref).getShape(); shape = refXform.createTransformedShape(shape); shape = shapeToParent(shape); return shape; } return null; }
@Override public Shape getShape() { SVGElement ref = diagram.getUniverse().getElement(href); if (ref instanceof ShapeElement) { Shape shape = ((ShapeElement) ref).getShape(); shape = refXform.createTransformedShape(shape); shape = shapeToParent(shape); return shape; } return null; }
public Color[] getStopColors() { if (stopRef != null) { Gradient grad = (Gradient) diagram.getUniverse().getElement(stopRef); return grad.getStopColors(); } if (stopColors != null) { return stopColors; } buildStops(); return stopColors; }
public float[] getStopFractions() { if (stopRef != null) { Gradient grad = (Gradient) diagram.getUniverse().getElement(stopRef); return grad.getStopFractions(); } if (stopFractions != null) { return stopFractions; } buildStops(); return stopFractions; }
public Rectangle2D getBoundingBox() throws SVGException { SVGElement ref = diagram.getUniverse().getElement(href); if (ref instanceof ShapeElement) { ShapeElement shapeEle = (ShapeElement) ref; shapeEle.pushParentContext(this); Rectangle2D bounds = shapeEle.getBoundingBox(); shapeEle.popParentContext(); bounds = refXform.createTransformedShape(bounds).getBounds2D(); bounds = boundsToParent(bounds); return bounds; } return null; }
public float[] getStopFractions() { if (stopRef != null) { Gradient grad = (Gradient) diagram.getUniverse().getElement(stopRef); return grad.getStopFractions(); } if (stopFractions != null) { return stopFractions; } buildStops(); return stopFractions; }
public Color[] getStopColors() { if (stopRef != null) { Gradient grad = (Gradient) diagram.getUniverse().getElement(stopRef); return grad.getStopColors(); } if (stopColors != null) { return stopColors; } buildStops(); return stopColors; }
@Override public Rectangle2D getBoundingBox() throws SVGException { SVGElement ref = diagram.getUniverse().getElement(href); if (ref instanceof ShapeElement) { ShapeElement shapeEle = (ShapeElement) ref; shapeEle.pushParentContext(this); Rectangle2D bounds = shapeEle.getBoundingBox(); shapeEle.popParentContext(); bounds = refXform.createTransformedShape(bounds).getBounds2D(); bounds = boundsToParent(bounds); return bounds; } return null; }
@Override public Rectangle2D getBoundingBox() throws SVGException { SVGElement ref = diagram.getUniverse().getElement(href); if (ref instanceof ShapeElement) { ShapeElement shapeEle = (ShapeElement) ref; shapeEle.pushParentContext(this); Rectangle2D bounds = shapeEle.getBoundingBox(); shapeEle.popParentContext(); bounds = refXform.createTransformedShape(bounds).getBounds2D(); bounds = boundsToParent(bounds); return bounds; } return null; }
@Override public void render(Graphics2D g) throws SVGException { beginLayer(g); //AffineTransform oldXform = g.getTransform(); AffineTransform oldXform = g.getTransform(); g.transform(refXform); SVGElement ref = diagram.getUniverse().getElement(href); if (ref == null || !(ref instanceof RenderableElement)) { return; } RenderableElement rendEle = (RenderableElement)ref; rendEle.pushParentContext(this); rendEle.render(g); rendEle.popParentContext(); g.setTransform(oldXform); finishLayer(g); }
public void render(Graphics2D g) throws SVGException { beginLayer(g); //AffineTransform oldXform = g.getTransform(); AffineTransform oldXform = g.getTransform(); g.transform(refXform); SVGElement ref = diagram.getUniverse().getElement(href); if (ref == null || !(ref instanceof RenderableElement)) { return; } RenderableElement rendEle = (RenderableElement) ref; rendEle.pushParentContext(this); rendEle.render(g); rendEle.popParentContext(); g.setTransform(oldXform); finishLayer(g); }
@Override public void render(Graphics2D g) throws SVGException { beginLayer(g); //AffineTransform oldXform = g.getTransform(); AffineTransform oldXform = g.getTransform(); g.transform(refXform); SVGElement ref = diagram.getUniverse().getElement(href); if (ref == null || !(ref instanceof RenderableElement)) { return; } RenderableElement rendEle = (RenderableElement)ref; rendEle.pushParentContext(this); rendEle.render(g); rendEle.popParentContext(); g.setTransform(oldXform); finishLayer(g); }
/** * Copies the presentation attribute into the passed one. * @return - True if attribute was read successfully */ public boolean getPres(StyleAttribute attrib) throws SVGException { String presName = attrib.getName(); //Make sure we have a coresponding presentation attribute StyleAttribute presAttr = (StyleAttribute)presAttribs.get(presName); //Copy presentation value directly attrib.setStringValue(presAttr == null ? "" : presAttr.getStringValue()); //Evalutate coresponding track, if one exists TrackBase track = trackManager.getTrack(presName, AnimationElement.AT_XML); if (track != null) { track.getValue(attrib, diagram.getUniverse().getCurTime()); return true; } //Return if we found presentation attribute if (presAttr != null) return true; return false; }
/** * Copies the presentation attribute into the passed one. * * @return - True if attribute was read successfully */ public boolean getPres(StyleAttribute attrib) throws SVGException { String presName = attrib.getName(); //Make sure we have a coresponding presentation attribute StyleAttribute presAttr = (StyleAttribute) presAttribs.get(presName); //Copy presentation value directly attrib.setStringValue(presAttr == null ? "" : presAttr.getStringValue()); //Evalutate coresponding track, if one exists TrackBase track = trackManager.getTrack(presName, AnimationElement.AT_XML); if (track != null) { track.getValue(attrib, diagram.getUniverse().getCurTime()); return true; } //Return if we found presentation attribute if (presAttr != null) { return true; } return false; }
protected void build() throws SVGException { super.build(); StyleAttribute sty = new StyleAttribute(); if (getPres(sty.setName("x"))) x = sty.getFloatValueWithUnits(); if (getPres(sty.setName("y"))) y = sty.getFloatValueWithUnits(); if (getPres(sty.setName("width"))) width = sty.getFloatValueWithUnits(); if (getPres(sty.setName("height"))) height = sty.getFloatValueWithUnits(); if (getPres(sty.setName("xlink:href"))) { URI src = sty.getURIValue(getXMLBase()); href = diagram.getUniverse().getElement(src); } //Determine use offset/scale refXform = new AffineTransform(); refXform.translate(this.x, this.y); }