BitmapSmoothing

From Gnash Project Wiki

Jump to: navigation, search

The correct decision on when to smooth or not bitmap fills should be based on both SWF definition AND runtime configuration (ActionScript).

Up to SWF7, bitmap should only be smoothed when _quality is set to "BEST".

SWF8 introduces both definition-time and runtime configuration for this. The definition-time one consists in additional fill types for non-smoothed bitmaps. Gnash call these FILL_TILED_BITMAP_HARD and FILL_CLIPPED_BITMAP_HARD. Ming uses a NONSMOOTHED label instead of HARD. Since these "HARD" versions are available, the non-"HARD" ones will be taken as a request to smooth them. Additionally, SWF8 introduced a MovieClip.forceSmoothing property, which forces smoothing of bitmaps no matter the tag used to define them. So, in SWF8 you can have "smooth" or "nonsmooth" directions available looking at both definition AND runtime configuration. At that point, "smooth" bitmaps are smoothed when _quality is "MEDIUM" or higher, while "non-smooth" ones are never smoothed.

For simplicity, we may think of these fills as being of 3 types:

  1. Mostly non-smoothed : only smooth when quality is "BEST" - up to SWF7
  2. Non-smoothed : never smooth, no matter quality - from SWF8 up, "HARD" definition, no .forceSmoothing set
  3. Smoothed : smooth, unless quality is "LOW" - from SWF8 up, non-"HARD" definition, or .forceSmoothing set

Gnash support

Starting at revision 10715 (see Bug #25894) gnash will set a "smoothing policy" in each bitmap fill object. The policy can be: UNSPECIFIED, ON or OFF. UNSPECIFIED will be used when the SWF containing the fill style definition is at most a version 7. For SWF8 up the policy will be ON for non-hard styles and OFF for hard ones.

The renderer is in charge for using this definition policy to decide on actual smoothing, by looking at _quality, and at an eventual 'forceSmoothing' parameter passed to shape drawing primitives.

As of revision 10715, the AGG renderer will use the smoohing policy, but won't support the .forceSmoothing flag yet (this needs an extension of the renderer interface).