org.apache.poi.hslf.model
Class Picture

java.lang.Object
  extended by org.apache.poi.hslf.model.Shape
      extended by org.apache.poi.hslf.model.SimpleShape
          extended by org.apache.poi.hslf.model.Picture

public class Picture
extends SimpleShape

Represents a picture in a PowerPoint document.

The information about an image in PowerPoint document is stored in two places:

  • EscherBSE container in the Document keeps information about image type, image index to refer by slides etc.
  • "Pictures" OLE stream holds the actual data of the image.

    Data in the "Pictures" OLE stream is organized as follows:
    For each image there is an entry: 25 byte header + image data. Image data is the exact content of the JPEG file, i.e. PowerPoint puts the whole jpeg file there without any modifications.
    Header format:

  • 2 byte: image type. For JPEGs it is 0x46A0, for PNG it is 0x6E00.
  • 2 byte: unknown.
  • 4 byte : image size + 17. Looks like shift from the end of header but why to add it to the image size?
  • next 16 bytes. Unique identifier of this image which is used by EscherBSE record.

    Author:
    Yegor Kozlov

    Field Summary
    static int DIB
              Windows DIB (BMP)
    static int JPEG
              JPEG
    static int PICT
              Macintosh PICT ( NOT YET SUPPORTED )
    static int PNG
              PNG
    static int WMF
              Windows Metafile ( NOT YET SUPPORTED )
     
    Fields inherited from class org.apache.poi.hslf.model.Shape
    _escherContainer, _parent, _sheet, EMU_PER_CENTIMETER, EMU_PER_INCH, EMU_PER_POINT, MASTER_DPI, PIXEL_DPI, POINT_DPI
     
    Constructor Summary
    protected Picture(EscherContainerRecord escherRecord, Shape parent)
              Create a Picture object
      Picture(int idx)
              Create a new Picture
     
    Method Summary
    protected  void afterInsert(Sheet sh)
              By default set the orininal image size
    protected  EscherContainerRecord createSpContainer(int idx)
              Create a new Picture and populate the inital structure of the EscherSp record which holds information about this picture.
     PictureData getPictureData()
              Returns the picture data for this picture.
     int getPictureIndex()
              Returns index associated with this picture.
     void setDefaultSize()
              Resize this picture to the default size.
     
    Methods inherited from class org.apache.poi.hslf.model.SimpleShape
    createSpContainer, getLineColor, getLineStyle, getLineWidth, setFillColor, setLineColor, setLineStyle, setLineWidth
     
    Methods inherited from class org.apache.poi.hslf.model.Shape
    getAnchor, getEscherChild, getEscherProperty, getParent, getShapeName, getShapeType, getSheet, getSpContainer, moveTo, setAnchor, setEscherProperty, setShapeType, setSheet
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    WMF

    public static final int WMF
    Windows Metafile ( NOT YET SUPPORTED )

    See Also:
    Constant Field Values

    PICT

    public static final int PICT
    Macintosh PICT ( NOT YET SUPPORTED )

    See Also:
    Constant Field Values

    JPEG

    public static final int JPEG
    JPEG

    See Also:
    Constant Field Values

    PNG

    public static final int PNG
    PNG

    See Also:
    Constant Field Values

    DIB

    public static final int DIB
    Windows DIB (BMP)

    See Also:
    Constant Field Values
    Constructor Detail

    Picture

    public Picture(int idx)
    Create a new Picture

    Parameters:
    idx - the index of the picture

    Picture

    protected Picture(EscherContainerRecord escherRecord,
                      Shape parent)
    Create a Picture object

    Parameters:
    escherRecord - the EscherSpContainer record which holds information about this picture in the Slide
    parent - the parent shape of this picture
    Method Detail

    getPictureIndex

    public int getPictureIndex()
    Returns index associated with this picture. Index starts with 1 and points to a EscherBSE record which holds information about this picture.

    Returns:
    the index to this picture (1 based).

    createSpContainer

    protected EscherContainerRecord createSpContainer(int idx)
    Create a new Picture and populate the inital structure of the EscherSp record which holds information about this picture.

    Parameters:
    idx - the index of the picture which referes to EscherBSE container.
    Returns:
    the create Picture object

    setDefaultSize

    public void setDefaultSize()
    Resize this picture to the default size.


    getPictureData

    public PictureData getPictureData()
    Returns the picture data for this picture.

    Returns:
    the picture data for this picture.

    afterInsert

    protected void afterInsert(Sheet sh)
    By default set the orininal image size

    Overrides:
    afterInsert in class Shape
    Parameters:
    sh - - owning shape


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