<Swing Dev> [11] RFR: JDK-8206238: Aspect ratio is not maintained when image is scaled in JEditorPane
shashidhara.veerabhadraiah at oracle.com
shashidhara.veerabhadraiah at oracle.com
Wed Jul 11 15:28:42 UTC 2018
Hi Krishna, What I think is that, depicting a circle as an ellipse is
wrong as per the bug description, isn't it the other way too is wrong as
well? i.e., depicting an ellipse(say a 100 by 200 px) as a circle(Say
100 by 100 html attribute).
I could not justify always choosing 1:1 aspect ratio when you can still
maintain the aspect ratio(Including the chrome example)?
Thanks and regards,
Shashi
On 11/07/18 4:40 PM, Krishna Addepalli wrote:
>
> Hi Shashi,
>
> When one of the attributes of the image is not
> specified(width/height), the default behavior is to copy the value
> over from the other attribute. I have checked this behavior in Chrome.
>
> Attached the html for your reference(just adjust the path to
> circle.png appropriately on your system).
>
> Thanks,
>
> Krishna
>
> *From:*Shashidhara Veerabhadraiah
> *Sent:* Wednesday, July 11, 2018 3:07 PM
> *To:* Krishna Addepalli <krishna.addepalli at oracle.com>; Prasanta
> Sadhukhan <prasanta.sadhukhan at oracle.com>; swing-dev at openjdk.java.net
> *Subject:* RE: <Swing Dev> [11] RFR: JDK-8206238: Aspect ratio is not
> maintained when image is scaled in JEditorPane
>
> Hi Krishna, One clarification about the change:
>
> The said solution holds good for an image with an aspect ratio of 1:1.
> Can this aspect ratio be considered default? I think we should derive
> the aspect ratio from the image and use that value to calculate the
> unknown attribute of the scale information!!
>
> Thanks and regards,
> Shashi
>
> *From:*Krishna Addepalli
> *Sent:* Wednesday, July 11, 2018 2:03 PM
> *To:* Prasanta Sadhukhan <prasanta.sadhukhan at oracle.com
> <mailto:prasanta.sadhukhan at oracle.com>>; swing-dev at openjdk.java.net
> <mailto:swing-dev at openjdk.java.net>
> *Subject:* Re: <Swing Dev> [11] RFR: JDK-8206238: Aspect ratio is not
> maintained when image is scaled in JEditorPane
>
> Thanks for the review Prasanta.
>
> I need one more review to push this regression.
>
> Thanks,
> Krishna
>
> *From:*Prasanta Sadhukhan
> *Sent:* Wednesday, July 11, 2018 10:28 AM
> *To:* Krishna Addepalli <krishna.addepalli at oracle.com
> <mailto:krishna.addepalli at oracle.com>>; swing-dev at openjdk.java.net
> <mailto:swing-dev at openjdk.java.net>
> *Subject:* Re: <Swing Dev> [11] RFR: JDK-8206238: Aspect ratio is not
> maintained when image is scaled in JEditorPane
>
> +1
>
> Regards
> Prasanta
>
> On 7/10/2018 6:59 PM, Krishna Addepalli wrote:
>
> Sorry my bad. Here is the new webrev:
> http://cr.openjdk.java.net/~kaddepalli/8206238/webrev02/
> <http://cr.openjdk.java.net/%7Ekaddepalli/8206238/webrev02/>
>
> Thanks,
>
> Krishna
>
> *From:*Prasanta Sadhukhan
> *Sent:* Tuesday, July 10, 2018 6:03 PM
> *To:* Krishna Addepalli <krishna.addepalli at oracle.com>
> <mailto:krishna.addepalli at oracle.com>; swing-dev at openjdk.java.net
> <mailto:swing-dev at openjdk.java.net>
> *Subject:* Re: <Swing Dev> [11] RFR: JDK-8206238: Aspect ratio is
> not maintained when image is scaled in JEditorPane
>
> Ok. Thanks for the clarification. Btw, there is another reversal
> as I mentioned earlier
>
> 158 System.out.println("Test with only height set to 100");
>
> 159 test(r, editorPanes[4], 100, 100);
>
> 160
>
> 161 System.out.println("Test with only width set to 100");
>
> 162 test(r, editorPanes[5], 100, 100);
>
> as editorPane[4] tests width 100
>
> 121 editorPanes[4] = new JEditorPane("text/html",
>
> 122 "<img width=\"100\" src =\"
>
>
> Regards
> Prasanta
>
> On 7/10/2018 5:54 PM, Krishna Addepalli wrote:
>
> Hi Prasanta,
>
> Thanks for your review. Here is the updated webrev:
> http://cr.openjdk.java.net/~kaddepalli/8206238/webrev01/
> <http://cr.openjdk.java.net/%7Ekaddepalli/8206238/webrev01/>
>
> So, the actual width and height of the image is 200, but the
> bug is that when any other value (only height or width) is
> specified, then the image should be scaled to that size(both
> width and height).
>
> The test tests the same with different values like 100, 50 and
> 300 apart from the original image size of 200.
>
> Hope this clarifies.
>
> Thanks,
>
> Krishna
>
> *From:*Prasanta Sadhukhan
> *Sent:* Tuesday, July 10, 2018 3:48 PM
> *To:* Krishna Addepalli <krishna.addepalli at oracle.com>
> <mailto:krishna.addepalli at oracle.com>;
> swing-dev at openjdk.java.net <mailto:swing-dev at openjdk.java.net>
> *Subject:* Re: <Swing Dev> [11] RFR: JDK-8206238: Aspect ratio
> is not maintained when image is scaled in JEditorPane
>
> Fix looks good to me. For test,
>
>
>
> 152 System.out.println("Test with none of them set");
>
> 153 test(r, editorPanes[2], 200, 200);
>
> 154
>
> 155 System.out.println("Test with both of them set to 200");
>
> 156 test(r, editorPanes[3], 200, 200);
>
> should be reversed as you do
>
> 115 editorPanes[2] = new JEditorPane("text/html",
>
> 116 "<img width=\"200\" height=\"200\" src=\"file:///" <file:///> + ABSOLUTE_FILE_PATH + "\"");
>
> 117
>
> 118 editorPanes[3] = new JEditorPane("text/html",
>
> 119 "<img src=\"file:///" <file:///> + ABSOLUTE_FILE_PATH + "\"");
>
>
>
> Same for 158, 161.
>
>
>
> Also, what is the need for
>
> 158 System.out.println("Test with only height set to
> 100");
>
> when you already have a test for height only
>
> 146 System.out.println("Test with only height set to
> 200");
>
> SImilar for width.
>
> Regards
> Prasanta
> On 7/10/2018 3:15 PM, Krishna Addepalli wrote:
>
> Hi All,
>
> Please review a fix for the bug JDK-8206238:
> https://bugs.openjdk.java.net/browse/JDK-8206238
>
> Webrev:
> http://cr.openjdk.java.net/~kaddepalli/8206238/webrev00/
> <http://cr.openjdk.java.net/%7Ekaddepalli/8206238/webrev00/>
>
> The problem is that, when any one of the attributes for
> the image (height/width), are specified, it should copy
> the value to the other attribute. Currently, it only
> updates the respective attribute, and fills the other
> attribute with the size of the image.
>
> Fixed this problem in the proposed patch.
>
> Thanks,
>
> Krishna
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/swing-dev/attachments/20180711/e296b115/attachment.html>
More information about the swing-dev
mailing list