java.lang.Object
technology.sola.engine.graphics.Canvas
technology.sola.engine.assets.graphics.SolaImage
- All Implemented Interfaces:
Asset
SolaImage is an
Asset
that holds pixel data for an image.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The number of cached resizes this image with hold. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetSubImage
(int x, int y, int width, int height) Creates a newSolaImage
that is a sub-image of thisSolaImage
.resize
(int newWidth, int newHeight) Resizes this image to a new width and height.scale
(float scaleX, float scaleY) Scales this image by an x-axis and y-axis scale factor.void
setPixels
(int width, int height, int[] pixels) Manually set the pixel data in this image.
-
Field Details
-
CACHE_SIZE
public static final int CACHE_SIZEThe number of cached resizes this image with hold.- See Also:
-
-
Constructor Details
-
SolaImage
public SolaImage(int width, int height) Creates an empty image with width and height.- Parameters:
width
- the width of the imageheight
- the height of the image
-
SolaImage
public SolaImage(int width, int height, int[] pixels) Creates an image from source pixel array.- Parameters:
width
- the width of the imageheight
- the height of the imagepixels
- the pixel data for the image
-
-
Method Details
-
setPixels
public void setPixels(int width, int height, int[] pixels) Manually set the pixel data in this image.- Parameters:
width
- the width of the imageheight
- the height of the imagepixels
- the pixel data for the image
-
getSubImage
Creates a newSolaImage
that is a sub-image of thisSolaImage
.- Parameters:
x
- the left most coordinate of the sub-imagey
- the top most coordinate of the sub-imagewidth
- the width of the sub-imageheight
- the height of the sub-image- Returns:
- the sub-image
-
scale
Scales this image by an x-axis and y-axis scale factor. The original image will cacheCACHE_SIZE
transformations before clearing the cache.- Parameters:
scaleX
- the x-axis scale factorscaleY
- the y-axis scale factor- Returns:
- the scaled image
-
resize
Resizes this image to a new width and height. The original image will cacheCACHE_SIZE
transformations before clearing the cache.- Parameters:
newWidth
- the new widthnewHeight
- the new height- Returns:
- the resized image
-