[OpenJDK 2D-Dev] [9] Review request for 8163854 Add ToolkitImage.getImage() method which loads an image with schema variant

Alexander Scherbatiy alexandr.scherbatiy at oracle.com
Mon Sep 19 19:03:28 UTC 2016


Hello,

Could you review the updated fix:
   http://cr.openjdk.java.net/~alexsch/8163854/webrev.01

The fix includes support for resolution variants loading by getImage() 
method for built-in toolkits using the following media resolution naming 
scheme (qualifier, scale): ("@125pct", 1.25), ("@150pct", 1.5), 
("@200pct" or "@2x", 2), ("@250pct", 2.5), ("@300pct" or "@3x", 3).

Thanks,
Alexandr.

On 25/08/16 05:39, Philip Race wrote:
> FWIW I think the most important image loading use case
> is that some generic resource loading code - perhaps JDK code - will 
> get a URL for where
> the resources are and go hunting. It is never going to call this API 
> .. so
> it had better be an optimisation and not a necessity
>
> -phil.
>
>
> On 8/24/16, 5:24 PM, Philip Race wrote:
>> Alexander,
>>
>> Were  the existing Toolkit.getImage(String/URL) APIs not enhanced to
>> do this for you automatically ? I suppose I thought they were but
>> they can't be since you are using getImage(String) here.
>>
>> IMO that would be more important than this.
>>
>> And in any case I don't see why this is solved only for local files.
>>
>> I am *not* asking for that right now. I am asking if the existing 
>> Toolkit APIs
>> can load a multi-res image and if not, why not  and can we fix that 
>> instead ..
>>
>> -phil.
>>
>> On 8/24/16, 9:36 AM, Alexander Scherbatiy wrote:
>>>
>>> Hello,
>>>
>>> Could you review the fix:
>>>   bug: https://bugs.openjdk.java.net/browse/JDK-8163854
>>>   webrev: http://cr.openjdk.java.net/~alexsch/8163854/webrev.00
>>>
>>>   The public API which allows to load an image with resolution 
>>> variants based on the provided media resolution naming scheme is added:
>>>   - Toolkit.MediaResolutionNamingScheme class
>>>   - Toolkit.getImageUsingNamingSchemes(String fileName, 
>>> MediaResolutionNamingScheme... namingSchemes)
>>>
>>>   A simple example for images which use naming scheme @150pct for 
>>> scale 1.5 and @2x for scale 2 is:
>>>     image_name.ext
>>> image_name at 150pct.ext
>>> image_name at 2x.ext
>>>
>>>     Toolkit toolkit = Toolkit.getDefaultToolkit();
>>>     Image image = toolkit.getImageUsingNamingSchemes(fileName,
>>>             new Toolkit.MediaResolutionNamingScheme(“@150pct”, 1.5f),
>>>             new Toolkit.MediaResolutionNamingScheme(“@2x", 2f)
>>>     );
>>>
>>>   Thanks,
>>>   Alexandr.
>>>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/2d-dev/attachments/20160919/aeb245a6/attachment.html>


More information about the 2d-dev mailing list