public class WritableImage extends Image
WritableImage
class represents a custom graphical image
that is constructed from pixels supplied by the application, and possibly
from PixelReader
objects from any number of sources, including
images read from a file or URL.acc_platformImageProperty, errorProperty, exceptionProperty, heightProperty, progressProperty, widthProperty
Modifier and Type | Field and Description |
---|---|
private ImageLoader |
tkImageLoader |
private PixelWriter |
writer |
Constructor and Description |
---|
WritableImage(int width,
int height)
Construct an empty image of the specified dimensions.
|
WritableImage(PixelReader reader,
int width,
int height)
Construct an image of the specified dimensions, initialized from
the indicated
PixelReader . |
WritableImage(PixelReader reader,
int x,
int y,
int width,
int height)
Construct an image of the specified dimensions, initialized from
the indicated region of the
PixelReader . |
Modifier and Type | Method and Description |
---|---|
PixelWriter |
getPixelWriter()
This method returns a
PixelWriter that provides access to
write the pixels of the image. |
private java.lang.Object |
getTkImageLoader() |
(package private) boolean |
isAnimation()
Indicates whether image is animated.
|
private void |
loadTkImage(java.lang.Object loader) |
(package private) boolean |
pixelsReadable() |
acc_platformImageProperty, cancel, dispose, errorProperty, exceptionProperty, fromPlatformImage, getException, getHeight, getInputSource, getPixelReader, getPlatformImage, getProgress, getRequestedHeight, getRequestedWidth, getUrl, getWidth, getWritablePlatformImage, heightProperty, isBackgroundLoading, isError, isPreserveRatio, isSmooth, pixelsDirty, progressProperty, setPlatformImage, setProgress, widthProperty
private ImageLoader tkImageLoader
private PixelWriter writer
public WritableImage(int width, int height)
(> 0)
.width
- the desired width of the writable imageheight
- the desired height of the desired imagejava.lang.IllegalArgumentException
- if either dimension is negative or zero.public WritableImage(PixelReader reader, int width, int height)
PixelReader
.
The image will initially be filled with data returned from the
PixelReader
.
If the PixelReader
accesses a surface that does not contain
the necessary number of pixel rows and columns then an
ArrayIndexOutOfBoundsException
will be thrown.
Images constructed this way will always be readable and writable
so the corresponding getPixelReader() and getPixelWriter() will
always return valid objects.
The dimensions must both be positive numbers (> 0)
.reader
- the PixelReader
to construct fromwidth
- the desired width of the writable image and the
width of the region to be read from the reader
height
- the desired height of the desired image and the
width of the region to be read from the reader
java.lang.ArrayIndexOutOfBoundsException
- if the reader
does
not access a surface of at least the requested dimensionsjava.lang.IllegalArgumentException
- if either dimension is negative or zero.public WritableImage(PixelReader reader, int x, int y, int width, int height)
PixelReader
.
The image will initially be filled with data returned from the
PixelReader
for the specified region.
If the PixelReader
accesses a surface that does not contain
the necessary number of pixel rows and columns then an
ArrayIndexOutOfBoundsException
will be thrown.
Images constructed this way will always be readable and writable
so the corresponding getPixelReader() and getPixelWriter() will
always return valid objects.
The dimensions must both be positive numbers (> 0)
.reader
- the PixelReader
to construct fromx
- the X coordinate of the upper left corner of the region to
read from the reader
y
- the Y coordinate of the upper left corner of the region to
read from the reader
width
- the desired width of the writable image and the
width of the region to be read from the reader
height
- the desired height of the desired image and the
width of the region to be read from the reader
java.lang.ArrayIndexOutOfBoundsException
- if the reader
does
not access a surface containing at least the indicated regionjava.lang.IllegalArgumentException
- if either dimension is negative or zero.boolean isAnimation()
Image
isAnimation
in class Image
boolean pixelsReadable()
pixelsReadable
in class Image
public final PixelWriter getPixelWriter()
PixelWriter
that provides access to
write the pixels of the image.PixelWriter
for writing pixels to the imageprivate void loadTkImage(java.lang.Object loader)
private java.lang.Object getTkImageLoader()