Swing Edition

 


 

 

Rendering Optimizations

 

 

 

 

 

 

The RenderingOptimization class allows settings to be made which affect the way web pages are rendered. These can be used to modify the speed and detail of the rendering.

Smooth Scrolling

Since the WebRenderer Swing Edition uses Java to perform the rendering of web pages, some pages can appear slow to scroll when there is Flash or other plugins present on the page. There are a few options which can be used to improve the page scrolling in these cases. By setting a smooth scrolling option, pulgins or Flash will not be rendered while the page is being scrolled. This only applies to scrolling from the scrollbar, not other forms such as mousewheel or cursor keys.

These smooth scrolling options are not used by default. They can be set by using the following functions:

        RenderingOptimization.setSmoothPluginScrolling(boolean smoothPluginScrolling);
        RenderingOptimization.setWindowlessFlashSmoothScrolling(boolean windowlessFlashSmoothScrolling);

Anti-aliasing

Options are available to use anti-aliasing in the rendering of web pages. There are seperate options for graphics and text. The anti-aliasing is not enabled by default for general rendering and can be set using the following function:

        RenderingOptimization.setAntiAliasing(boolean antiAlias);

The anti-aliasing for text has three different settings.

TEXT_ANTIALIAS_OFF      - No anti-aliasing is used on text.
TEXT_ANTIALIAS_AUTO     - Anti-aliasing is only used on text of a certain point size and above. This makes large fonts appear smoother and small fonts easy to read. The font point size is that used in java.awt.Font, which is measured in pixels, or 1/72 inch units. This threshold is set to 14 point by default.
 
TEXT_ANTIALIAS_ALL      - Anti-aliasing is used on all text.

This is set by using the following function:
        RenderingOptimization.setTextAntiAliasing(int textAntiAliasing);
 
Note: By default this is set to TEXT_ANTIALIAS_ALL on Mac OSX and TEXT_ANTIALIAS_AUTO on all other systems.
 
If the TEXT_ANTIALIAS_AUTO option is used, the threshold size can be changed from the default value of 14 to the required value using the following function:

        RenderingOptimization.setAntiAliasTextAutoThreshold(int antiAliasTextAutoThreshold);

Example usage:

        IMozillaBrowserCanvas browser = new IMozillaBrowserCanvas();

        ...
        RenderingOptimization renOps = new RenderingOptimization();
        renOps.setSmoothPluginScrolling(true);
        renOps.setWindowlessFlashSmoothScrolling(true);
        renOps.setAntiAliasing(true);
        renOps.setAntiAliasTextAutoThreshold(12);

        browser.setRenderingOptimizations(renOps);

 

 

 

 

 

 

 

 

Copyright © JadeLiquid Software - www.jadeliquid.com