public class BufferedImage extends ResourceImage
BufferedImage
represents a mutable image backed by a pixel buffer.
The constructor of this class allows to create an image with given dimensions.
ResourceImage.OutputFormat
Constructor and Description |
---|
BufferedImage(int width,
int height)
Creates a buffered image.
|
Modifier and Type | Method and Description |
---|---|
GraphicsContext |
getGraphicsContext()
Returns the
GraphicsContext associated with this image, which may be used in order to draw on the image. |
canLoadImage, close, isClosed, loadImage, loadImage, loadImage, loadImage
canGetImage, getHeight, getImage, getSNIContext, getWidth, isTransparent, readPixel, readPixels
public BufferedImage(int width, int height)
The new image is initialized with unspecified pixel data. The output format of the new image matches the pixel organization (layout, depth, etc.) of the default display.
Creating images is not supported by every MicroUI implementation. If the MicroUI implementation does not support
the allocation of memory in order to store the pixel buffer, a MicroUIException
is thrown.
width
- the width of the new image, in pixels.height
- the height of the new image, in pixels.IllegalArgumentException
- if either width
or height
is negative or zero.MicroUIException
- if the image could not be created.MicroUIException
- if MicroUI is not started.SecurityException
- if a security manager exists and does not allow the caller to create an image.public GraphicsContext getGraphicsContext()
GraphicsContext
associated with this image, which may be used in order to draw on the image.
This method always returns the same GraphicsContext
instance for a specific image. The graphics context
has the same dimensions as the image, which allows to modify every pixel of the image.
MicroUIException
- if this image has been closed (see ResourceImage.close()
).