/** * Fills the interior of a <code>Shape</code> using the settings of the * <code>Graphics2D</code> context. The rendering attributes applied * include the <code>Clip</code>, <code>Transform</code>, * <code>Paint</code>, and <code>Composite</code>. * @param shape the <code>Shape</code> to be filled * @see #setPaint * @see java.awt.Graphics#setColor * @see #_transform * @see #setTransform * @see #setComposite * @see #clip * @see #setClip */ public void fill(Shape shape){ GeneralPath path = new GeneralPath(_transform.createTransformedShape(shape)); Freeform p = new Freeform(_group); p.setPath(path); applyPaint(p); p.setLineColor(null); //Fills must be "No Line" _group.addShape(p); }
/** * Create a new Freeform. This constructor is used when a new shape is created. * * @param parent the parent of this Shape. For example, if this text box is a cell * in a table then the parent is Table. */ public Freeform(Shape parent){ super(null, parent); _escherContainer = createSpContainer(ShapeTypes.NotPrimitive, parent instanceof ShapeGroup); }
public java.awt.Shape getOutline(){ GeneralPath path = getPath(); Rectangle2D anchor = getAnchor2D(); Rectangle2D bounds = path.getBounds2D(); AffineTransform at = new AffineTransform(); at.translate(anchor.getX(), anchor.getY()); at.scale( anchor.getWidth()/bounds.getWidth(), anchor.getHeight()/bounds.getHeight() ); return at.createTransformedShape(path); } }
/** * Strokes the outline of a <code>Shape</code> using the settings of the * current <code>Graphics2D</code> context. The rendering attributes * applied include the <code>Clip</code>, <code>Transform</code>, * <code>Paint</code>, <code>Composite</code> and * <code>Stroke</code> attributes. * @param shape the <code>Shape</code> to be rendered * @see #setStroke * @see #setPaint * @see java.awt.Graphics#setColor * @see #_transform * @see #setTransform * @see #clip * @see #setClip * @see #setComposite */ public void draw(Shape shape){ GeneralPath path = new GeneralPath(_transform.createTransformedShape(shape)); Freeform p = new Freeform(_group); p.setPath(path); p.getFill().setForegroundColor(null); applyStroke(p); _group.addShape(p); }
segInfo.add(new byte[]{0x00, (byte)0x80}); EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__SHAPEPATH, 0x4)); setAnchor(bounds);
EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID); opt.addEscherProperty(new EscherSimpleProperty(EscherProperties.GEOMETRY__SHAPEPATH, 0x4)); EscherArrayProperty verticesProp = (EscherArrayProperty)getEscherProperty(opt, (short)(EscherProperties.GEOMETRY__VERTICES + 0x4000)); if(verticesProp == null) verticesProp = (EscherArrayProperty)getEscherProperty(opt, EscherProperties.GEOMETRY__VERTICES); EscherArrayProperty segmentsProp = (EscherArrayProperty)getEscherProperty(opt, (short)(EscherProperties.GEOMETRY__SEGMENTINFO + 0x4000)); if(segmentsProp == null) segmentsProp = (EscherArrayProperty)getEscherProperty(opt, EscherProperties.GEOMETRY__SEGMENTINFO);
EscherProperty prop = Shape.getEscherProperty(opt, EscherProperties.GEOMETRY__VERTICES); if(prop != null) shape = new Freeform(spContainer, parent); else {