Class SWTFXUtils
- javafx.embed.swt.SWTFXUtils
public class SWTFXUtils extends Object
Since:
JavaFX 2.2
-
Method Summary
All MethodsStatic MethodsConcrete Methods Modifier and Type Method and Description static org.eclipse.swt.graphics.ImageDatafromFXImage(Image image, org.eclipse.swt.graphics.ImageData imageData)Snapshots the specified JavaFXImageobject and stores a copy of its pixels into a newImageDataobject.static WritableImagetoFXImage(org.eclipse.swt.graphics.ImageData imageData, WritableImage image)Snapshots the specifiedImageDataand stores a copy of its pixels into a JavaFXImageobject, creating a new object if needed.
-
Method Detail
-
toFXImage
public static WritableImage toFXImage(org.eclipse.swt.graphics.ImageData imageData, WritableImage image)Snapshots the specifiedImageDataand stores a copy of its pixels into a JavaFXImageobject, creating a new object if needed. The returnedImagewill be a static snapshot of the state of the pixels in theImageDataat the time the method completes. Further changes to theImageDatawill not be reflected in theImage.The optional JavaFX
WritableImageparameter may be reused to store the copy of the pixels. A newImagewill be created if the supplied object is null, is too small or of a type which the image pixels cannot be easily converted into.Parameters:
imageData- theImageDataobject to be convertedReturns:
an
Imageobject representing a snapshot of the current pixels in theImageData, or null if theImageis not readable.
-
fromFXImage
public static org.eclipse.swt.graphics.ImageData fromFXImage(Image image, org.eclipse.swt.graphics.ImageData imageData)Snapshots the specified JavaFXImageobject and stores a copy of its pixels into a newImageDataobject. The method will only convert a JavaFXImagethat is readable as per the conditions on theImage.getPixelReader()method. If theImageis not readable, as determined by itsgetPixelReader()method, then this method will return null. If theImageis a writable, or other dynamic image, then theImageDatawill only be set to the current state of the pixels in the image as determined by itsPixelReader. Further changes to the pixels of theImagewill not be reflected in the returnedImageData.The optional
ImageDataparameter may be reused to store the copy of the pixels. A newImageDatawill be created if the supplied object is null, is too small or of a type which the image pixels cannot be easily converted into.Parameters:
image- the JavaFXImageto be convertedReturns:
a
ImageDatacontaining a snapshot of the JavaFXImage, or null if theImageis not readable.
-
© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.