public final class Drawable extends Object
This class is Thread-Safe.
Modifier and Type | Method and Description |
---|---|
static Image |
loadImage(ImageBuffer surface)
Load an image from a java image (sharing the same surface).
|
static Image |
loadImage(Media media)
Load an image from a file.
|
static Sprite |
loadSprite(ImageBuffer surface)
Load a sprite from a buffered image (sharing the same surface).
|
static Sprite |
loadSprite(Media media)
Load a sprite from a file.
|
static SpriteAnimated |
loadSpriteAnimated(ImageBuffer surface,
int horizontalFrames,
int verticalFrames)
Load an animated sprite, giving horizontal and vertical frames (sharing the same surface).
|
static SpriteAnimated |
loadSpriteAnimated(Media media,
int horizontalFrames,
int verticalFrames)
Load an animated sprite from a file, giving horizontal and vertical frames.
|
static SpriteFont |
loadSpriteFont(Media media,
Media data,
int letterWidth,
int letterHeight)
Load a font based on an image.
|
static SpriteParallaxed |
loadSpriteParallaxed(Media media,
int linesNumber,
int startWidth,
int startHeight)
Load a parallaxed sprite, for parallax effect.
|
static SpriteTiled |
loadSpriteTiled(ImageBuffer surface,
int tileWidth,
int tileHeight)
Load a tiled sprite using an image reference, giving tile dimension (sharing the same surface).
|
static SpriteTiled |
loadSpriteTiled(Media media,
int tileWidth,
int tileHeight)
Load a tiled sprite from a file, giving tile dimension.
|
static void |
setDpi(DpiType dpi)
Set the DPI to use.
|
static void |
setDpi(Resolution baseline,
Config config)
Set the DPI to use.
|
public static void setDpi(Resolution baseline, Config config)
Resources has to be suffixed with "_DPI" before the extension. For example, baseline resources is "image.png", support for other DPI will need:
If there is not dedicated DPI resource, the baseline one will be use instead.
Must be set after engine started, before resource loading.
baseline
- The baseline resolution.config
- The configuration used.public static void setDpi(DpiType dpi)
Resources has to be suffixed with "_DPI" before the extension. For example, baseline resources is "image.png", support for other DPI will need:
If there is not dedicated DPI resource, the baseline one will be use instead.
Must be set after engine started, before resource loading.
dpi
- The DPI to use.public static Image loadImage(Media media)
Once created, image must call Image.load()
before any other operations.
media
- The image media.LionEngineException
- If an error occurred when reading the image.public static Image loadImage(ImageBuffer surface)
Image.load()
must not be called as surface has already been loaded.
surface
- The surface reference.LionEngineException
- If the surface is null
.public static Sprite loadSprite(Media media)
Once created, sprite must call Image.load()
before any other operations.
media
- The sprite media.LionEngineException
- If media is null
or image cannot be read.public static Sprite loadSprite(ImageBuffer surface)
Image.load()
must not be called as surface has already been loaded.
surface
- The surface reference.LionEngineException
- If surface is null
.public static SpriteAnimated loadSpriteAnimated(Media media, int horizontalFrames, int verticalFrames)
Once created, sprite must call Image.load()
before any other operations.
media
- The sprite media.horizontalFrames
- The number of horizontal frames.verticalFrames
- The number of vertical frames.LionEngineException
- If arguments are invalid or image cannot be read.public static SpriteAnimated loadSpriteAnimated(ImageBuffer surface, int horizontalFrames, int verticalFrames)
Image.load()
must not be called as surface has already been loaded.
surface
- The surface reference.horizontalFrames
- The number of horizontal frames.verticalFrames
- The number of vertical frames.LionEngineException
- If arguments are invalid.public static SpriteTiled loadSpriteTiled(Media media, int tileWidth, int tileHeight)
Once created, sprite must call Image.load()
before any other operations.
media
- The sprite media.tileWidth
- The tile width.tileHeight
- The tile height.LionEngineException
- If arguments are invalid or image cannot be read.public static SpriteTiled loadSpriteTiled(ImageBuffer surface, int tileWidth, int tileHeight)
Image.load()
must not be called as surface has already been loaded.
surface
- The surface reference.tileWidth
- The tile width.tileHeight
- The tile height.LionEngineException
- If arguments are invalid.public static SpriteParallaxed loadSpriteParallaxed(Media media, int linesNumber, int startWidth, int startHeight)
Once created, sprite must call SpriteParallaxed.load(boolean)
before any other operations.
media
- The sprite media.linesNumber
- The number of parallax lines.startWidth
- The starting width percent (100 is default, 50 is twice smaller, 200 is twice larger).startHeight
- The starting height percent (100 is default, 50 is twice smaller, 200 is twice larger).LionEngineException
- If arguments are invalid.public static SpriteFont loadSpriteFont(Media media, Media data, int letterWidth, int letterHeight)
Once created, sprite must call Image.load()
before any other operations.
media
- The font sprite media.data
- The font data media.letterWidth
- The font image letter width.letterHeight
- The font image letter height.LionEngineException
- If an error occurred when creating the font.Copyright © 2017 Byron 3D Games Studio. All rights reserved.