Package org.openpdf.renderer
Class PDFImage.JpegDecoder
java.lang.Object
org.openpdf.renderer.PDFImage.JpegDecoder
- Enclosing class:
- PDFImage
Decodes jpeg data, possibly attempting a manual YCCK decode if requested.
Users should use
getColorModel() to see which color model should
now be used after a successful decode.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ColorModelThe color model employedprivate final ByteBufferThe jpeg bytesprivate booleanWhether the YCCK/CMYK decode work-around should be used -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateJpegDecoder(ByteBuffer jpegData, ColorModel cm) Class constructor -
Method Summary
Modifier and TypeMethodDescriptionprivate BufferedImagedecode()Attempt to decode the jpeg dataprivate NodeGet a named child nodeGet the color model that should be used nowprivate BufferedImagereadImage(ImageReader jpegReader, ImageReadParam param) voidycckcmykDecodeMode(boolean ycckcmykDecodeMode) Identify whether the decoder should operate in YCCK/CMYK decode mode, whereby the YCCK Chroma is specifically looked for and the color model is changed to support converting raw YCCK color values, working around a lack of YCCK/CMYK report in the standard Java jpeg readers.
-
Field Details
-
jpegData
The jpeg bytes -
cm
The color model employed -
ycckcmykDecodeMode
private boolean ycckcmykDecodeModeWhether the YCCK/CMYK decode work-around should be used
-
-
Constructor Details
-
JpegDecoder
Class constructor- Parameters:
jpegData- the JPEG datacm- the color model as presented in the PDF
-
-
Method Details
-
ycckcmykDecodeMode
public void ycckcmykDecodeMode(boolean ycckcmykDecodeMode) Identify whether the decoder should operate in YCCK/CMYK decode mode, whereby the YCCK Chroma is specifically looked for and the color model is changed to support converting raw YCCK color values, working around a lack of YCCK/CMYK report in the standard Java jpeg readers. Non-YCCK images will not be decoded while in this mode.- Parameters:
ycckcmykDecodeMode-
-
getColorModel
Get the color model that should be used now- Returns:
-
decode
Attempt to decode the jpeg data- Returns:
- the successfully decoded image
- Throws:
IOException- if the image couldn't be decoded due to a lack of support or some IO problem
-
readImage
- Throws:
IOException
-
getChild
Get a named child node- Parameters:
aNode- the nodeaChildName- the name of the child node- Returns:
- the first direct child node with that name or null if it doesn't exist
-