public abstract class HSLFPictureData extends java.lang.Object implements PictureData, GenericRecord
PictureData.PictureType
Modifier and Type | Field and Description |
---|---|
protected static int |
CHECKSUM_SIZE
Size of the image checksum calculated using MD5 algorithm.
|
Modifier | Constructor and Description |
---|---|
|
HSLFPictureData()
Deprecated.
Use
HSLFSlideShow.addPicture(byte[], org.apache.poi.sl.usermodel.PictureData.PictureType) or one of its overloads to create new
HSLFPictureData . This API led to detached HSLFPictureData instances (See Bugzilla
46122) and prevented adding additional functionality. |
protected |
HSLFPictureData(EscherContainerRecord bStore,
EscherBSERecord bse)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
static HSLFPictureData |
create(PictureData.PictureType type)
Deprecated.
Use
HSLFSlideShow.addPicture(byte[], org.apache.poi.sl.usermodel.PictureData.PictureType) or one of its overloads to create new
HSLFPictureData . This API led to detached HSLFPictureData instances (See Bugzilla
46122) and prevented adding additional functionality. |
protected abstract byte[] |
formatImageForSlideshow(byte[] data)
Formats the picture data for storage in the slideshow.
|
byte[] |
getChecksum()
Gets the checksum - the checksum can be of various length -
mostly it's 8 (XSLF) or 16 (HSLF) bytes long.
|
static byte[] |
getChecksum(byte[] data)
Compute 16-byte checksum of this picture using MD5 algorithm.
|
java.lang.String |
getContentType()
Returns content type (mime type) of this picture.
|
java.util.Map<java.lang.String,java.util.function.Supplier<?>> |
getGenericProperties() |
byte[] |
getHeader()
Return 24 byte header which preceeds the actual picture data.
|
java.awt.Dimension |
getImageDimensionInPixels()
Return the original image dimensions in pixels
|
int |
getIndex()
Returns the 1-based index of this picture.
|
int |
getOffset()
File offset in the 'Pictures' stream
|
byte[] |
getRawData()
Returns the formatted, binary data of this picture excluding the
preamble bytes. |
protected abstract int |
getSignature()
Blip signature.
|
byte[] |
getUID()
Returns 16-byte checksum of this picture
|
protected int |
getUIDInstanceCount()
The instance type/signatures defines if one or two UID instances will be included
|
void |
setData(byte[] data)
Sets the binary picture data
|
void |
setIndex(int index) |
void |
setOffset(int offset)
Deprecated.
This function was only intended for POI internal use. If you have a use case you're concerned about,
please open an issue in the POI issue tracker.
|
void |
setRawData(byte[] data)
Deprecated.
Set image data using
setData(byte[]) . |
abstract void |
setSignature(int signature) |
protected void |
setUIDInstanceCount(int uidInstanceCount)
The instance type/signatures defines if one or two UID instances will be included
|
void |
write(java.io.OutputStream out)
Write this picture into
OutputStream |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getData, getImageDimension, getType
getGenericChildren, getGenericRecordType
protected static final int CHECKSUM_SIZE
@Deprecated @Removal(version="5.3") public HSLFPictureData()
HSLFSlideShow.addPicture(byte[], org.apache.poi.sl.usermodel.PictureData.PictureType)
or one of its overloads to create new
HSLFPictureData
. This API led to detached HSLFPictureData
instances (See Bugzilla
46122) and prevented adding additional functionality.@Internal protected HSLFPictureData(EscherContainerRecord bStore, EscherBSERecord bse)
bStore
- BStore
record tracking all pictures. Should be attached
to the slideshow that this picture is linked to.bse
- Record referencing this picture. Should be attached to the slideshow that this picture is linked to.protected abstract int getSignature()
public abstract void setSignature(int signature)
protected int getUIDInstanceCount()
protected void setUIDInstanceCount(int uidInstanceCount)
uidInstanceCount
- the number of uid sequencespublic byte[] getRawData()
preamble
bytes.
Primarily intended for internal POI use. Use PictureData.getData()
to retrieve the picture represented by this
object.
PictureData.getData()
,
formatImageForSlideshow(byte[])
@Deprecated @Removal(version="5.3") public void setRawData(byte[] data)
setData(byte[])
.
Primarily intended for internal POI use. Use setData(byte[])
to change the picture represented by this
object.
data
- Picture data formatted for the HSLF format. Excludes the preamble
.setData(byte[])
,
formatImageForSlideshow(byte[])
public int getOffset()
@Deprecated @Removal(version="5.3") public void setOffset(int offset)
offset
- in the 'Pictures' streampublic byte[] getUID()
public byte[] getChecksum()
PictureData
getChecksum
in interface PictureData
public static byte[] getChecksum(byte[] data)
public void write(java.io.OutputStream out) throws java.io.IOException
OutputStream
java.io.IOException
@Deprecated @Removal(version="5.3") public static HSLFPictureData create(PictureData.PictureType type)
HSLFSlideShow.addPicture(byte[], org.apache.poi.sl.usermodel.PictureData.PictureType)
or one of its overloads to create new
HSLFPictureData
. This API led to detached HSLFPictureData
instances (See Bugzilla
46122) and prevented adding additional functionality.HSLFPictureData
by type.type
- type of picture.HSLFPictureData
.public byte[] getHeader()
The header consists of 2-byte signature, 2-byte type, 4-byte image size and 16-byte checksum of the image data.
public int getIndex()
public void setIndex(int index)
index
- sets the 1-based index of this pictures within the pictures streamprotected abstract byte[] formatImageForSlideshow(byte[] data)
Images stored in HSLFSlideShow
s are represented differently than when they are standalone files. The
exact formatting differs for each image type.
data
- Original image data. If these bytes were written to a disk, a common image viewer would be able to
render the image.public final void setData(byte[] data) throws java.io.IOException
PictureData
The format of the data must match the format of PictureData.getType()
. Failure to match the picture data may result
in data loss.
setData
in interface PictureData
data
- picture datajava.io.IOException
public final java.lang.String getContentType()
PictureData
getContentType
in interface PictureData
public java.awt.Dimension getImageDimensionInPixels()
PictureData
getImageDimensionInPixels
in interface PictureData
PictureData.getImageDimension()
public java.util.Map<java.lang.String,java.util.function.Supplier<?>> getGenericProperties()
getGenericProperties
in interface GenericRecord
Copyright 2022 The Apache Software Foundation or its licensors, as applicable.