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.| 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. |
cancel, errorProperty, getHeight, getPixelReader, getProgress, getRequestedHeight, getRequestedWidth, getWidth, heightProperty, isBackgroundLoading, isError, isPreserveRatio, isSmooth, progressProperty, widthPropertypublic 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.public final PixelWriter getPixelWriter()
PixelWriter that provides access to
write the pixels of the image.PixelWriter for writing pixels to the imageCopyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.