pdfOptimizer 3.0.1 API
iText.Pdfoptimizer.Handlers.Util.MaskColors Class Reference

Wrapper class for an array presented as /Mask entry of the image. More...

Public Member Functions

iText.Pdfoptimizer.Handlers.Util.MaskColors  GetConvertedColorMask (long maximumComponentValue, ColorConverter converter)
  Converts maskArray from one color space to another according to provided iText.Pdfoptimizer.Handlers.Util.Pixel.ColorConverter. More...
 
iText.Pdfoptimizer.Handlers.Util.MaskColors  GetConvertedColorMask (long maximumComponentValue, ColorConverter converter, ColorDecoder colorDecoder)
  Converts maskArray from one color space to another according to provided iText.Pdfoptimizer.Handlers.Util.Pixel.ColorConverter and iText.Pdfoptimizer.Handlers.Util.Decoders.ColorDecoder. More...
 
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). More...
 
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). More...
 
bool  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. More...
 
PdfArray  ToPdfArray ()
  Creates a mask iText.Kernel.Pdf.PdfArray from provided object. More...
 

Static Public Member Functions

static iText.Pdfoptimizer.Handlers.Util.MaskColors  Create (PdfArray array)
  Creates an instance of MaskArray based on /Mask entry of the image dictionary. More...
 

Detailed Description

Wrapper class for an array presented as /Mask entry of the image.

Wrapper class for an array presented as /Mask entry of the image. It is implemented as immutable class.

Member Function Documentation

◆ Create()

static iText.Pdfoptimizer.Handlers.Util.MaskColors iText.Pdfoptimizer.Handlers.Util.MaskColors.Create ( PdfArray  array )
inlinestatic

Creates an instance of MaskArray based on /Mask entry of the image dictionary.

Parameters
array is a Mask array, may be null
Returns
a MaskArray wrapper or null if array is null

◆ GetConvertedColorMask() [1/2]

iText.Pdfoptimizer.Handlers.Util.MaskColors iText.Pdfoptimizer.Handlers.Util.MaskColors.GetConvertedColorMask ( long  maximumComponentValue,
ColorConverter  converter 
)
inline

Converts maskArray from one color space to another according to provided iText.Pdfoptimizer.Handlers.Util.Pixel.ColorConverter.

Converts maskArray from one color space to another according to provided iText.Pdfoptimizer.Handlers.Util.Pixel.ColorConverter . It is expected that source color space of the converter matches the color space of the mask. Otherwise exception will be thrown.

Parameters
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 iText.Pdfoptimizer.Handlers.Util.Pixel.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
Returns
new instance of 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.

◆ GetConvertedColorMask() [2/2]

iText.Pdfoptimizer.Handlers.Util.MaskColors iText.Pdfoptimizer.Handlers.Util.MaskColors.GetConvertedColorMask ( long  maximumComponentValue,
ColorConverter  converter,
ColorDecoder  colorDecoder 
)
inline

Converts maskArray from one color space to another according to provided iText.Pdfoptimizer.Handlers.Util.Pixel.ColorConverter and iText.Pdfoptimizer.Handlers.Util.Decoders.ColorDecoder.

Converts maskArray from one color space to another according to provided iText.Pdfoptimizer.Handlers.Util.Pixel.ColorConverter and iText.Pdfoptimizer.Handlers.Util.Decoders.ColorDecoder . It is expected that source color space of the converter matches the color space of the mask. Otherwise, exception will be thrown.

Parameters
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 iText.Pdfoptimizer.Handlers.Util.Pixel.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
colorDecoder

iText.Pdfoptimizer.Handlers.Util.Decoders.ColorDecoder

Returns
new instance of 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.

◆ GetMax()

long [] iText.Pdfoptimizer.Handlers.Util.MaskColors.GetMax ( )
inline

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).

Returns
minimum color of mask out

◆ GetMin()

long [] iText.Pdfoptimizer.Handlers.Util.MaskColors.GetMin ( )
inline

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).

Returns
minimum color of mask out

◆ IsColorMasked()

bool iText.Pdfoptimizer.Handlers.Util.MaskColors.IsColorMasked ( long[]  color )
inline

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.

Parameters
color is a color to check
Returns
true if check is valid (provided color has the expected number of components) and all color should be masked. Otherwise returns false

◆ ToPdfArray()

PdfArray iText.Pdfoptimizer.Handlers.Util.MaskColors.ToPdfArray ( )
inline

Creates a mask iText.Kernel.Pdf.PdfArray from provided object.

Returns
a mask array