|
GF4J 0.9.4 Beta | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gameframe.graphics.AnimBitmap
Implementation of an animated bitmap. Has multiple animation modes like ping-pong, one shot or looping. It implements the Bitmap interface and adds methods for handling the animation.
Field Summary | |
static int |
DIR_FORWARD
Enumerated direction of the animation. |
static int |
DIR_REVERSE
Enumerated direction of the animation. |
static int |
DIR_STOPPED
Enumerated direction of the animation. |
static int |
MODE_LOOP
Enumerated animation mode. |
static int |
MODE_ONCE
Enumerated animation mode. |
static int |
MODE_PING_PONG
Enumerated animation mode. |
Constructor Summary | |
AnimBitmap(Bitmap[] bitmaps)
Constructs an animated bitmap from the series of Bitmap objects given. |
|
AnimBitmap(Bitmap tiledBitmap,
int cellWidth,
int cellHeight)
Constructs an animated bitmap from the given Bitmap that contains the animation cells. |
Method Summary | |
void |
advanceFrames(float flNumFrames)
Advances the animation the number of frames given to the direction it is configured to go. |
void |
advanceFrames(int iNumFrames)
Deprecated. Use advanceFrames( float ) instead of the advanceFrames( int ) version. |
void |
blitTo(DrawableBitmap bitmap,
int x,
int y)
Draws the currently shown bitmap to the given drawable bitmap at the given location. |
void |
blitTo(int x,
int y)
Draws the currently shown bitmap to the graphics engine that loaded it at the given location. |
void |
finalize()
Frees all the resources that are used by the animated bitmap implementation. |
Bitmap[] |
getBitmapClones()
Returns a copy of the used bitmaps in the animation. |
Bitmap |
getClone(BitmapEffect effect)
Returns an effect processed copy of the currently shown bitmap. |
int |
getDirection()
Returns the animation direction of this animated bitmap. |
int |
getHeight()
Returns the height of the currently shown bitmap. |
int |
getMode()
Returns the animation mode of this animated bitmap. |
Bitmap |
getSubBitmap(int srcX,
int srcY,
int srcWidth,
int srcHeight)
Returns the subbitmap of the current animation frame. |
Bitmap |
getSubBitmapClone(int srcX,
int srcY,
int srcWidth,
int srcHeight)
Returns the subbitmap clone of the current animation frame. |
int |
getWidth()
Returns the width of the currently shown bitmap. |
void |
nextFrame()
Advances the animation one frame to the direction it is configured to go. |
void |
playForward()
Tells the animation to play forward (from first animation cell to the last). |
void |
playReverse()
Tells the animation to play backwards (from last animation cell to the first). |
void |
setMode(int eMode)
Sets the animation mode of this animated bitmap. |
void |
stop()
Stops the animation. |
void |
strecthTo(DrawableBitmap bitmap,
int x,
int y,
int width,
int height)
Draws the currently shown bitmap to the given drawable bitmap at the given location at the given size. |
void |
strecthTo(int x,
int y,
int width,
int height)
Draws the currently shown bitmap to the graphics engine that loaded it at the given location and at the given size. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int MODE_LOOP
public static final int MODE_ONCE
public static final int MODE_PING_PONG
public static final int DIR_REVERSE
public static final int DIR_STOPPED
public static final int DIR_FORWARD
Constructor Detail |
public AnimBitmap(Bitmap[] bitmaps) throws GameFrameException
bitmaps
- The array of bitmaps to use.GameFrameException
- when something goes wrong. Note: In this case
the animated bitmap is not initialized and is not usable.public AnimBitmap(Bitmap tiledBitmap, int cellWidth, int cellHeight) throws GameFrameException
tiledBitmap
- The bitmap containing the animation cells to use.cellWidth
- The width of one animation cell in the tiled bitmap.cellHeight
- The height of one animation cell in the tiled bitmap.GameFrameException
- when something goes wrong. Note: In this case
the animated bitmap is not initialized and is not usable.Method Detail |
public void setMode(int eMode)
eMode
- An enumerated value of MODE_xxx type.public int getMode()
public Bitmap[] getBitmapClones() throws GameFrameException
GameFrameException
- thrown if cloning isn't successfull.public void stop()
public void playForward()
public void playReverse()
public int getDirection()
public void nextFrame()
public void advanceFrames(int iNumFrames)
iNumFrames
- Positive number of frames to advance.advanceFrames(float)
public void advanceFrames(float flNumFrames)
flNumFrames
- Positive number of frames to advance.public void blitTo(int x, int y)
blitTo
in interface Bitmap
x
- The x-coordinate of the location where the image is drawn to.y
- The y-coordinate of the location where the image is drawn to.public void strecthTo(int x, int y, int width, int height)
strecthTo
in interface Bitmap
x
- The x-coordinate of the location where the image is drawn to.y
- The y-coordinate of the location where the image is drawn to.width
- The with that is used when drawing the image.height
- The height that is used when drawing the image.public void blitTo(DrawableBitmap bitmap, int x, int y)
blitTo
in interface Bitmap
bitmap
- The bitmap that will be drawn to.x
- The x-coordinate of the location where the image is drawn to.y
- The y-coordinate of the location where the image is drawn to.public void strecthTo(DrawableBitmap bitmap, int x, int y, int width, int height)
strecthTo
in interface Bitmap
bitmap
- The bitmap that will be drawn to.x
- The x-coordinate of the location where the image is drawn to.y
- The y-coordinate of the location where the image is drawn to.width
- The with that is used when drawing the image.height
- The height that is used when drawing the image.public int getWidth()
getWidth
in interface Bitmap
public int getHeight()
getHeight
in interface Bitmap
Bitmap.getHeight()
public Bitmap getClone(BitmapEffect effect) throws GameFrameException
Returns an effect processed copy of the currently shown bitmap. This operation copies the actual bitmap data to a new memory location in a processed form and thus consumes memory.
Usually used to save graphics drawing time on game graphics as one can generate an animation sequence on the fly using gradual effects.
getClone
in interface Bitmap
effect
- The bitmap effect to be applied to the clone bitmap,
or null if none are to be applied.GameFrameException
- thrown if any errors occur.Bitmap.getHeight()
public Bitmap getSubBitmapClone(int srcX, int srcY, int srcWidth, int srcHeight) throws GameFrameException
getSubBitmapClone
in interface Bitmap
srcX
- The leftmost coordinate of the currently shown bitmap to be returned as a new bitmap.srcY
- The topmost coordinate of the currently shown bitmap to be returned as a new bitmap.srcWidth
- The width of the currently shown bitmap to be returned as a new bitmap.srcHeight
- The height of the currently shown bitmap to be returned as a new bitmap.GameFrameException
- Thrown if clone sub-bitmap creation is not successfull.Bitmap.getSubBitmapClone(int, int, int, int)
public Bitmap getSubBitmap(int srcX, int srcY, int srcWidth, int srcHeight) throws GameFrameException
getSubBitmap
in interface Bitmap
srcX
- The leftmost coordinate of the currently shown bitmap to be returned as a new bitmap.srcY
- The topmost coordinate of the currently shown bitmap to be returned as a new bitmap.srcWidth
- The width of the currently shown bitmap to be returned as a new bitmap.srcHeight
- The height of the currently shown bitmap to be returned as a new bitmap.GameFrameException
- Thrown if sub-bitmap creation is not successfull.Bitmap.getSubBitmap(int, int, int, int)
public void finalize()
finalize
in interface Bitmap
|
GF4J 0.9.4 Beta | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |