|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectewe.fx.Mask
A Mask is used to include/exclude pixels of an Image. It is represented simply as an array of bytes, where each bit maps simply to a pixel of the Image (see the "bits" variable).
| Field Summary | |
protected byte[] |
bits
This is the inclusion bitmap for the mask. |
protected int |
height
The height of the mask. |
protected int |
width
The width of the mask. |
| Constructor Summary | |
Mask(Image imageMask)
Create a new Mask from an Image. |
|
Mask(Image image,
Color transparent)
Create a new Mask from an Image. |
|
Mask(int width,
int height)
Create a Mask with the specified width and height. |
|
Mask(int width,
int height,
byte[] bits)
Create a Mask with the specified width and height and using the specified bits. |
|
| Method Summary | |
static void |
blend(Image dest,
Image src,
int destX,
int destY,
int width,
int height,
int srcX,
int srcY)
|
static void |
blend(int[] dest,
int[] src)
|
boolean |
fromIImage(IImage image)
Get the bits for this mask from the alpha channel of the image. |
boolean |
fromImage(Image image)
Get the bits for this mask from the alpha channel or transparent color in the image. |
boolean |
fromImageColor(Image image,
Color transparentColor)
Get the bits for this mask from the transparent color in the image. |
boolean |
fromImageColor(int[] pixels,
Color transparentColor)
Set this Masks bits based on the provided monochrome image in the form of the pixel colors of the image. |
void |
fromImageMask(Image imageMask)
Set this Masks bits based on the provided monochrome (B/W) imageMask image. |
void |
fromImageMask(int[] pixels)
Set this Masks bits based on the provided monochrome (B/W) imageMask image in the form of the pixel colors of the image. |
byte[] |
getBitmap()
|
Mask |
getCopy()
Return a copy of this mask, with its own new bit map. |
int |
getHeight()
|
int |
getWidth()
|
static boolean |
hasTrueAlpha(Image im)
|
void |
intersection(Mask other)
This leaves included only bits which are included in both this Mask and the other Mask. |
void |
invert()
This inverts the bitmap for the mask. |
void |
invert(Mask other)
This inverts all the bits in this Mask which correspond to set bits in the other Mask. |
Image |
toImageMask()
This converts this bitmap to an Image based Mask for use with mImages and Graphics.drawImage() methods. |
mImage |
toMImage(IImage image)
|
mImage |
toMImage(IImage image,
int srcX,
int srcY)
This converts the supplied image (which must be the same size as the mask) into an mImage which consists of an Image and Image mask. |
void |
union(Mask other)
This unions two masks together. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, toString |
| Field Detail |
protected int width
protected int height
protected byte[] bits
| Constructor Detail |
public Mask(int width,
int height,
byte[] bits)
width - The width of the mask.height - The height of the mask.bits - The bits for the mask.
This must be the correct size otherwise an exception will be thrown.
public Mask(int width,
int height)
width - The width of the mask.height - The height of the mask.public Mask(Image imageMask)
imageMask - The Image mask where White pixel represent excluded bits and Black pixels
represent included bits.
public Mask(Image image,
Color transparent)
image - The image.transparent - A transparent color. All bits in the image that are of this color are
considered excluded from the mask, and all other bits are considered included.| Method Detail |
public Mask getCopy()
public int getWidth()
public int getHeight()
public byte[] getBitmap()
public void invert()
public void union(Mask other)
other - The other Mask, which must be the same dimensions as this Mask.public void intersection(Mask other)
other - The other Mask, which must be the same dimensions as this Mask.public void invert(Mask other)
other - The other Mask, which must be the same dimensions as this Mask.public Image toImageMask()
public void fromImageMask(Image imageMask)
public void fromImageMask(int[] pixels)
public boolean fromImageColor(int[] pixels,
Color transparentColor)
public boolean fromImageColor(Image image,
Color transparentColor)
image - The image to create a mask for.
public boolean fromImage(Image image)
image - The image to create a mask for.
public boolean fromIImage(IImage image)
image - The image to create a mask for.
public mImage toMImage(IImage image,
int srcX,
int srcY)
public mImage toMImage(IImage image)
public static boolean hasTrueAlpha(Image im)
public static void blend(Image dest,
Image src,
int destX,
int destY,
int width,
int height,
int srcX,
int srcY)
throws IllegalArgumentException
IllegalArgumentException
public static void blend(int[] dest,
int[] src)
throws IllegalArgumentException
IllegalArgumentException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||