Class ImageLoaderImageIO
java.lang.Object
org.apache.xmlgraphics.image.loader.impl.AbstractImageLoader
org.apache.xmlgraphics.image.loader.impl.imageio.ImageLoaderImageIO
- All Implemented Interfaces:
ImageLoader
An ImageLoader implementation based on ImageIO for loading bitmap images.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprivate static final Stringprotected static final org.apache.commons.logging.Logloggerprivate static final Stringprivate static final Setprivate ImageFlavorFields inherited from interface ImageLoader
MEDIUM_LOADING_PENALTY, NO_LOADING_PENALTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate booleancheckProviderIgnoresICC(IIOServiceProvider provider) Checks if the provider ignores the ICC color profile.private BufferedImagegetFallbackBufferedImage(ImageReader reader, int pageIndex, ImageReadParam param) private ImageReadParamgetParam(ImageReader reader, Map<String, Object> hints) Returns the image flavor that is returned by this ImageLoader implementation.Loads and returns an image.private BufferedImagergbToCmyk(BufferedImage image, ImageInfo info, ImageSessionContext session) Convert RGB to CMYK using ICC file passed via fop.xconfprivate ICC_ProfiletryToExctractICCProfile(IIOMetadata iiometa) Extract ICC Profile from ImageIO Metadata.private ICC_Profileprivate ICC_ProfileMethods inherited from class AbstractImageLoader
getUsagePenalty, ignoreColorProfile, loadImage
-
Field Details
-
log
protected static final org.apache.commons.logging.Log loglogger -
targetFlavor
-
PNG_METADATA_NODE
- See Also:
-
JPEG_METADATA_NODE
- See Also:
-
ICC_CONVERTER
- See Also:
-
PROVIDERS_IGNORING_ICC
-
-
Constructor Details
-
ImageLoaderImageIO
Main constructor.- Parameters:
targetFlavor- the target flavor
-
-
Method Details
-
getTargetFlavor
Returns the image flavor that is returned by this ImageLoader implementation.- Returns:
- the target image flavor
-
loadImage
public Image loadImage(ImageInfo info, Map<String, Object> hints, ImageSessionContext session) throws ImageException, IOExceptionLoads and returns an image.- Parameters:
info- the image info object indicating the imagehints- a Map of hints that can be used by implementations to customize the loading process (may be null).session- the session context- Returns:
- the fully loaded image
- Throws:
ImageException- if an error occurs while loading the imageIOException- if an I/O error occurs while loading the image
-
rgbToCmyk
private BufferedImage rgbToCmyk(BufferedImage image, ImageInfo info, ImageSessionContext session) throws IOException Convert RGB to CMYK using ICC file passed via fop.xconf- Throws:
IOException
-
getParam
- Throws:
IOException
-
checkProviderIgnoresICC
Checks if the provider ignores the ICC color profile. This method will assume providers work correctly, and return false if the provider is unknown. This ensures backward-compatibility.- Parameters:
provider- the ImageIO Provider- Returns:
- true if we know the provider to be broken and ignore ICC profiles.
-
tryToExctractICCProfile
Extract ICC Profile from ImageIO Metadata. This method currently only supports PNG and JPEG metadata.- Parameters:
iiometa- The ImageIO Metadata- Returns:
- an ICC Profile or null.
-
tryToExctractICCProfileFromPNGMetadataNode
-
tryToExctractICCProfileFromJPEGMetadataNode
-
getFallbackBufferedImage
private BufferedImage getFallbackBufferedImage(ImageReader reader, int pageIndex, ImageReadParam param) throws IOException - Throws:
IOException
-