<Swing Dev> [9] Review request for 6302464 Allow programmatic enabling of subpixel anti-aliasing in Swing
Sergey Bylokhov
Sergey.Bylokhov at oracle.com
Fri Aug 21 11:18:49 UTC 2015
Hi, Alexander.
It seems this is only a part of the request. It does not cover some
situations like java properties, which can be used to enable/set/disable
anti-aliasing.
Also it is unclear how and why our look and feels modify the desktop
properties, this api seems private also.
On 13.08.15 15:07, Alexander Scherbatiy wrote:
>
> Hello,
>
> Could you review the fix:
> bug: https://bugs.openjdk.java.net/browse/JDK-6302464
> webrev: http://cr.openjdk.java.net/~alexsch/6302464/webrev.00
>
> Swing uses internal API to set antialiasing settings for L&Fs and
> components.
>
> SwingUtilities2.AATextInfo aaTextInfo = new
> SwingUtilities2.AATextInfo(
> RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB, 140);
>
> UIManager.getDefaults().put(SwingUtilities2.AA_TEXT_PROPERTY_KEY,
> aaTextInfo); // set aa hints globally
> component.putClientProperty(SwingUtilities2.AA_TEXT_PROPERTY_KEY,
> aaTextInfo); // set aa hints for a JComponent
>
>
> There are some ways to provide a public mechanism for antialiasing
> enabling in Swing:
>
> 1. Setting antialiasing rendering hints into UI defaults and component
> client properties:
>
> UIManager.getDefaults().put(RenderingHints.KEY_TEXT_ANTIALIASING,
> RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
> component.putClientProperty(RenderingHints.KEY_TEXT_ANTIALIASING,
> RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
>
> 2. Setting a map which contains antialiasing hints:
>
> Map<RenderingHints.Key, Object> aaHintsMap = new HashMap<>();
> aaHintsMap.put(RenderingHints.KEY_TEXT_ANTIALIASING,
> RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
>
> UIManager.getDefaults().put(AA_TEXT_PROPERTY_KEY, aaHintsMap);
> component.putClientProperty(AA_TEXT_PROPERTY_KEY, aaHintsMap);
>
> 3. Information about antialiasing hints can be stored in a public class
>
> AATextInfo aaTextInfo = new
> AATextInfo(RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB, 140);
> UIManager.getDefaults().put(AA_TEXT_PROPERTY_KEY, aaTextInfo);
> component.putClientProperty(AA_TEXT_PROPERTY_KEY, aaTextInfo);
>
> The proposed fix used the first approach.
>
> Thanks,
> Alexandr.
>
--
Best regards, Sergey.
More information about the swing-dev
mailing list