Java Virtal Machine.net

[ News ] rss

February 01, 2011

Mark Wielaard: New GPG key. Finally created a new GPG key using gnupg. The old one was a DSA/1024 bits one and 8 years old. The new one is a RSA/2048 bits one. I will use the new one in the future to sign any release tarballs I might create. pub 2048R/57816A6A 2011-01-29 Key f...

More »

February 01, 2011

Andrew Hughes: [SECURITY] IcedTea6 1.7.8, 1.8.5, 1.9.5 Released!. We are pleased to announce a new set of security releases, IcedTea6 1.7.8, IcedTea6 1.8.5 and IcedTea6 1.9.5. This update contains the following security updates: The IcedTea project provides a harness to build the source code from OpenJDK6 u...

More »

April/2024
SunMonTueWedThuFriSat
 123456
78910111213
14151617181920
21222324252627
282930    

[ Archives News
for 'Developers' ]

home > news > developers > pixel considerations

Pixel Considerations

Antialiasing makes lines and shapes look smooth - though sometimes at the expense of sharpness. What if you're trying to draw a horizontal or vertical line where you don't need antialiasing? You might be under the impression that if you position your shapes at round integer positions, you will avoid antialiasing. But it's not quite that simple - so avoid trying to be smart with layout code like this: ... label.layoutX = (width - labelWidth) / 2 as Integer; .... The idea here is that when you're placing something in the middle you might end up with a fractional value, say 42.5, and so you added the "as Integer" to round things to a whole number to avoid introducing antialiasing. Well, this may have exactly the opposite effect! Take a look at the following picture, which shows two rectangles. Both rectangles have a stroke width of 1.0, and one of them is positioned at a round integer, and the other one is positioned at 0.5. Here's a zoomed in view which makes things clearer: Obviously, the rectangle on the left is blurry because antialiasing is attempting to show the line as being somewhere in the middle between them. The rectangle on the right on the other hand is clear and crisp because the lines overlap EXACTLY with the pixel grid the line is rendered into. Here's the thing though: The rectangle on the left is the one that was positioned at round integers, and the rectangle on the right is the one posit...


Date: May, 11 2010
Url: http://blogs.sun.com/tor/entry/pixel_considerations


Others News

©2002-2019Java-Virtual-Machine.net mobirise | static website generator | icon font | Bootstrap Templates | bootstrap navbar template