public class ParallaxedSpriteImpl extends java.lang.Object implements ParallaxedSprite
Constructor and Description |
---|
ParallaxedSpriteImpl(java.lang.String filename,
int numberOfLines,
int sx,
int sy) |
Modifier and Type | Method and Description |
---|---|
int |
getHeight()
Get the image height size.
|
int |
getHeightOriginal()
Get the current sprite height (its current size, after scaling operation).
|
java.awt.image.BufferedImage |
getLine(int line)
Get a line a parallax.
|
int |
getWidth()
Get the image width size.
|
int |
getWidthOriginal()
Get the current sprite width (its current size, after scaling operation).
|
void |
prepare(Filter filter)
Update all changes; need to be called when changes are done.
|
void |
render(java.awt.Graphics2D g,
int x,
int y)
Render image on current graphic output, at specified coordinates.
|
void |
render(java.awt.Graphics2D g,
int line,
int x,
int y)
Render a line of parallax to the specified coordinates.
|
void |
scale(int percent)
Method used for sprite scaling, in order to modify its size.
|
void |
stretch(int widthPercent,
int heightPercent)
Works as scale, but using differents width and height factor.
|
public ParallaxedSpriteImpl(java.lang.String filename, int numberOfLines, int sx, int sy)
public void scale(int percent)
ParallaxedSprite
scale
in interface ParallaxedSprite
percent
- value for scaling.public void stretch(int widthPercent, int heightPercent)
ParallaxedSprite
stretch
in interface ParallaxedSprite
widthPercent
- percent value for scaling width.heightPercent
- percent value for scaling height.public void prepare(Filter filter)
ParallaxedSprite
prepare
in interface ParallaxedSprite
filter
- filter to use.public void render(java.awt.Graphics2D g, int x, int y)
Renderable
render
in interface Renderable
g
- graphic output.x
- abscissa.y
- ordinate.public void render(java.awt.Graphics2D g, int line, int x, int y)
ParallaxedSprite
render
in interface ParallaxedSprite
g
- graphic output.line
- line to render.x
- abscissa.y
- ordinate.public int getWidth()
Renderable
getWidth
in interface Renderable
public int getHeight()
Renderable
getHeight
in interface Renderable
public int getWidthOriginal()
ParallaxedSprite
getWidthOriginal
in interface ParallaxedSprite
public int getHeightOriginal()
ParallaxedSprite
getHeightOriginal
in interface ParallaxedSprite
public java.awt.image.BufferedImage getLine(int line)
ParallaxedSprite
getLine
in interface ParallaxedSprite
line
- desired line.