ImageGrayscaleMask Class
Summary: Describes a grayscale image mask.
Module: aspose.imaging.magicwand.imagemasks
Full Name: aspose.imaging.magicwand.imagemasks.ImageGrayscaleMask
Inheritance: IImageMask
Constructors
Name | Description |
---|---|
ImageGrayscaleMask(image) | Initializes a new instance of the ImageGrayscaleMask class with the size of the specified existing RasterImage. Specified RasterImage will be stored as source image. |
ImageGrayscaleMask(width, height) | Initializes a new instance of the ImageGrayscaleMask class with the specified width and height. |
Properties
Name | Type | Access | Description |
---|---|---|---|
bounds | Rectangle | r | Gets the bounds, in pixels, of this mask. |
height | int | r | Gets the height, in pixels, of this mask. |
selection_bounds | Rectangle | r | Gets the bounds of the selected part of the mask, in pixels. |
source | RasterImage | r | Gets the source image used to create this mask, if exists. |
width | int | r | Gets the width, in pixels, of this mask. |
Methods
Name | Description |
---|---|
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(mask) | Gets the exclusive disjunction of current mask with provided. |
get(x, y) | Gets or sets the opacity of the specified pixel. |
get_byte_opacity(x, y) | Gets the opacity of the specified pixel with byte precision. |
intersect(mask) | Gets the intersection of current mask with provided. |
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. |
set(x, y, value) | Sets the opacity of the specified pixel. |
subtract(mask) | Gets the subtraction of the provided mask from current. |
union(mask) | Union of two masks. |
Constructor: ImageGrayscaleMask(image)
ImageGrayscaleMask(image)
Initializes a new instance of the ImageGrayscaleMask class with the size of the specified existing RasterImage.
Specified RasterImage will be stored as source image.
Parameters:
Parameter | Type | Description |
---|---|---|
image | RasterImage | Source image. |
Constructor: ImageGrayscaleMask(width, height)
ImageGrayscaleMask(width, height)
Initializes a new instance of the ImageGrayscaleMask class with the specified width and height.
Parameters:
Parameter | Type | Description |
---|---|---|
width | int | Width of the mask. |
height | int | Height of the mask. |
Method: apply_to(image)
apply_to(image)
Applies current mask to the specified RasterImage.
Parameters:
Parameter | Type | Description |
---|---|---|
image | RasterImage | Image to apply mask to. |
Method: clone()
clone()
Creates a new object that is a copy of the current instance.
Returns
Type | Description |
---|---|
object | A new object that is a copy of this instance. |
Method: crop(rectangle)
crop(rectangle)
Crops mask with the specified rectangle.
Parameters:
Parameter | Type | Description |
---|---|---|
rectangle | Rectangle | The specified rectangle. |
Returns
Type | Description |
---|---|
ImageGrayscaleMask | A cropped ImageGrayscaleMask. |
Method: crop(size)
crop(size)
Crops mask with the specified size.
Parameters:
Parameter | Type | Description |
---|---|---|
size | Size | The specified size. |
Returns
Type | Description |
---|---|
ImageGrayscaleMask | An cropped ImageGrayscaleMask. |
Method: crop(width, height)
crop(width, height)
Crops mask with the specified width and height.
Parameters:
Parameter | Type | Description |
---|---|---|
width | int | The specified width. |
height | int | The specified height. |
Returns
Type | Description |
---|---|
ImageGrayscaleMask | An cropped ImageGrayscaleMask. |
Method: exclusive_disjunction(mask)
exclusive_disjunction(mask)
Gets the exclusive disjunction of current mask with provided.
Parameters:
Parameter | Type | Description |
---|---|---|
mask | ImageGrayscaleMask | Provided mask |
Returns
Type | Description |
---|---|
ImageGrayscaleMask | New ImageGrayscaleMask. |
Method: get(x, y)
get(x, y)
Gets or sets the opacity of the specified pixel.
Parameters:
Parameter | Type | Description |
---|---|---|
x | int | The x-coordinate of the pixel. |
y | int | The y-coordinate of the pixel. |
Returns
Type | Description |
---|---|
byte | Byte value; 0 if transparent; 255 if opaque. |
Method: get_byte_opacity(x, y)
get_byte_opacity(x, y)
Gets the opacity of the specified pixel with byte precision.
Parameters:
Parameter | Type | Description |
---|---|---|
x | int | The x-coordinate of the pixel. |
y | int | The y-coordinate of the pixel. |
Returns
Type | Description |
---|---|
byte | Byte value, representing the opacity of the specified pixel. |
Method: intersect(mask)
intersect(mask)
Gets the intersection of current mask with provided.
Parameters:
Parameter | Type | Description |
---|---|---|
mask | ImageGrayscaleMask | Provided mask |
Returns
Type | Description |
---|---|
ImageGrayscaleMask | New ImageGrayscaleMask. |
Method: invert()
invert()
Gets the inversion of the current mask.
Returns
Type | Description |
---|---|
ImageGrayscaleMask | New ImageGrayscaleMask. |
Method: is_opaque(x, y)
is_opaque(x, y)
Checks if the specified pixel is opaque.
Parameters:
Parameter | Type | Description |
---|---|---|
x | int | The x-coordinate of the pixel. |
y | int | The y-coordinate of the pixel. |
Returns
Type | Description |
---|---|
bool | true 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:
Parameter | Type | Description |
---|---|---|
x | int | The x-coordinate of the pixel. |
y | int | The y-coordinate of the pixel. |
Returns
Type | Description |
---|---|
bool | true if the specified pixel is transparent; otherwise, false. |
Method: set(x, y, value)
set(x, y, value)
Sets the opacity of the specified pixel.
Parameters:
Parameter | Type | Description |
---|---|---|
x | int | The x-coordinate of the pixel. |
y | int | The y-coordinate of the pixel. |
value | byte | Byte value; 0 if transparent; 255 if opaque. |
Method: subtract(mask)
subtract(mask)
Gets the subtraction of the provided mask from current.
Parameters:
Parameter | Type | Description |
---|---|---|
mask | ImageGrayscaleMask | Provided mask |
Returns
Type | Description |
---|---|
ImageGrayscaleMask | New ImageGrayscaleMask. |
Method: union(mask)
union(mask)
Union of two masks.
Parameters:
Parameter | Type | Description |
---|---|---|
mask | ImageGrayscaleMask | Provided mask |
Returns
Type | Description |
---|---|
ImageGrayscaleMask | New ImageGrayscaleMask. |