The Java Tutorials' Weblog
Rendering Hints - The 2D Tutorial
Use the Text antialiasing technique to smooth the edges of text on a screen. The Java 2D™ API enables applications to specify whether this technique should be used and what algorithm to use by applying a text rendering hint to the Graphics.Java 2D text rendering can be affected by rendering hints. The most common rendering hint blends the foreground (text) color with the onscreen background pixels at the edges of the text.
To request this hint an application must invoke the following method:
graphics2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
For more information about rendering hints available in JDK 6, see the Controlling Rendering Quality section of the 2D Graphics tutorial.
Guess what rendering hints were applied to the sample string.
Actually, the antialiasing capability was applied in the following order:
- Antialiasing is off.
- Antialiasing is on.
- Antialiasing using the TEXT_ANTIALIAS_GASP hint.
- Antialiasing using the TEXT_ANTIALIAS_LCD_HRGB hint.
-- Alla Redko
P.S. We are still interested in your feedback on the JSC Home page! Please see the previous blog entry and let us know what you think in the comments section.
Thanks!
-- Sharon Zakhour
Posted at 09:05AM Feb 13, 2007 by The Java Tutorial Team | Comments[3]
Tuesday Feb 13, 2007
Posted by aditya on February 15, 2007 at 05:00 AM PST #
Posted by Mike Fischer on March 16, 2007 at 01:49 PM PDT #
2D tutorial is now outdated because lot of queries makes error for this App when start execution.
Posted by world cup 2010 tickets on October 28, 2009 at 09:44 AM PDT #