org.apache.poi.hssf.usermodel
Class HSSFPicture

java.lang.Object
  extended by org.apache.poi.hssf.usermodel.HSSFShape
      extended by org.apache.poi.hssf.usermodel.HSSFSimpleShape
          extended by org.apache.poi.hssf.usermodel.HSSFPicture
All Implemented Interfaces:
Picture
Direct Known Subclasses:
HSSFObjectData

public class HSSFPicture
extends HSSFSimpleShape
implements Picture

Represents a escher picture. Eg. A GIF, JPEG etc...

Author:
Glen Stampoultzis, Yegor Kozlov (yegor at apache.org)

Field Summary
static int PICTURE_TYPE_DIB
           
static int PICTURE_TYPE_EMF
           
static int PICTURE_TYPE_JPEG
           
static int PICTURE_TYPE_PICT
           
static int PICTURE_TYPE_PNG
           
static int PICTURE_TYPE_WMF
           
 
Fields inherited from class org.apache.poi.hssf.usermodel.HSSFSimpleShape
OBJECT_TYPE_ARC, OBJECT_TYPE_COMBO_BOX, OBJECT_TYPE_COMMENT, OBJECT_TYPE_LINE, OBJECT_TYPE_MICROSOFT_OFFICE_DRAWING, OBJECT_TYPE_OVAL, OBJECT_TYPE_PICTURE, OBJECT_TYPE_RECTANGLE, WRAP_BY_POINTS, WRAP_NONE, WRAP_SQUARE
 
Fields inherited from class org.apache.poi.hssf.usermodel.HSSFShape
FILL__FILLCOLOR_DEFAULT, LINESTYLE__COLOR_DEFAULT, LINESTYLE_DASHDOTDOTSYS, LINESTYLE_DASHDOTGEL, LINESTYLE_DASHDOTSYS, LINESTYLE_DASHGEL, LINESTYLE_DASHSYS, LINESTYLE_DEFAULT, LINESTYLE_DOTGEL, LINESTYLE_DOTSYS, LINESTYLE_LONGDASHDOTDOTGEL, LINESTYLE_LONGDASHDOTGEL, LINESTYLE_LONGDASHGEL, LINESTYLE_NONE, LINESTYLE_SOLID, LINEWIDTH_DEFAULT, LINEWIDTH_ONE_PT, NO_FILL_DEFAULT, NO_FILLHITTEST_FALSE, NO_FILLHITTEST_TRUE
 
Constructor Summary
HSSFPicture(EscherContainerRecord spContainer, ObjRecord objRecord)
           
HSSFPicture(HSSFShape parent, HSSFAnchor anchor)
          Constructs a picture object.
 
Method Summary
protected  HSSFShape cloneShape()
           
protected  EscherContainerRecord createSpContainer()
           
 java.lang.String getFileName()
          The color applied to the lines of this shape.
 java.awt.Dimension getImageDimension()
          Return the dimension of this image
 HSSFPictureData getPictureData()
          Return picture data for this shape
 int getPictureIndex()
           
 HSSFClientAnchor getPreferredSize()
          Calculate the preferred size for this picture.
 HSSFClientAnchor getPreferredSize(double scale)
          Calculate the preferred size for this picture.
 void resize()
          Reset the image to the original size.
 void resize(double scale)
          Resize the image
 void setFileName(java.lang.String data)
           
 void setPictureIndex(int pictureIndex)
           
 void setShapeType(int shapeType)
           
 
Methods inherited from class org.apache.poi.hssf.usermodel.HSSFSimpleShape
afterRemove, createObjRecord, createTextObjRecord, getShapeType, getString, getTextObjectRecord, getWrapText, setString, setWrapText
 
Methods inherited from class org.apache.poi.hssf.usermodel.HSSFShape
countOfAllChildren, getAnchor, getEscherContainer, getFillColor, getLineStyle, getLineStyleColor, getLineWidth, getObjRecord, getOptRecord, getParent, getPatriarch, getRotationDegree, isFlipHorizontal, isFlipVertical, isNoFill, setAnchor, setFillColor, setFillColor, setFlipHorizontal, setFlipVertical, setLineStyle, setLineStyleColor, setLineStyleColor, setLineWidth, setNoFill, setParent, setPatriarch, setPropertyValue, setRotationDegree
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PICTURE_TYPE_EMF

public static final int PICTURE_TYPE_EMF
See Also:
Constant Field Values

PICTURE_TYPE_WMF

public static final int PICTURE_TYPE_WMF
See Also:
Constant Field Values

PICTURE_TYPE_PICT

public static final int PICTURE_TYPE_PICT
See Also:
Constant Field Values

PICTURE_TYPE_JPEG

public static final int PICTURE_TYPE_JPEG
See Also:
Constant Field Values

PICTURE_TYPE_PNG

public static final int PICTURE_TYPE_PNG
See Also:
Constant Field Values

PICTURE_TYPE_DIB

public static final int PICTURE_TYPE_DIB
See Also:
Constant Field Values
Constructor Detail

HSSFPicture

public HSSFPicture(EscherContainerRecord spContainer,
                   ObjRecord objRecord)

HSSFPicture

public HSSFPicture(HSSFShape parent,
                   HSSFAnchor anchor)
Constructs a picture object.

Method Detail

getPictureIndex

public int getPictureIndex()

setPictureIndex

public void setPictureIndex(int pictureIndex)

createSpContainer

protected EscherContainerRecord createSpContainer()
Overrides:
createSpContainer in class HSSFSimpleShape

resize

public void resize(double scale)
Resize the image

Please note, that this method works correctly only for workbooks with default font size (Arial 10pt for .xls). If the default font is changed the resized image can be streched vertically or horizontally.

Specified by:
resize in interface Picture
Parameters:
scale - the amount by which image dimensions are multiplied relative to the original size. resize(1.0) sets the original size, resize(0.5) resize to 50% of the original, resize(2.0) resizes to 200% of the original.

resize

public void resize()
Reset the image to the original size.

Please note, that this method works correctly only for workbooks with default font size (Arial 10pt for .xls). If the default font is changed the resized image can be streched vertically or horizontally.

Specified by:
resize in interface Picture

getPreferredSize

public HSSFClientAnchor getPreferredSize()
Calculate the preferred size for this picture.

Specified by:
getPreferredSize in interface Picture
Returns:
HSSFClientAnchor with the preferred size for this image
Since:
POI 3.0.2

getPreferredSize

public HSSFClientAnchor getPreferredSize(double scale)
Calculate the preferred size for this picture.

Parameters:
scale - the amount by which image dimensions are multiplied relative to the original size.
Returns:
HSSFClientAnchor with the preferred size for this image
Since:
POI 3.0.2

getImageDimension

public java.awt.Dimension getImageDimension()
Return the dimension of this image

Returns:
image dimension

getPictureData

public HSSFPictureData getPictureData()
Return picture data for this shape

Specified by:
getPictureData in interface Picture
Returns:
picture data for this shape

getFileName

public java.lang.String getFileName()
The color applied to the lines of this shape.


setFileName

public void setFileName(java.lang.String data)

setShapeType

public void setShapeType(int shapeType)
Overrides:
setShapeType in class HSSFSimpleShape
Parameters:
shapeType - - shapeType
See Also:
HSSFShapeTypes

cloneShape

protected HSSFShape cloneShape()
Overrides:
cloneShape in class HSSFSimpleShape


Copyright 2013 The Apache Software Foundation or its licensors, as applicable.