|
PulpCore | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectpulpcore.image.CoreImage
pulpcore.image.AnimatedImage
public class AnimatedImage
An AnimatedImage is a CoreImage that contains multiple frames of animation. Frames are either physical or virtual.
| Constructor Summary | |
|---|---|
AnimatedImage(AnimatedImage image)
Creates a copy of the specified AnimatedImage. |
|
AnimatedImage(CoreImage[] frames)
Creates an AnimatedImage from a list of images. |
|
AnimatedImage(CoreImage image,
int numFramesAcross,
int numFramesDown)
Creates an AnimatedImage by spliting a image into frames on a grid. |
|
| Method Summary | |
|---|---|
CoreImage |
background(int argbColor)
|
CoreImage |
crop(int x,
int y,
int w,
int h)
Creates a cropped version of this image. |
CoreImage |
fade(int alpha)
|
CoreImage |
flip()
Returns a new CoreImage whose raster data represents a flipped version of this image. |
int |
getDuration()
Gets the total duration of this AnimatedImage. |
int |
getDuration(int frame)
Gets the duration of the specified virtual frame. |
int |
getFrame()
Gets the current frame. |
CoreImage |
getImage(int frame)
Gets the image for the specified virtual frame. |
int |
getNumFrames()
Gets the number of frames in this AnimatedImage. |
CoreImage |
halfSize()
Returns a new CoreImage whose raster data represents a 50% scaled version of this image. |
boolean |
isLooping()
Returns true if this AnimatedImage loops. |
boolean |
isPlaying()
Returns true if this AnimatedImage is currently playing. |
CoreImage |
mirror()
Returns a new CoreImage whose raster data represents a mirrored version of this image. |
void |
pause()
Stops the animation without changing the current frame. |
CoreImage |
rotate(int angle,
boolean sizeAsNeeded)
Creates a rotated version of this image. |
CoreImage |
rotate180()
Returns a new CoreImage whose raster data represents this image rotated 180 degrees. |
CoreImage |
rotateLeft()
Returns a new CoreImage whose raster data represents this image rotated to the left (counter-clockwise 90 degrees). |
CoreImage |
rotateRight()
Returns a new CoreImage whose raster data represents this image rotated to the right (clockwise 90 degrees). |
CoreImage |
scale(int scaledFrameWidth,
int scaledFrameHeight)
Returns a new CoreImage whose raster data represents a scaled version of this image. |
void |
setFrame(int frame)
Sets the current frame. |
void |
setFrameDuration(int duration,
boolean loop)
Sets the duration for each physical frame, and optionally sets the animation to loop. |
void |
setSequence(int[] frameSequence,
int[] frameDuration,
boolean loop)
Sets the frame sequence (virtual frames), the duration for each virtual frame, and optionally sets the animation to loop. |
CoreImage |
setTransparentColor(int rgbColor)
Returns a new CoreImage with all the opaque pixels of the specified color set to transparent. |
void |
start()
Starts playing the animation. |
void |
stop()
Stops the animation and sets the frame to zero. |
CoreImage |
tint(int rgbColor)
Returns a new CoreImage with every color set to the specified color, without changing the alpha of each color. |
boolean |
update(int elapsedTime)
Does nothing by default. |
| Methods inherited from class pulpcore.image.CoreImage |
|---|
createGraphics, expandCanvas, expandCanvas, getARGB, getBrokenImage, getData, getHeight, getHotspotX, getHotspotY, getWidth, isOpaque, isTransparent, load, rotate, rotate, rotate, scale, setHotspot, split, split |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AnimatedImage(CoreImage[] frames)
IllegalArgumentException - if not all the images have the same dimensions.public AnimatedImage(AnimatedImage image)
public AnimatedImage(CoreImage image,
int numFramesAcross,
int numFramesDown)
| Method Detail |
|---|
public void setFrameDuration(int duration,
boolean loop)
public void setSequence(int[] frameSequence,
int[] frameDuration,
boolean loop)
frameSequence - an array where each element points to an index in the list of
physical frames. Can be null.frameDuration - the duration of each virtual frame. If frameSequence is not null,
frameDuration must be the same length as frameSequence. If frameSequence is null,
frameDuration must be the same length as the number of physical frames.public boolean isLooping()
public int getNumFrames()
public int getDuration()
public int getDuration(int frame)
public CoreImage getImage(int frame)
public void setFrame(int frame)
public int getFrame()
public boolean update(int elapsedTime)
CoreImage
update in class CoreImagepublic boolean isPlaying()
start(),
stop(),
pause()public void start()
stop() or pause().
isPlaying(),
stop(),
pause()public void pause()
isPlaying(),
start(),
stop()public void stop()
isPlaying(),
start(),
pause()
public CoreImage crop(int x,
int y,
int w,
int h)
CoreImage
crop in class CoreImage
public CoreImage rotate(int angle,
boolean sizeAsNeeded)
CoreImage
rotate in class CoreImageangle - a fixed-point angle, typically in the range from 0 to
CoreMath.TWO_PI.sizeAsNeeded - if true, the resulting image is sized to contain
the entire rotated image. If false, the resulting image is the same
size as this image. The hotspot is rotated accordingly.public CoreImage halfSize()
CoreImage
halfSize in class CoreImage
public CoreImage scale(int scaledFrameWidth,
int scaledFrameHeight)
CoreImage
scale in class CoreImagepublic CoreImage mirror()
CoreImage
mirror in class CoreImagepublic CoreImage flip()
CoreImage
flip in class CoreImagepublic CoreImage rotateLeft()
CoreImage
rotateLeft in class CoreImagepublic CoreImage rotateRight()
CoreImage
rotateRight in class CoreImagepublic CoreImage rotate180()
CoreImage
rotate180 in class CoreImagepublic CoreImage setTransparentColor(int rgbColor)
CoreImage
setTransparentColor in class CoreImagergbColor - The color to convert to transparent. The alpha component is ignored.
public CoreImage tint(int rgbColor)
CoreImage
tint in class CoreImagepublic CoreImage background(int argbColor)
background in class CoreImagepublic CoreImage fade(int alpha)
fade in class CoreImage
|
PulpCore | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||