[OpenJDK 2D-Dev] <AWT Dev> [12] RFR JDK-8176556: java/awt/dnd/ImageTransferTest/ImageTransferTest.java fails for JFIF

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Fri Nov 9 22:02:48 UTC 2018


Looks fine.

On 09/11/2018 03:31, Jayathirth D V wrote:
> Hi Sergey,
> 
> I have made changes to specifically use RGB channel for Jpeg and ARGB for all others.
> Please find updated webrev for review:
> http://cr.openjdk.java.net/~jdv/8176556/webrev.03/
> 
> In DataTransferer. imageToStandardBytesImpl(), JpegImageWriterSpi.canEncodeImage() returns false.
> And since none of registered service providers can encode ARGB Jpeg. DataTransferer. imageToStandardBytesImpl() throws its own IOException as:
> 
> if (ioe == null) {
>              ioe = new IOException("Registered service providers failed to encode "
>                                    + renderedImage + " to " + mimeType);
>   }
> 
> 1) so maybe DND of the argb image using jpeg format should drop the alpha channel?
> 	- I think it we should leave it to user on what kind on image should be DnDed for jpeg format. Dropping alpha channel explicitly during DnD would not be a good option.
> 
> 2) or it should be somehow be reported as unsupported?
> 	- It is throwing IOException mentioning properly that there are no ImageIO spi available for image/jpeg with bands information for encoding an image . I think this has enough information, but if we need to change content of IOException or throw something like UnsupportedOperationException we can do it in separate bug. Please let me know I will raise separate bug for the same.
> 
> Thanks,
> Jay
> 
> -----Original Message-----
> From: Sergey Bylokhov
> Sent: Friday, November 09, 2018 12:41 AM
> To: Jayathirth D V; Philip Race; Brian Burkhalter
> Cc: awt-dev at openjdk.java.net; 2d-dev
> Subject: Re: [OpenJDK 2D-Dev] <AWT Dev> [12] RFR JDK-8176556: java/awt/dnd/ImageTransferTest/ImageTransferTest.java fails for JFIF
> 
> Hi, Jay.
> So you leaved the code which checks the full color including alpha, but the source image does not have an alpha so the check for alpha is not strictly necessary.
> May be we can use RGB only for JPEG and for all others we can use ARGB?
> 
> BTW Looking at this test I assume that it was expected that jpeg/gif images might be changed during DND operation,
>    - so maybe DND of the argb image using jpeg format should drop the alpha channel?
>    - or it should be somehow be reported as unsupported?
> instead of thrown exception somewhere in DND code?
> 
> On 08/11/2018 01:13, Jayathirth D V wrote:
>> Hello All,
>>
>> I am replying to the last mail in this thread.
>>
>>   From the test case we can see that it is not strict about pixel data which was transferred during DnD. It is just making sure we are able to do DnD for all native image formats.
>>
>> In test case ImageTransferer. areImagesIdentical() function we can see that for JPEG & GIF(lossy formats) they are ignoring the pixel data.
>>
>> And for all other image formats except PNG they are not checking alpha channel and only checking RGB data.
>>
>> So I have simplified areImagesIdentical() function also.
>>
>> I have verified this latest test case in Windows(native image flavours : PNG JFIF DIB ENHMETAFILE METAFILEPICT), Ubuntu(native image flavours : image/png image/x-png image/tiff image/gif PNG JFIF) & Mac(native image flavours : PNG JFIF TIFF) and it passes.
>>
>> Please find updated webrev for review:
>>
>> http://cr.openjdk.java.net/~jdv/8176556/webrev.02/
>>
>> Thanks,
>>
>> Jay
>>
>> *From:*Philip Race
>> *Sent:* Thursday, November 08, 2018 6:05 AM
>> *To:* Brian Burkhalter
>> *Cc:* awt-dev at openjdk.java.net; 2d-dev
>> *Subject:* Re: [OpenJDK 2D-Dev] <AWT Dev> [12] RFR JDK-8176556:
>> java/awt/dnd/ImageTransferTest/ImageTransferTest.java fails for JFIF
>>
>> Right. It supports alpha of 0 and 255, but nothing in between :-)
>>
>> -phil.
>>
>> On 11/7/18, 12:41 PM, Brian Burkhalter wrote:
>>
>>      GIF 89a supports a transparent color index in the palette.
>>
>>      Brian
>>
>>
>>
>>          On Nov 7, 2018, at 11:25 AM, Sergey Bylokhov <Sergey.Bylokhov at oracle.com <mailto:Sergey.Bylokhov at oracle.com>> wrote:
>>
>>          On more question about "image/gif" format, as far as I understand this format
>>          do not support the alpha as well, then why it works w/o exceptions?
>>
> 
> 
> --
> Best regards, Sergey.
> 


-- 
Best regards, Sergey.


More information about the 2d-dev mailing list