public final class MaskColors extends Object
Modifier and Type | Method and Description |
---|---|
static MaskColors |
create(com.itextpdf.kernel.pdf.PdfArray array)
Creates an instance of MaskArray based on /Mask entry of the image dictionary.
|
MaskColors |
getConvertedColorMask(long maximumComponentValue, ColorConverter converter)
Converts maskArray from one color space to another according to provided ColorConverter .
|
long[] |
getMax()
Gets maximum color to mask out which is defined by the elements at odd positions of the original array (considering the array as 0-indexed).
|
long[] |
getMin()
Gets minimum color to mask out which is defined by the elements at even positions of the original array (considering the array as 0-indexed).
|
boolean |
isColorMasked(long[] color)
Checks if provided color is masked by the current mask because all its components are in the range defined by the min and max arrays of the mask.
|
com.itextpdf.kernel.pdf.PdfArray |
toPdfArray()
Creates a mask PdfArray from provided object.
|
public static MaskColors create(com.itextpdf.kernel.pdf.PdfArray array)
array
- is a Mask array, may be null
array
is null
com.itextpdf.kernel.exceptions.PdfException
- if provided MaskArray is invalid: empty or contains odd number of elements
public MaskColors getConvertedColorMask(long maximumComponentValue, ColorConverter converter)
ColorConverter
. It is expected that source color space of the converter matches the color space of the mask. Otherwise exception will be thrown.
maximumComponentValue
- is a maximum value of each component. Unlike double representing of the color components, long components depend on the color depth and may represent different colors when used with different bits per component. Maximum component value notifies the maximum possible value for each component which usually is calculated as 2 ^ (bitsPerComponent) - 1
. However it is possible to use the method in another setting with any other maximum component value. It is expected that every value of the mask represented by this instance is not negative and does not exceed the maximumComponentValue
converter
- is a color converter. It is expected that its source color space which can be identified via ColorConverter.getSourceColorspace()
matches the color space of the mask (at least it has the same number of components as getMin()
and getMax()
arrays). Otherwise exception will be thrown
MaskColors
representing the same mask in new color space. For converted arrays it is expected that each element of one of them is not greater then the corresponding element of the second one.
com.itextpdf.kernel.exceptions.PdfException
- if maskColor
and converted
do not match
public long[] getMin()
public long[] getMax()
public boolean isColorMasked(long[] color)
color
- is a color to check
true
if check is valid (provided color has the expected number of components) and all color should be masked. Otherwise returns false
public com.itextpdf.kernel.pdf.PdfArray toPdfArray()
PdfArray
from provided object.
Copyright © 1998–2022 iText Group NV. All rights reserved.