|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--waba.ui.Control
|
+--superwaba.ext.xplat.game.Animation
The Animation control class.
This control displays an animation that can be loaded from indexed BMP files (one frame per image) or by a multi-frames BMP. This kind of BMP file contains a list of images having all the same size and that lay side by side. You may use the Gif2Bmps tool in \superwaba\apps\xplat\Gif2Bmps folder to convert animated gif into the convenient format. warning: multi-frames BMP files can't be larger than 64Kb (the palmOS record limit)
Gif2Bmps| Field Summary | |
protected int |
curFrame
Current frame of the animation. |
int |
drawOp
drawOp drawing operation used when the animation images are copied to the screen buffer. |
int |
framePeriod
Delay between two frames. |
protected Image[] |
framesBuffer
Frames buffer, all frames must have the same size. |
boolean |
isPaused
Reflects the animation pause state. |
boolean |
isPlaying
Reflects the animation play state. |
protected int |
maxFrames
Maximum number of frames. |
protected Color |
transColor
Transparency color. |
| Fields inherited from class waba.ui.Control |
AFTER,
appId,
asContainer,
asWindow,
backColor,
backDis,
BEFORE,
BOTTOM,
CENTER,
enabled,
FILL,
FIT,
fm,
fmH,
focusLess,
font,
foreColor,
foreDis,
height,
LEFT,
parent,
PREFERRED,
RANGE,
RIGHT,
SAME,
TOP,
visible,
width,
x,
x2,
y,
y2 |
| Constructor Summary | |
Animation(int maxFrames,
Color transColor,
int framePeriod)
Animation constructor. |
|
| Method Summary | |
int |
addFrame(Image frame)
Add a frame to the animation. |
int |
addMultiFrames(Image image,
int width)
Add several frames to the animation. |
int |
addMultiFrames(String basename)
Add several frames to the animation. |
void |
drawFrame(int frame)
Display a given frame. |
int |
getPreferredHeight()
Returns the prefered height of this control. |
int |
getPreferredWidth()
Returns the prefered width of this control. |
boolean |
notifyEachFrame(boolean enable)
Enable the posting of frame displayed events. |
void |
onPaint(Graphics gfx)
Called by the system to draw the animation. |
void |
pause()
Pauses a running animation. if the application is not playing, this call has no effect. |
void |
renew(int maxFrames)
Clear the animation to add new frames. |
void |
resume()
Resumes a paused animation. if the application is not playing, this call has no effect. |
int |
setFrames(Image[] frames)
Add several frames to the animation. |
int |
size()
Number of frames in the animation. |
static Image[] |
splitImage(Image original,
int frameWidth)
This is a static helper function that divides a multi-frames BMP into distinguished Images. The original image size should be a multiple of the frame width. |
void |
start(boolean loop)
Starts the animation. |
void |
start(int[] frameSequence,
boolean loop)
Starts the animation with a non standard frame sequence. |
void |
start(int sFrame,
int eFrame,
int step,
boolean loop)
Starts the animation with a frame range. |
void |
stop()
Stops the animation. if the application is not playing, this call has no effect. |
| Methods inherited from class waba.ui.Control |
addTimer,
contains,
createGraphics,
getAbsoluteRect,
getBackColor,
getFont,
getFontMetrics,
getForeColor,
getNext,
getParent,
getParentWindow,
getPos,
getRect,
getSize,
isDisplayed,
isEnabled,
isVisible,
onBoundsChanged,
onColorsChanged,
onEvent,
onFontChanged,
onWindowPaintFinished,
postEvent,
removeTimer,
repaint,
repaintNow,
requestFocus,
setBackColor,
setBackForeColors,
setEnabled,
setFocusLess,
setFont,
setForeColor,
setRect,
setRect,
setRect,
setVisible |
| Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
toString,
wait,
wait |
| Field Detail |
public int drawOp
Graphicspublic int framePeriod
protected int curFrame
public boolean isPlaying
public boolean isPaused
protected Color transColor
protected int maxFrames
protected Image[] framesBuffer
| Constructor Detail |
public Animation(int maxFrames,
Color transColor,
int framePeriod)
maxImages - maximum number of framestransColor - the transparency colorframePeriod - delay in millisecconds between two frames| Method Detail |
public void renew(int maxFrames)
throws GameEngineException
public int size()
public int addFrame(Image frame)
throws GameEngineException
image/frame - to add
public int addMultiFrames(String basename)
throws GameEngineException
basename - of the image filenames (ie. "myFrame")This tool can convert animated gif files to
such a numbered collection of BMP files.
public int addMultiFrames(Image image,
int width)
throws GameEngineException
image - multi-frames BMP file ( < 64K palmOS record limit)width - of one frameThis tool can convert animated gif files to
such a numbered collection of BMP files.
public int setFrames(Image[] frames)
throws GameEngineException
frames - to addpublic int getPreferredWidth()
public int getPreferredHeight()
public void drawFrame(int frame)
frame - index to display.public void onPaint(Graphics gfx)
g - the graphics object for drawingGraphicspublic boolean notifyEachFrame(boolean enable)
public void pause()
public void resume()
public void stop()
public void start(boolean loop)
loop - indicator to restart the animation automaticaly when it ends.
public void start(int sFrame,
int eFrame,
int step,
boolean loop)
sFrame - start frameeFrame - end frameloop - true means that the animations restarts automaticaly
public void start(int[] frameSequence,
boolean loop)
public static Image[] splitImage(Image original,
int frameWidth)
original - multi-frames image.frameWidth - the width of a single frame.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||