Ejemplo n.º 1
0
 /**
  * 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);
 }
Ejemplo n.º 2
0
    public static Shape CreateSimpeShape(EscherContainerRecord spContainer, Shape parent){
        Shape shape = null;
        EscherSpRecord spRecord = spContainer.GetChildById(EscherSpRecord.RECORD_ID);

        int type = spRecord.GetOptions() >> 4;
        switch (type){
            case ShapeTypes.TextBox:
                shape = new TextBox(spContainer, parent);
                break;
            case ShapeTypes.HostControl:
            case ShapeTypes.PictureFrame: {
                InteractiveInfo info = (InteractiveInfo)getClientDataRecord(spContainer, RecordTypes.InteractiveInfo.typeID);
                OEShapeAtom oes = (OEShapeAtom)getClientDataRecord(spContainer, RecordTypes.OEShapeAtom.typeID);
                if(info != null && info.GetInteractiveInfoAtom() != null){
                    switch(info.GetInteractiveInfoAtom().GetAction()){
                        case InteractiveInfoAtom.ACTION_OLE:
                            shape = new OLEShape(spContainer, parent);
                            break;
                        case InteractiveInfoAtom.ACTION_MEDIA:
                            shape = new MovieShape(spContainer, parent);
                            break;
                        default:
                            break;
                    }
                } else if (oes != null){
                    shape = new OLEShape(spContainer, parent);
                }

                if(shape == null) shape = new Picture(spContainer, parent);
                break;
            }
            case ShapeTypes.Line:
                shape = new Line(spContainer, parent);
                break;
            case ShapeTypes.NotPrimitive: {
                EscherOptRecord opt = (EscherOptRecord)Shape.GetEscherChild(spContainer, EscherOptRecord.RECORD_ID);
                EscherProperty prop = Shape.GetEscherProperty(opt, EscherProperties.GEOMETRY__VERTICES);
                if(prop != null)
                    shape = new Freeform(spContainer, parent);
                else {

                    logger.log(POILogger.WARN, "Creating AutoShape for a NotPrimitive shape");
                    shape = new AutoShape(spContainer, parent);
                }
                break;
            }
            default:
                shape = new AutoShape(spContainer, parent);
                break;
        }
        return shape;

    }
Ejemplo n.º 3
0
 /**
  * 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);
 }