< prev index next >

modules/javafx.swing/src/main/java/javafx/embed/swing/SwingFXUtils.java

Print this page

        

*** 39,49 **** import javafx.scene.image.WritableImage; import javafx.scene.image.WritablePixelFormat; import javafx.scene.paint.Color; import com.sun.javafx.tk.Toolkit; import javax.swing.SwingUtilities; ! import sun.awt.image.IntegerComponentRaster; /** * This class provides utility methods for converting data types between * Swing/AWT and JavaFX formats. * @since JavaFX 2.2 --- 39,50 ---- import javafx.scene.image.WritableImage; import javafx.scene.image.WritablePixelFormat; import javafx.scene.paint.Color; import com.sun.javafx.tk.Toolkit; import javax.swing.SwingUtilities; ! ! import jdk.swing.interop.SwingInterOpUtils; /** * This class provides utility methods for converting data types between * Swing/AWT and JavaFX formats. * @since JavaFX 2.2
*** 109,122 **** } if (wimg == null) { wimg = new WritableImage(bw, bh); } PixelWriter pw = wimg.getPixelWriter(); ! IntegerComponentRaster icr = (IntegerComponentRaster) bimg.getRaster(); ! int data[] = icr.getDataStorage(); ! int offset = icr.getDataOffset(0); ! int scan = icr.getScanlineStride(); PixelFormat<IntBuffer> pf = (bimg.isAlphaPremultiplied() ? PixelFormat.getIntArgbPreInstance() : PixelFormat.getIntArgbInstance()); pw.setPixels(0, 0, bw, bh, pf, data, offset, scan); return wimg; --- 110,123 ---- } if (wimg == null) { wimg = new WritableImage(bw, bh); } PixelWriter pw = wimg.getPixelWriter(); ! int data[] = SwingInterOpUtils.getData(bimg); ! int offset = SwingInterOpUtils.getOffset(bimg); ! int scan = SwingInterOpUtils.getScanlineStride(bimg); ! PixelFormat<IntBuffer> pf = (bimg.isAlphaPremultiplied() ? PixelFormat.getIntArgbPreInstance() : PixelFormat.getIntArgbInstance()); pw.setPixels(0, 0, bw, bh, pf, data, offset, scan); return wimg;
*** 279,292 **** } } if (bimg == null) { bimg = new BufferedImage(iw, ih, prefBimgType); } ! IntegerComponentRaster icr = (IntegerComponentRaster) bimg.getRaster(); ! int offset = icr.getDataOffset(0); ! int scan = icr.getScanlineStride(); ! int data[] = icr.getDataStorage(); WritablePixelFormat<IntBuffer> pf = getAssociatedPixelFormat(bimg); pr.getPixels(0, 0, iw, ih, pf, data, offset, scan); return bimg; } --- 280,293 ---- } } if (bimg == null) { bimg = new BufferedImage(iw, ih, prefBimgType); } ! int offset = SwingInterOpUtils.getOffset(bimg); ! int scan = SwingInterOpUtils.getScanlineStride(bimg); ! int data[] = SwingInterOpUtils.getData(bimg); ! WritablePixelFormat<IntBuffer> pf = getAssociatedPixelFormat(bimg); pr.getPixels(0, 0, iw, ih, pf, data, offset, scan); return bimg; }
< prev index next >