[External] : Re: Surface the ImageLoader API

Kevin Rushforth kevin.rushforth at oracle.com
Fri Jun 4 23:38:52 UTC 2021


Two thoughts come to mind.

1. While I agree that it isn't necessary to do everything all at once, I 
don't agree that a full featured Image I/O API is off the table as a 
future enhancement. Whatever you end up proposing to do here should 
ideally fit into what we would want to do in the future in this space. 
At the very least we need to have a discussion about how the subset you 
propose would or would not fit in. I'm not suggesting that we need to 
plan for every possible unknown (and in some cases unknowable) future 
need, but there are some obvious things we might want to do in this 
space. Writing images and dealing with image meta-data (both of which 
you listed) are two of the main ones. We need to make sure that we don't 
preclude any likely future direction. Otherwise we could be left with an 
API that would need to be deprecated and replaced in order to fit into a 
future Image I/O-like API.

2. Whether or not the ImageLoader implementation classes might be good 
API isn't really the point. I rather doubt that defining a lookalike API 
in the public javafx.scene.image package that merely wraps those classes 
is what we want. Maybe you'll end up with an API that is somewhat close 
to that, but starting with an implementation to create the proposed API 
is backwards. One of the big things to consider is how image readers are 
registered: SPI? explicit registration API? something else?

As for next steps, the first sentence of your latest email is a good 
start at a brief summary of what you are looking for:

 > ...a feature to support third-party image format plugins, with the 
intention of decoding images for use in the JavaFX scene graph.

I'd recommend fleshing this out a bit, possibly with some mocked up API 
(high-level). If you haven't already looked at it, the JEP template [1] 
is good for describing non-trivial features such as what you propose. 
While we don't generally do JEPs for JavaFX APIs any more, the template 
can be a useful way to organize the information needed to evaluate the 
proposal. It gets you think about thinks like motivation, goals / 
non-goals, API, alternatives, testing, etc.

If there is general buy-in that a pluggable image loader is worth doing, 
the main things to hash out before this can proceed are the two I 
mentioned above: 1) whether and how it would fit into a larger Image 
reader/writer API; and 2) what form the API should take.

-- Kevin

[1] https://openjdk.java.net/jeps/2


On 6/4/2021 3:10 PM, Michael Strauß wrote:
> Let me restate my intentions to be more clear:
>
> What I'm asking for is a feature to support third-party image format
> plugins, with the intention of decoding images for use in the JavaFX
> scene graph.
>
> I think the following things should remain explicit non-goals:
> - writing images
> - transcoding images
> - reading or writing metadata
>
> There's Java2D for that, no need to duplicate existing functionality.
>
> For its intended purpose, I do think that the existing internal
> implementation is actually a good API, because it is geared towards
> the problem that it is trying to solve.
> Expanding the scope of the existing feature to include any of these
> additional things doesn't seem like a sensible idea to me.
>
> I would like to understand whether you disagree with my assessment of
> the intended purpose of this feature.
> Do you think that there is a "larger picture" that would change the
> goals and non-goals?
>
> You seem to imply that extending the existing feature is the wrong
> approach, and that there is a better approach which requires more
> effort.
> Can you share any of insights that lead to this conclusion? I haven't
> been able to find this information in JBS.
>
>
> Am Fr., 4. Juni 2021 um 22:03 Uhr schrieb Kevin Rushforth
> <kevin.rushforth at oracle.com>:
>> Characterizing a new feature in terms of exposing internal interfaces
>> isn't really the right way to think about it. The fact that there might
>> be internal classes that do something similar to what you propose isn't
>> really relevant (other than later down the road when it comes time to
>> discuss the implementation).
>>
>> Rather you should start with a description of the enhancement you would
>> like to see: additional image loading capability, in this case. Then a
>> discussion of the API would be in order.
>>
>> What's really being asked for here is a feature like Java2D's Image I/O
>> with pluggable image formats. We spent some time looking at that a few
>> years ago. Doing this right would be a very large effort. I wouldn't be
>> in favor of a piecemeal approach without understanding the larger picture.
>>
>> So I don't support this proposal as stated.
>>
>> -- Kevin



More information about the openjfx-dev mailing list