|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectewe.fx.mImage
An mImage is a versatile implementation of IImage. One of its major uses is to display Images with transparent or partially transparent areas. This is needed because the Graphics class does not draw transparent images unless the DRAW_ALPHA mode is specified or unless one of the special drawImage() methods are used that use an image mask (itself an image) or a transparent color to display certain areas of the image as being transparent.
You can also inherit from mImage and override the doDraw() method to custom draw your Image.
| Field Summary | |
static int |
AlwaysOnTop
A property bit - The image is always on top. |
Color |
backgroundColor
|
Mask |
bitmask
A bitmask used for the image. |
static int |
CompletelyIn
A property bit - Another image must be completely within this image to be considered "within" this image. |
IImage |
drawable
If this is set, then the mImage will draw itself using this other IImage. |
int |
drawMode
|
static int |
HasBorder
A property bit - The image has a border. |
static int |
HasChanged
A property bit - The image has changed, this is normally set and cleared automatically. |
static int |
HasMoved
A property bit - The image has moved, this is normally set and cleared automatically. |
Area |
hotArea
This Area must update itself as the image moves. |
Polygon |
hotPolygon
This polygon must be relative to the top-left of the image. |
Image |
image
The base image for the mImage. |
protected boolean |
imageMayChange
|
static int |
InUse
A property bit - Used by MosaicPanel |
static int |
IsAnimated
A property bit - indicates that this image will be animated and so the ImageRefresher should be set if it is being placed into a Control. |
static int |
IsEmpty
A property bit - The image is empty. |
static int |
IsInvisible
A property bit - The image is invisible |
static int |
IsLocked
A property bit - The image is locked - not used yet. |
static int |
IsMoveable
A property bit - The image is moveable (draggable). |
static int |
IsNotHot
A property bit - The image has no hot area. |
static int |
IsNotStill
A property bit - The image is not still, it is animated. |
static int |
IsPrepared
A property bit - The image is fully prepared. |
static int |
IsPreparing
A property bit - The image is being prepared. |
static int |
KeepOnScreen
A property bit - When refreshing this image, the associated Mosaic will scroll itself to keep the image fully visible (if possible). |
Rect |
lastDrawn
|
Rect |
location
|
Image |
mask
An image mask used for the image. |
static int |
MouseMustBeOver
A property bit - In order for a "drag over" event to be recognized, the mouse pointer must be over the image. |
int |
properties
This is used for setting properties of the mImage. |
static int |
RelativeToOrigin
A property bit - The image stays on the same spot on the screen, even if the mosaic scrolls. |
protected Image |
sourceImage
|
protected Image |
sourceMask
|
Color |
transparentColor
|
| Fields inherited from interface ewe.fx.IImage |
DISABLED, OUTLINED |
| Constructor Summary | |
mImage()
Create a new mImage(). |
|
mImage(IImage drawable)
Create a new mImage() for a specified IImage. |
|
mImage(IImage drawable,
int drawMode)
Create a new mImage() for the specified IImage. |
|
mImage(Image image,
int drawMode,
boolean imageMayChange)
|
|
mImage(String mi)
Create a new mImage() with the named image. |
|
mImage(String mi,
Color trans)
Create a new mImage() with the named image and specified transparent color. |
|
mImage(String mi,
String mm)
Create a new mImage() with the named image and mask. |
|
| Method Summary | |
boolean |
changeRefresher(ImageRefresher newRefresher,
ImageRefresher oldRefresher)
Change the ImageRefresher for the Image only if the old Refresher is the same as the one specified. |
int |
compareTo(Object other)
|
void |
copyFrom(Object other)
|
int |
decodeBytes(byte[] source,
int offset,
int length)
|
void |
doDraw(Graphics g,
int options)
Bottom level draw. |
void |
draw(Graphics g)
Draws itself on the graphic g at the point specified by the variable "location". |
void |
draw(Graphics g,
int x,
int y,
int options)
Draws itself on the graphic g at a specfied co-ordinate. |
void |
drawBorder(Graphics g,
int x,
int y,
int options)
Draws the border of the image. |
void |
drawn(Rect where)
|
int |
encodeBytes(ByteArray dest)
This requests the Object to encode itself as a stream of bytes which is appended to the destination ByteArray. |
protected void |
fixColors()
|
void |
free()
This frees system resources associated with the Image. |
protected void |
freeIfNotOriginal()
|
void |
freeSource()
This will free the source image IF it is not being directly used by the mImage. |
Color |
getBackground()
This returns a background color if one is set for the image. |
static IImage |
getBrokenImage()
|
Object |
getCopy()
|
protected IImage |
getDefaultImage()
|
Rect |
getDim(Rect dest)
|
mImage |
getFullCopy()
This gets a copy which has copies of the image resources of this one. |
int |
getHeight()
This returns the height of the image. |
Area |
getHotArea()
The area returned here is not relative to the top left of the image. |
Point |
getLocation(Point dest)
Get the X,Y location of the mImage. |
Object |
getNew()
|
int[] |
getPixels(int[] dest,
int offset,
int x,
int y,
int width,
int height,
int options)
Retrieve the pixels from the Image in encoded ARGB values. |
ImageRefresher |
getRefresher()
Retrieve the ImageRefresher for the image which is weakly referenced by the OnScreenImage. |
Dimension |
getSize(Dimension dest)
Get the width and height of the mImage. |
static IImage |
getUnknownImage()
|
protected Color |
getUnusedColor()
|
int |
getWidth()
This returns the width of the image. |
void |
imageSet()
|
Area |
makeOpaqueHotArea(mImage template)
This sets the hot area to be within the image and include only the opaque portions of the image. |
boolean |
onHotArea(int x,
int y)
Returns if the point is on the hot area of the image. |
protected void |
refresh(ImageRefresher on)
|
mImage |
scale(int newWidth,
int newHeight,
Rect area,
int imageAndScaleOptions)
Produce a new mImage that is a scaled version of a section of this one. |
void |
setHotAreaInImage(Area inImage)
|
void |
setImage(IImage im)
|
void |
setImage(Image im)
Set the Image for the mImage. |
void |
setImage(Image im,
Color transparent)
|
void |
setImage(Image im,
Image msk)
This sets the mask image for the mImage. |
void |
setImage(Image im,
int drawMode)
|
void |
setImage(Image im,
int drawMode,
boolean imageMayChange)
|
void |
setImage(Image im,
Mask mask)
|
void |
setMImage(mImage other)
|
void |
setRefresher(ImageRefresher refresher)
Weakly set the ImageRefresher for the Image. |
Image |
toAlphaImage(Rect area,
int imageCreationOptions)
Convert the mImage to a single Image with an alpha channel. |
Object |
toCursor(Point hotSpot)
This transforms the image into a mouse cursor suitable for use on the current platform. |
String |
toString()
Return a String representation of this object. |
boolean |
usesAlpha()
Returns whether the image uses the Alpha channel. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode |
| Field Detail |
public Image image
public Image mask
public Mask bitmask
public IImage drawable
public int properties
public Color transparentColor
public Color backgroundColor
public static final int IsPreparing
public static final int IsPrepared
public static final int IsInvisible
public static final int HasBorder
public static final int IsEmpty
public static final int AlwaysOnTop
public static final int InUse
public static final int IsNotHot
public static final int IsMoveable
public static final int IsLocked
public static final int CompletelyIn
public static final int HasMoved
public static final int HasChanged
public static final int IsNotStill
public static final int RelativeToOrigin
public static final int MouseMustBeOver
public static final int KeepOnScreen
public static final int IsAnimated
public Rect location
public Rect lastDrawn
public int drawMode
protected Image sourceImage
protected Image sourceMask
protected boolean imageMayChange
public Area hotArea
public Polygon hotPolygon
| Constructor Detail |
public mImage()
public mImage(String mi,
String mm)
throws IllegalArgumentException
mi - The name of the image.mm - The name of the mask - which can be null.
IllegalArgumentException - if the image named by mi or mm is invalid.
public mImage(String mi,
Color trans)
throws IllegalArgumentException
mi - The name of the image.trans - The transparent color.
IllegalArgumentException - if the image named by mi is invalid.
public mImage(String mi)
throws IllegalArgumentException
mi - The name of the image.
IllegalArgumentException - if the image named by mi is invalid.public mImage(IImage drawable)
drawable - The drawable
public mImage(IImage drawable,
int drawMode)
drawable - The drawable.drawMode - The draw mode for drawing. If this is Graphics.DRAW_ALPHA and the drawable
has an alpha channel, then alpha blending will be used for drawing - if supported by the underlying
system.
public mImage(Image image,
int drawMode,
boolean imageMayChange)
| Method Detail |
public Point getLocation(Point dest)
dest - An optional destination Point object.
public Dimension getSize(Dimension dest)
dest - An optional destination Dimension object.
public int getHeight()
IImage
getHeight in interface IImagepublic int getWidth()
IImage
getWidth in interface IImagepublic void freeSource()
You would normally call this after creating the mImage, if you are sure the source Image is not to be used again.
protected void freeIfNotOriginal()
public Object getNew()
public Object getCopy()
public void drawn(Rect where)
public void setImage(Image im,
Mask mask)
public void setImage(Image im,
Color transparent)
public void setImage(IImage im)
public void setImage(Image im,
Image msk)
msk - The user image mask with black pixels for opaque and white pixels for transparent.
public void setImage(Image im,
int drawMode)
public void setImage(Image im,
int drawMode,
boolean imageMayChange)
public void setImage(Image im)
im - The image to set.public Color getBackground()
IImage
getBackground in interface IImagepublic void setMImage(mImage other)
public void imageSet()
public void copyFrom(Object other)
public void drawBorder(Graphics g,
int x,
int y,
int options)
public void doDraw(Graphics g,
int options)
public void draw(Graphics g,
int x,
int y,
int options)
draw in interface IImagepublic void draw(Graphics g)
public void setHotAreaInImage(Area inImage)
public Area makeOpaqueHotArea(mImage template)
public Area getHotArea()
public boolean onHotArea(int x,
int y)
public Rect getDim(Rect dest)
public int compareTo(Object other)
public Object toCursor(Point hotSpot)
This will free this mImage!
public void free()
IImage
free in interface IImagepublic mImage getFullCopy()
public boolean usesAlpha()
IImage
usesAlpha in interface IImageprotected Color getUnusedColor()
public int[] getPixels(int[] dest,
int offset,
int x,
int y,
int width,
int height,
int options)
IImage
getPixels in interface IImagedest - The destination int array. If this is null then a new array should be created.offset - The offset into the array to start placing pixels.x - the x co-ordinate within the image.y - the y co-ordinate within the image.width - the width of the pixel block to get.height - the height of the pixel block to get.options - options for retrieving pixels - currently unused.
public Image toAlphaImage(Rect area,
int imageCreationOptions)
throws IllegalArgumentException
area - an area within the image to convert. If this is null it will use the entire image.imageCreationOptions - options to use when creating the new Image.
IllegalArgumentException
public mImage scale(int newWidth,
int newHeight,
Rect area,
int imageAndScaleOptions)
throws IllegalArgumentException
newWidth - newHeight - area - An area within the image to scale - or null to scale the entire image.
IllegalArgumentException - if the area is out of bounds, or if the new size has negative values.protected void fixColors()
public static IImage getUnknownImage()
public static IImage getBrokenImage()
protected IImage getDefaultImage()
public int encodeBytes(ByteArray dest)
ByteEncodable
encodeBytes in interface ByteEncodabledest - The destination ByteArray, or null to determine the number of bytes needed to encode.
public int decodeBytes(byte[] source,
int offset,
int length)
public String toString()
Object
toString in class Objectpublic void setRefresher(ImageRefresher refresher)
OnScreenImage
setRefresher in interface OnScreenImage
public boolean changeRefresher(ImageRefresher newRefresher,
ImageRefresher oldRefresher)
OnScreenImage
changeRefresher in interface OnScreenImagenewRefresher - The new ImageRefresher for the image.oldRefresher - What the old ImageRefresher was expected to be.
public ImageRefresher getRefresher()
OnScreenImage
getRefresher in interface OnScreenImageprotected void refresh(ImageRefresher on)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||