|
|||||||||
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 Image |
background
Background image. |
protected Graphics |
bgGfx
Background graphic context. |
protected int |
curFrame
Current frame of the animation. |
int |
drawOp
drawOp drawing operation used when the animation images are copied to the screen buffer. |
static int |
eventFinish
notify animation endings |
static int |
eventFrame
notify animation frames |
static int |
eventLoop
notify animation loops |
static int |
eventNone
no notify at all |
protected int |
eventsMask
Event notification mask, default value is eventFinish, that means that an event is posted only when the animation finishes. |
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. |
static int |
LOOPS_ONE_SHOT
start function "loops" argument special value to do one loop |
static int |
LOOPS_UNLIMITED
start function "loops" argument special value to loop endlessly |
protected int |
maxFrames
Maximum number of frames. |
protected boolean |
notifyEachFrame
Should each frame drawing be notified ? |
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(Image frames,
int frameWidth,
Color transColor,
int framePeriod)
Animation constructor. |
|
Animation(int maxFrames,
Color transColor,
int framePeriod)
Deprecated. will be removed in next release |
Method Summary | |
int |
addFrame(Image frame)
Deprecated. will be removed in next release |
int |
addMultiFrames(Image image,
int width)
Deprecated. will be removed in next release |
int |
addMultiFrames(String basename)
Deprecated. will be removed in next release |
void |
drawFrame(int frame)
Display a given frame. |
void |
enableEvents(int mask)
Enable the posting of events. |
int |
getPreferredHeight()
Returns the prefered height of this control. |
int |
getPreferredWidth()
Returns the prefered width of this control. |
boolean |
notifyEachFrame(boolean enable)
Deprecated. is replaced by notifyMask |
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)
Deprecated. will be removed in next release |
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)
Deprecated. replaced by : public void start(int loops) |
void |
start(int loops)
Starts the animation. |
void |
start(int[] frameSequence,
boolean loop)
Deprecated. replaced by : public void start(int frameSequence[],int loops) |
void |
start(int[] frameSequence,
int loops)
Starts the animation with a non standard frame sequence. |
void |
start(int sFrame,
int eFrame,
int step,
boolean loop)
Deprecated. replaced by : public void start(final int sFrame,final int eFrame,final int step,int loops) |
void |
start(int sFrame,
int eFrame,
int step,
int loops)
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
Graphics
public int framePeriod
protected int curFrame
public boolean isPlaying
public boolean isPaused
protected Color transColor
protected int maxFrames
protected Image[] framesBuffer
protected boolean notifyEachFrame
protected int eventsMask
public static final int eventNone
public static final int eventFinish
public static final int eventLoop
public static final int eventFrame
public static final int LOOPS_UNLIMITED
public static final int LOOPS_ONE_SHOT
protected Image background
protected Graphics bgGfx
Constructor Detail |
public Animation(int maxFrames, Color transColor, int framePeriod)
maxImages
- maximum number of framestransColor
- the transparency colorframePeriod
- delay in millisecconds between two framespublic Animation(Image frames, int frameWidth, Color transColor, int framePeriod)
frames
- single image containing all frames in mlti-frames BMP format.frameWidth
- width in pixels of one frame.transColor
- the transparency colorframePeriod
- delay in millisecconds between two framesGif2Bmps
Method Detail |
public void renew(int maxFrames) throws GameEngineException
public int size()
public int addFrame(Image frame) throws GameEngineException
image/frame
- to addpublic 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 drawingGraphics
public boolean notifyEachFrame(boolean enable)
public void enableEvents(int mask)
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 automaticalypublic void start(int[] frameSequence, boolean loop)
frameSequence
- frame numbers array which defines the frames sequenceloop
- indicator to restart the animation automaticaly when it ends.public void start(int loops)
loops
- integer value specifying the number of loops or LOOPS_UNLIMITED.LOOPS_UNLIMITED
public void start(int[] frameSequence, int loops)
frameSequence
- frame numbers array which defines the frames sequenceloops
- integer value specifying the number of loops or LOOPS_UNLIMITED.LOOPS_UNLIMITED
public void start(int sFrame, int eFrame, int step, int loops)
sFrame
- start frameeFrame
- end frameloops
- integer value specifying the number of loops or LOOPS_UNLIMITED.LOOPS_UNLIMITED
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 |