Package org.loboevolution.pdfview
Class PDFImage
java.lang.Object
org.loboevolution.pdfview.PDFImage
Encapsulates a PDF Image
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic PDFImage
createImage
(PDFObject obj, Map<String, PDFObject> resources, boolean useAsSMask) Read a PDFImage from an image dictionary and streamgetImage()
Get the image that this PDFImage generates.protected BufferedImage
parseData
(byte[] data, ByteBuffer jpegData) Parse the image stream into a buffered image.
-
Constructor Details
-
PDFImage
Create an instance of a PDFImage- Parameters:
imageObj
- aPDFObject
object.- Throws:
IOException
- if any.
-
-
Method Details
-
createImage
public static PDFImage createImage(PDFObject obj, Map<String, PDFObject> resources, boolean useAsSMask) throws IOExceptionRead a PDFImage from an image dictionary and stream- Parameters:
obj
- the PDFObject containing the image's dictionary and streamresources
- the current resourcesuseAsSMask
- - flag for switching colors in case image is used as sMask internally this is needed for handling transparency in smask images.- Returns:
- a
PDFImage
object. - Throws:
IOException
- if any.
-
getImage
Get the image that this PDFImage generates.- Returns:
- a buffered image containing the decoded image data
- Throws:
PDFImageParseException
- if any.
-
parseData
Parse the image stream into a buffered image. Note that this is guaranteed to be called after all the other setXXX methods have been called.
NOTE: the color convolving is extremely slow on large images. It would be good to see if it could be moved out into the rendering phases, where we might be able to scale the image down first.
- Parameters:
data
- the data when already completely filtered and uncompressedjpegData
- a byte buffer if data still requiring the DCDTecode filter is being used- Returns:
- a
BufferedImage
object. - Throws:
IOException
- if any.
-