RectangleMask Class

Summary: Describes a rectangle mask.

Module: aspose.imaging.magicwand.imagemasks

Full Name: aspose.imaging.magicwand.imagemasks.RectangleMask

Inheritance: IImageMask, ImageMask

Constructors

NameDescription
RectangleMask(selected_area)Initializes a new instance of the RectangleMask class with the specified rectangle.
RectangleMask(x, y, width, height)Initializes a new instance of the RectangleMask class with the specified left-top point, width and height.

Properties

NameTypeAccessDescription
boundsRectanglerGets the bounds, in pixels, of this mask.
heightintrGets the height, in pixels, of this mask.
selection_boundsRectanglerGets the bounds of the selected part of the mask, in pixels.
sourceRasterImagerGets the source image used to create this mask, if exists.
widthintrGets the width, in pixels, of this mask.

Methods

NameDescription
apply()Applies current mask to the RasterImage source, if exists.
apply_to(image)Applies current mask to the specified RasterImage.
clone()Creates a new object that is a copy of the current instance.
crop(rectangle)Crops mask with the specified rectangle.
crop(size)Crops mask with the specified size.
crop(width, height)Crops mask with the specified width and height.
exclusive_disjunction(image, settings)Gets the exclusive disjunction of the current mask with the result of magic wand selection applied to the provided image.
exclusive_disjunction(mask)Gets the exclusive disjunction of current mask with provided.
exclusive_disjunction(settings)Gets the exclusive disjunction of the current mask with the result of magic wand selection applied to the source of the mask.
get(x, y)Gets the opacity of the specified pixel.
get_byte_opacity(x, y)Gets the opacity of the specified pixel with byte precision.
get_feathered(settings)Gets grayscale mask with the border feathered with the specified settings.
inflate(size)Inflates this mask by the specified amount.
intersect(image, settings)Gets the intersection of the current mask with the result of magic wand selection applied to the provided image.
intersect(mask)Gets the intersection of current mask with provided.
intersect(settings)Gets the intersection of the current mask with the result of magic wand selection applied to the source of the mask.
invert()Gets the inversion of the current mask.
is_opaque(x, y)Checks if the specified pixel is opaque.
is_transparent(x, y)Checks if the specified pixel is transparent.
subtract(image, settings)Gets the result of magic wand selection applied to the provided image subtracted from the current mask.
subtract(mask)Gets the subtraction of the provided mask from current.
subtract(settings)Gets the result of magic wand selection applied to the source of the current mask subtracted from the mask.
union(image, settings)Gets the union of the current mask with the result of magic wand selection applied to the provided image.
union(mask)Gets the union of the current mask with provided.
union(settings)Gets the union of the current mask with the result of magic wand selection applied to the source of the mask.

Constructor: RectangleMask(selected_area)

 RectangleMask(selected_area) 

Initializes a new instance of the RectangleMask class with the specified rectangle.

Parameters:

ParameterTypeDescription
selected_areaRectangleSelected area specified as a rectangle.

Constructor: RectangleMask(x, y, width, height)

 RectangleMask(x, y, width, height) 

Initializes a new instance of the RectangleMask class with the specified left-top point, width and height.

Parameters:

ParameterTypeDescription
xintThe x-coordinate of the left-top point of the selected area.
yintThe y-coordinate of the left-top point of the selected area.
widthintWidth of the selected area.
heightintHeight of the selected area.

Method: apply_to(image)

 apply_to(image) 

Applies current mask to the specified RasterImage.

Parameters:

ParameterTypeDescription
imageRasterImageImage to apply mask to.

Method: clone()

 clone() 

Creates a new object that is a copy of the current instance.

Returns

TypeDescription
objectA new object that is a copy of this instance.

Method: crop(rectangle)

 crop(rectangle) 

Crops mask with the specified rectangle.

Parameters:

ParameterTypeDescription
rectangleRectangleThe specified rectangle.

Returns

TypeDescription
ImageMaskA cropped RectangleMask as ImageMask.

Method: crop(size)

 crop(size) 

Crops mask with the specified size.

Parameters:

ParameterTypeDescription
sizeSizeThe specified size.

Returns

TypeDescription
ImageMaskAn ImageMask.

Method: crop(width, height)

 crop(width, height) 

Crops mask with the specified width and height.

Parameters:

ParameterTypeDescription
widthintThe specified width.
heightintThe specified height.

Returns

TypeDescription
ImageMaskAn ImageMask.

Method: exclusive_disjunction(image, settings)

 exclusive_disjunction(image, settings) 

Gets the exclusive disjunction of the current mask with the result of magic wand selection applied to the provided image.

Parameters:

ParameterTypeDescription
imageRasterImageImage for magic wand.
settingsMagicWandSettingsMagic wand settings.

Returns

TypeDescription
ImageBitMaskNew ImageBitMask.

Method: exclusive_disjunction(mask)

 exclusive_disjunction(mask) 

Gets the exclusive disjunction of current mask with provided.

Parameters:

ParameterTypeDescription
maskImageMaskProvided mask

Returns

TypeDescription
ImageBitMaskNew ImageBitMask.

Method: exclusive_disjunction(settings)

 exclusive_disjunction(settings) 

Gets the exclusive disjunction of the current mask with the result of magic wand selection applied to the source of the mask.

Parameters:

ParameterTypeDescription
settingsMagicWandSettingsMagic wand settings.

Returns

TypeDescription
ImageBitMaskNew ImageBitMask.

Method: get(x, y)

 get(x, y) 

Gets the opacity of the specified pixel.

Parameters:

ParameterTypeDescription
xintThe x-coordinate of the pixel.
yintThe y-coordinate of the pixel.

Returns

TypeDescription
booltrue if the specified pixel is opaque; otherwise, false.

Method: get_byte_opacity(x, y)

 get_byte_opacity(x, y) 

Gets the opacity of the specified pixel with byte precision.

Parameters:

ParameterTypeDescription
xintThe x-coordinate of the pixel.
yintThe y-coordinate of the pixel.

Returns

TypeDescription
byteByte value, representing the opacity of the specified pixel.

Method: get_feathered(settings)

 get_feathered(settings) 

Gets grayscale mask with the border feathered with the specified settings.

Parameters:

ParameterTypeDescription
settingsFeatheringSettingsFeathering settings.

Returns

TypeDescription
ImageGrayscaleMaskImageGrayscaleMask with feathered border.

Method: inflate(size)

 inflate(size) 

Inflates this mask by the specified amount.

Parameters:

ParameterTypeDescription
sizeintThe amount to inflate this mask.

Returns

TypeDescription
ImageMaskAn inflated RectangleMask as ImageMask.

Method: intersect(image, settings)

 intersect(image, settings) 

Gets the intersection of the current mask with the result of magic wand selection applied to the provided image.

Parameters:

ParameterTypeDescription
imageRasterImageImage for magic wand.
settingsMagicWandSettingsMagic wand settings.

Returns

TypeDescription
ImageBitMaskNew ImageBitMask.

Method: intersect(mask)

 intersect(mask) 

Gets the intersection of current mask with provided.

Parameters:

ParameterTypeDescription
maskImageMaskProvided mask

Returns

TypeDescription
ImageBitMaskNew ImageBitMask.

Method: intersect(settings)

 intersect(settings) 

Gets the intersection of the current mask with the result of magic wand selection applied to the source of the mask.

Parameters:

ParameterTypeDescription
settingsMagicWandSettingsMagic wand settings.

Returns

TypeDescription
ImageBitMaskNew ImageBitMask.

Method: invert()

 invert() 

Gets the inversion of the current mask.

Returns

TypeDescription
ImageBitMaskNew ImageBitMask.

Method: is_opaque(x, y)

 is_opaque(x, y) 

Checks if the specified pixel is opaque.

Parameters:

ParameterTypeDescription
xintThe x-coordinate of the pixel.
yintThe y-coordinate of the pixel.

Returns

TypeDescription
booltrue if the specified pixel is opaque; otherwise, false.

Method: is_transparent(x, y)

 is_transparent(x, y) 

Checks if the specified pixel is transparent.

Parameters:

ParameterTypeDescription
xintThe x-coordinate of the pixel.
yintThe y-coordinate of the pixel.

Returns

TypeDescription
booltrue if the specified pixel is transparent; otherwise, false.

Method: subtract(image, settings)

 subtract(image, settings) 

Gets the result of magic wand selection applied to the provided image subtracted from the current mask.

Parameters:

ParameterTypeDescription
imageRasterImageImage for magic wand.
settingsMagicWandSettingsMagic wand settings.

Returns

TypeDescription
ImageBitMaskNew ImageBitMask.

Method: subtract(mask)

 subtract(mask) 

Gets the subtraction of the provided mask from current.

Parameters:

ParameterTypeDescription
maskImageMaskProvided mask

Returns

TypeDescription
ImageBitMaskNew ImageBitMask.

Method: subtract(settings)

 subtract(settings) 

Gets the result of magic wand selection applied to the source of the current mask subtracted from the mask.

Parameters:

ParameterTypeDescription
settingsMagicWandSettingsMagic wand settings.

Returns

TypeDescription
ImageBitMaskNew ImageBitMask.

Method: union(image, settings)

 union(image, settings) 

Gets the union of the current mask with the result of magic wand selection applied to the provided image.

Parameters:

ParameterTypeDescription
imageRasterImageImage for magic wand.
settingsMagicWandSettingsMagic wand settings.

Returns

TypeDescription
ImageBitMaskNew ImageBitMask.

Method: union(mask)

 union(mask) 

Gets the union of the current mask with provided.

Parameters:

ParameterTypeDescription
maskImageMaskProvided mask

Returns

TypeDescription
ImageBitMaskNew ImageBitMask.

Method: union(settings)

 union(settings) 

Gets the union of the current mask with the result of magic wand selection applied to the source of the mask.

Parameters:

ParameterTypeDescription
settingsMagicWandSettingsMagic wand settings.

Returns

TypeDescription
ImageBitMaskNew ImageBitMask.