Class CompositeImage
java.lang.Object
org.apache.pdfbox.pdmodel.graphics.xobject.CompositeImage
This class is responsible for combining a base image with an SMask-based transparency
image to form a composite image.
See section 11.5 of the pdf specification for details on Soft Masks.
Briefly however, an Smask is a supplementary greyscale image whose RGB-values define
a transparency mask which, when combined appropriately with the base image,
allows per-pixel transparency to be applied.
Note that Smasks are not required for any image and if the smask is not present
in the pdf file, the image will have no transparent pixels.
- Author:
- Neil McErlean
-
Constructor Summary
ConstructorsConstructorDescriptionCompositeImage
(BufferedImage baseImage, BufferedImage smaskImage) Standard constructor. -
Method Summary
Modifier and TypeMethodDescriptioncreateMaskedImage
(COSArray decodeArray) This method applies the specified transparency mask to a given image and returns a new BufferedImage whose alpha values are computed from the transparency mask (smask) image.createStencilMaskedImage
(COSArray decodeArray) This method applies the specified stencil mask to a given image and returns a new BufferedImage whose alpha values are computed from the stencil mask (smask) image.
-
Constructor Details
-
CompositeImage
Standard constructor.- Parameters:
baseImage
- the base Image.smaskImage
- the transparency image.
-
-
Method Details
-
createMaskedImage
This method applies the specified transparency mask to a given image and returns a new BufferedImage whose alpha values are computed from the transparency mask (smask) image.- Parameters:
decodeArray
- the decode array- Returns:
- the masked image
- Throws:
IOException
- if something went wrong
-
createStencilMaskedImage
This method applies the specified stencil mask to a given image and returns a new BufferedImage whose alpha values are computed from the stencil mask (smask) image.- Parameters:
decodeArray
- the decode array- Returns:
- the stencil masked image
-