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.| 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, getException, getHeight, getImpl_source, getPixelReader, getProgress, getRequestedHeight, getRequestedWidth, getWidth, getWritablePlatformImage, heightProperty, impl_fromPlatformImage, impl_getPlatformImage, impl_getUrl, isBackgroundLoading, isError, isPreserveRatio, isSmooth, pixelsDirty, progressProperty, setPlatformImage, setProgress, widthPropertyprivate 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).width - the desired width of the writable image and the
width of the region to be read from the readerheight - the desired height of the desired image and the
width of the region to be read from the readerjava.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).x - the X coordinate of the upper left corner of the region to
read from the readery - the Y coordinate of the upper left corner of the region to
read from the readerwidth - the desired width of the writable image and the
width of the region to be read from the readerheight - the desired height of the desired image and the
width of the region to be read from the readerjava.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()
ImageisAnimation in class Imageboolean pixelsReadable()
pixelsReadable in class Imagepublic 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()