Fillpublic class Fill extends Object Represents functionality provided by the 'Fill Effects' dialog in PowerPoint. |
Fields Summary |
---|
public static final int | FILL_SOLIDFill with a solid color | public static final int | FILL_PATTERNFill with a pattern (bitmap) | public static final int | FILL_TEXTUREA texture (pattern with its own color map) | public static final int | FILL_PICTURECenter a picture in the shape | public static final int | FILL_SHADEShade from start to end points | public static final int | FILL_SHADE_CENTERShade from bounding rectangle to end point | public static final int | FILL_SHADE_SHAPEShade from shape outline to end point | public static final int | FILL_SHADE_SCALESimilar to FILL_SHADE, but the fill angle
is additionally scaled by the aspect ratio of
the shape. If shape is square, it is the same as FILL_SHADE | public static final int | FILL_SHADE_TITLEshade to title | public static final int | FILL_BACKGROUNDUse the background fill color/pattern | protected Shape | shapeThe shape this background applies to |
Constructors Summary |
---|
public Fill(Shape shape)Construct a Fill object for a shape.
Fill information will be read from shape's escher properties.
this.shape = shape;
|
Methods Summary |
---|
public java.awt.Color | getBackgroundColor()Background color
EscherOptRecord opt = (EscherOptRecord)Shape.getEscherChild(shape.getSpContainer(), EscherOptRecord.RECORD_ID);
EscherSimpleProperty p1 = (EscherSimpleProperty)Shape.getEscherProperty(opt, EscherProperties.FILL__FILLBACKCOLOR);
EscherSimpleProperty p2 = (EscherSimpleProperty)Shape.getEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST);
int p2val = p2 == null ? 0 : p2.getPropertyValue();
Color clr = null;
if (p1 != null && (p2val & 0x10) != 0){
int rgb = p1.getPropertyValue();
clr = shape.getColor(rgb);
}
return clr;
| public int | getFillType()Returns fill type.
Must be one of the FILL_* constants defined in this class.
EscherOptRecord opt = (EscherOptRecord)Shape.getEscherChild(shape.getSpContainer(), EscherOptRecord.RECORD_ID);
EscherSimpleProperty prop = (EscherSimpleProperty)Shape.getEscherProperty(opt, EscherProperties.FILL__FILLTYPE);
return prop == null ? FILL_SOLID : prop.getPropertyValue();
| public java.awt.Color | getForegroundColor()Foreground color
EscherOptRecord opt = (EscherOptRecord)Shape.getEscherChild(shape.getSpContainer(), EscherOptRecord.RECORD_ID);
EscherSimpleProperty p1 = (EscherSimpleProperty)Shape.getEscherProperty(opt, EscherProperties.FILL__FILLCOLOR);
EscherSimpleProperty p2 = (EscherSimpleProperty)Shape.getEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST);
int p2val = p2 == null ? 0 : p2.getPropertyValue();
Color clr = null;
if (p1 != null && (p2val & 0x10) != 0){
int rgb = p1.getPropertyValue();
clr = shape.getColor(rgb);
}
return clr;
| public org.apache.poi.hslf.usermodel.PictureData | getPictureData()PictureData object used in a texture, pattern of picture fill.
EscherOptRecord opt = (EscherOptRecord)Shape.getEscherChild(shape.getSpContainer(), EscherOptRecord.RECORD_ID);
EscherSimpleProperty p = (EscherSimpleProperty)Shape.getEscherProperty(opt, EscherProperties.FILL__PATTERNTEXTURE);
if (p == null) return null;
SlideShow ppt = shape.getSheet().getSlideShow();
PictureData[] pict = ppt.getPictureData();
Document doc = ppt.getDocumentRecord();
EscherContainerRecord dggContainer = doc.getPPDrawingGroup().getDggContainer();
EscherContainerRecord bstore = (EscherContainerRecord)Shape.getEscherChild(dggContainer, EscherContainerRecord.BSTORE_CONTAINER);
java.util.List lst = bstore.getChildRecords();
int idx = p.getPropertyValue();
EscherBSERecord bse = (EscherBSERecord)lst.get(idx);
for ( int i = 0; i < pict.length; i++ ) {
if (pict[i].getOffset() == bse.getOffset()){
return pict[i];
}
}
throw new HSLFException("Picture data not found: \n" +
" bse: " + bse + " at " + bse.getOffset() );
| public void | setBackgroundColor(java.awt.Color color)Background color
EscherOptRecord opt = (EscherOptRecord)Shape.getEscherChild(shape.getSpContainer(), EscherOptRecord.RECORD_ID);
if (color == null) {
Shape.setEscherProperty(opt, EscherProperties.FILL__FILLBACKCOLOR, -1);
}
else {
int rgb = new Color(color.getBlue(), color.getGreen(), color.getRed(), 0).getRGB();
Shape.setEscherProperty(opt, EscherProperties.FILL__FILLBACKCOLOR, rgb);
}
| public void | setFillType(int type)Sets fill type.
Must be one of the FILL_* constants defined in this class.
EscherOptRecord opt = (EscherOptRecord)Shape.getEscherChild(shape.getSpContainer(), EscherOptRecord.RECORD_ID);
Shape.setEscherProperty(opt, EscherProperties.FILL__FILLTYPE, type);
| public void | setForegroundColor(java.awt.Color color)Foreground color
EscherOptRecord opt = (EscherOptRecord)Shape.getEscherChild(shape.getSpContainer(), EscherOptRecord.RECORD_ID);
if (color == null) {
Shape.setEscherProperty(opt, EscherProperties.FILL__FILLCOLOR, -1);
}
else {
int rgb = new Color(color.getBlue(), color.getGreen(), color.getRed(), 0).getRGB();
Shape.setEscherProperty(opt, EscherProperties.FILL__FILLCOLOR, rgb);
}
| public void | setPictureData(int idx)Assign picture used to fill the underlying shape.
EscherOptRecord opt = (EscherOptRecord)Shape.getEscherChild(shape.getSpContainer(), EscherOptRecord.RECORD_ID);
Shape.setEscherProperty(opt, (short)(EscherProperties.FILL__PATTERNTEXTURE + 0x4000), idx);
|
|