ewe.graphics
Class AniImage

java.lang.Object
  extended byewe.fx.mImage
      extended byewe.graphics.AniImage
All Implemented Interfaces:
ByteEncodable, IImage, OnScreenImage
Direct Known Subclasses:
AnimatedIcon, PolygonImage

public class AniImage
extends mImage


Nested Class Summary
static interface AniImage.ImageRefresher
          Deprecated. use ewe.fx.ImageRefresher instead.
 
Field Summary
 Control displayControl
           
 Rect limits
          Gets the bounds of the hot area.
 Mosaic mosaic
           
 AniImage.ImageRefresher refresher
          Deprecated. use setRefresher() with a ewe.fx.ImageRefresher object.
 Point relativeToOrigin
           
 
Fields inherited from class ewe.fx.mImage
AlwaysOnTop, backgroundColor, bitmask, CompletelyIn, drawable, drawMode, HasBorder, HasChanged, HasMoved, hotArea, hotPolygon, image, imageMayChange, InUse, IsAnimated, IsEmpty, IsInvisible, IsLocked, IsMoveable, IsNotHot, IsNotStill, IsPrepared, IsPreparing, KeepOnScreen, lastDrawn, location, mask, MouseMustBeOver, properties, RelativeToOrigin, sourceImage, sourceMask, transparentColor
 
Fields inherited from interface ewe.fx.IImage
DISABLED, OUTLINED
 
Constructor Summary
AniImage()
           
AniImage(IImage image)
           
AniImage(IImage image, int drawMode)
           
AniImage(Image image, int drawMode, boolean imageMayChange)
           
AniImage(String image)
           
AniImage(String image, Color transparent)
           
AniImage(String image, String mask)
           
 
Method Summary
 ImageMover animateMoveTo(int destinationX, int destinationY, int timeToMoveInMillis)
          Move this AniImage to a new location, moving it on screen within a certain time period.
 boolean canGo(Point where)
           
 void change(IImage newImage)
           
 void change(Image newImage)
          Changes the image.
 void change(Image newImage, Image newMask)
          Changes the image.
 void changed()
          Marks the image as having been changed in some way.
 void closing()
          This is called if the AniImage is displayed within an ImageControl and the Form that contained that ImageControl is now closing.
 Rect getMovedBounds()
           
 Object getNew()
           
 boolean hasARefresher()
          This returns true if there is some object that can refresh the image on screen.
 boolean isCompletelyWithin(AniImage other)
          Returns if this AniImage is completely within the other AniImage.
 boolean isDraggedOver(AniImage draggingOver, Point mouseLocation)
           
 boolean isIn(Point p)
           
 boolean isTouching(AniImage other)
          Returns if this AniImage is touching the other AniImage.
 boolean isWithin(AniImage other)
          Returns if this AniImage is "within" the other AniImage - where "within" is "touching" if CompletelyIn property is not set, otherwise it is "isCompletelyWithin".
 void move(int x, int y)
          Moves the image.
 void refresh()
           
 boolean refreshNow()
          Refresh the AniImage.
 void resize(int width, int height)
          Resize the image.
 void setLocation(int x, int y)
          This resets the location of the image.
 void shown()
          This is called if the AniImage is displayed within an ImageControl and that ImageControl has now been shown.
 void translate(int dx, int dy)
          Translates the image.
 void updated()
          Marks the image as not having been changed.
 
Methods inherited from class ewe.fx.mImage
changeRefresher, compareTo, copyFrom, decodeBytes, doDraw, draw, draw, drawBorder, drawn, encodeBytes, fixColors, free, freeIfNotOriginal, freeSource, getBackground, getBrokenImage, getCopy, getDefaultImage, getDim, getFullCopy, getHeight, getHotArea, getLocation, getPixels, getRefresher, getSize, getUnknownImage, getUnusedColor, getWidth, imageSet, makeOpaqueHotArea, onHotArea, refresh, scale, setHotAreaInImage, setImage, setImage, setImage, setImage, setImage, setImage, setImage, setMImage, setRefresher, toAlphaImage, toCursor, toString, usesAlpha
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode
 

Field Detail

limits

public Rect limits
Gets the bounds of the hot area.


relativeToOrigin

public Point relativeToOrigin

mosaic

public Mosaic mosaic

displayControl

public Control displayControl

refresher

public AniImage.ImageRefresher refresher
Deprecated. use setRefresher() with a ewe.fx.ImageRefresher object.

Constructor Detail

AniImage

public AniImage()

AniImage

public AniImage(String image,
                String mask)
         throws IllegalArgumentException

AniImage

public AniImage(String image)
         throws IllegalArgumentException

AniImage

public AniImage(String image,
                Color transparent)
         throws IllegalArgumentException

AniImage

public AniImage(Image image,
                int drawMode,
                boolean imageMayChange)

AniImage

public AniImage(IImage image,
                int drawMode)

AniImage

public AniImage(IImage image)
Method Detail

getNew

public Object getNew()
Overrides:
getNew in class mImage

canGo

public boolean canGo(Point where)

isTouching

public boolean isTouching(AniImage other)
Returns if this AniImage is touching the other AniImage.


isCompletelyWithin

public final boolean isCompletelyWithin(AniImage other)
Returns if this AniImage is completely within the other AniImage.


isWithin

public final boolean isWithin(AniImage other)
Returns if this AniImage is "within" the other AniImage - where "within" is "touching" if CompletelyIn property is not set, otherwise it is "isCompletelyWithin".


isIn

public final boolean isIn(Point p)

isDraggedOver

public final boolean isDraggedOver(AniImage draggingOver,
                                   Point mouseLocation)

changed

public void changed()
Marks the image as having been changed in some way. This will cause the image to be refreshed when calling updateImage()/updateImages()


updated

public void updated()
Marks the image as not having been changed.


move

public void move(int x,
                 int y)
Moves the image. If the new location is different to the current location then the HasMoved bit in properties will be set. It will NOT clear this bit if the image actually has not moved. This bit must be cleared manually.


change

public void change(Image newImage)
Changes the image. If it has changed then HasChanged will be set in the properties. If it has not changed there is no effect on this bit.


change

public void change(Image newImage,
                   Image newMask)
Changes the image. If it has changed then HasChanged will be set in the properties. If it has not changed there is no effect on this bit.


change

public void change(IImage newImage)

resize

public void resize(int width,
                   int height)
Resize the image. Do not do this while the image is being displayed. It should be used before adding the image to the mosaic if for example the image is a buffer which is larger than actually needed.


translate

public void translate(int dx,
                      int dy)
Translates the image. The variable previous will hold a list of the locations of the image before it was moved. If the new location is different to the current location then the HasMoved bit in properties will be set. It will NOT clear this bit if the image actually has not moved. This bit must be cleared manually.


setLocation

public void setLocation(int x,
                        int y)
This resets the location of the image. The HasMoved bit in properties will be cleared.


getMovedBounds

public Rect getMovedBounds()

hasARefresher

public boolean hasARefresher()
This returns true if there is some object that can refresh the image on screen. It will check the mosaic, displayControl and refresher fields. If they are all null it will return false.


refresh

public void refresh()

shown

public void shown()
This is called if the AniImage is displayed within an ImageControl and that ImageControl has now been shown.


closing

public void closing()
This is called if the AniImage is displayed within an ImageControl and the Form that contained that ImageControl is now closing.


refreshNow

public boolean refreshNow()
Refresh the AniImage.

Returns:
true if there was a refresher to refresh the image, false if there was no refresher

animateMoveTo

public ImageMover animateMoveTo(int destinationX,
                                int destinationY,
                                int timeToMoveInMillis)
Move this AniImage to a new location, moving it on screen within a certain time period. This returns an ImageMover which is a Task object (an asynchronous task). You must call startTask() on it to start the move and you can call waitUntilStopped() on the returned Handle to wait until the move is complete. You can also call stop() on the Handle to abort the move and there are other options you can change as well.

Parameters:
destinationX - The destination X position.
destinationY - The destination Y position.
timeToMoveInMillis - How long to take to move it in milliseconds.
Returns:
An ImageMover object which you must call start() on