On Thu, 20 Aug 2026 17:04:11 GMT, Andy Goryachev <[email protected]> wrote:

>> Any internal code that needs to read/write javafx images currently goes 
>> through the `ImageIO` (`java.desktop` module) and the `SwingFXUtils` (in 
>> `javafx.swing` module).
>> 
>> To avoid adding dependencies, we should move the bulk of implementation to 
>> the `javafx.graphics` module which in turn can be used by the `SwingFXUtils` 
>> and other internal code without adding additional explicit dependencies.
>> 
>> This PR moves the `SwingFXUtils` implementation to 
>> javafx.graphics/com.sun.javafx.util.ImageUtils and also adds a utility method
>> 
>> public static byte[] writeImage(Image im, String format) throws IOException
>> 
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Andy Goryachev has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   tests

modules/javafx.graphics/src/test/java/test/com/sun/javafx/util/TestImageUtils.java
 line 32:

> 30: import java.nio.IntBuffer;
> 31: import javafx.scene.image.PixelBuffer;
> 32: import javafx.scene.image.PixelFormat;

Those imports are unused

modules/javafx.graphics/src/test/java/test/com/sun/javafx/util/TestImageUtils.java
 line 70:

> 68:         // StubToolkit cannot write jpg, we'll test for non-null return 
> value
> 69:         // assertTrue(b.length > 0);
> 70:         assertTrue(b != null);

A `byte[]` can never be null. Good to have tests but I wonder why only jpg / 
jpeg do not work?

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/2267#discussion_r3823709825
PR Review Comment: https://git.openjdk.org/jfx/pull/2267#discussion_r3823705299

Reply via email to