Package com.aowagie.text.pdf.codec
Class GifImage
java.lang.Object
com.aowagie.text.pdf.codec.GifImage
Reads gif images of all types. All the images in a gif are read in the constructors
and can be retrieved with other methods.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byte[]private intprivate intprivate final ArrayListprivate byte[]private URLprivate booleanprivate intprivate intprivate DataInputStreamprivate booleanprivate intprivate intprivate intprivate booleanprivate intprivate byte[]private intprivate byte[]private intprivate byte[]private static final intprivate byte[]private short[]private byte[]private intprivate booleanprivate int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanintGets the number of frames the gif has.getImage(int frame) Gets the image from a frame.int[]Gets the logical screen.private static intnewBpc(int bpc) private voidprocess(InputStream is) private intReads next variable length block from input.private byte[]readColorTable(int bpc) private voidprivate voidReads Graphics Control Extension valuesprivate voidReads GIF file header information.private voidReads next frame imageprivate voidreadLSD()Reads Logical Screen Descriptorprivate intReads next 16-bit value, LSB firstprivate voidsetPixel(int x, int y, int v) private voidskip()Skips variable length blocks up to and including next zero length block.
-
Field Details
-
in
-
width
private int width -
height
private int height -
gctFlag
private boolean gctFlag -
lctFlag
private boolean lctFlag -
interlace
private boolean interlace -
ix
private int ix -
iy
private int iy -
iw
private int iw -
ih
private int ih -
block
private final byte[] block -
blockSize
private int blockSize -
dispose
private int dispose -
transparency
private boolean transparency -
transIndex
private int transIndex -
MaxStackSize
private static final int MaxStackSize- See Also:
-
prefix
private short[] prefix -
suffix
private byte[] suffix -
pixelStack
private byte[] pixelStack -
m_out
private byte[] m_out -
m_bpc
private int m_bpc -
m_gbpc
private int m_gbpc -
m_global_table
private byte[] m_global_table -
m_curr_table
private byte[] m_curr_table -
m_line_stride
private int m_line_stride -
fromData
private byte[] fromData -
fromUrl
-
frames
-
-
Constructor Details
-
GifImage
Reads gif images from an URL.- Parameters:
url- the URL- Throws:
IOException- on error
-
GifImage
Reads gif images from a byte array.- Parameters:
data- the byte array- Throws:
IOException- on error
-
-
Method Details
-
getFrameCount
public int getFrameCount()Gets the number of frames the gif has.- Returns:
- the number of frames the gif has
-
getImage
Gets the image from a frame. The first frame is 1.- Parameters:
frame- the frame to get the image from- Returns:
- the image
-
getLogicalScreen
public int[] getLogicalScreen()Gets the logical screen. The images may be smaller and placed in some position in this screen to playback some animation. No image will be be bigger that this.- Returns:
- the logical screen dimensions as [x,y]
-
process
- Throws:
IOException
-
readHeader
Reads GIF file header information.- Throws:
IOException
-
readLSD
Reads Logical Screen Descriptor- Throws:
IOException
-
readShort
Reads next 16-bit value, LSB first- Throws:
IOException
-
readBlock
Reads next variable length block from input.- Returns:
- number of bytes stored in "buffer"
- Throws:
IOException
-
readColorTable
- Throws:
IOException
-
newBpc
private static int newBpc(int bpc) -
readContents
- Throws:
IOException
-
readImage
Reads next frame image- Throws:
IOException
-
decodeImageData
- Throws:
IOException
-
setPixel
private void setPixel(int x, int y, int v) -
readGraphicControlExt
Reads Graphics Control Extension values- Throws:
IOException
-
skip
Skips variable length blocks up to and including next zero length block.- Throws:
IOException
-