View RSS Feed

Java AWT

Controlling Rendering Quality

Rate this Entry
by , 03-04-2012 at 04:51 PM (687 Views)
The Graphics2D class rendering are used for specifications like:

  • One wishes rendering objects as soon as possible.
  • Rendering of the higher quality graphics is required.


Create a RenderingHint object. Pass to setRenderingHints of class Graphics 2D so that to alter or set rendering hint attribute, in context of Graphics2D.

Graphics 2Dís setRenderingHint method is called so that to set 1 hint and pass it on a value pair key, for that hint which you wish to set.

In the RenderingHints class, key value pairs are given

For setting up the rendering hint by using method setRenderingHint, this code is used.
Java Code:
public void paint (graphics g){
    Graphics2D g2 = (Graphics2D)g;
    RenderingHints rh = new RenderingHints(
             RenderingHints.KEY_TEXT_ANTIALIASING,
             RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    g2.setRenderingHints(rh);
...
}

Submit "Controlling Rendering Quality" to Facebook Submit "Controlling Rendering Quality" to Digg Submit "Controlling Rendering Quality" to del.icio.us Submit "Controlling Rendering Quality" to StumbleUpon Submit "Controlling Rendering Quality" to Google

Categories
Graphics

Comments