Mozilla2:GFXGraphics

Revision as of 00:05, 2 April 2005 by Pavlov (talk | contribs)

Class Graphics

Your 2d drawing API. To use this you need to first create a surface and call SetSurface().

API

Graphics.h

Filters

Filter.h

For blending and SVG filters we need an API like this:

class Filter {
  static Filter* CreateOpacityFilter(double alpha);
  // CreateGaussianFilter, etc
};

In Graphics:

  // Start rendering under the filter. We guarantee not to draw outside 'maxArea'.
  void PushFilter(Filter f, Rect maxArea);
  // Completed rendering under the filter, composite what we rendered back to the
  // underlying surface using the filter.
  void PopFilter();

This API lets clients not worry about what resolution to create a temporary surface at, etc. It is GFX/Cairo's responsibility to choose a good resolution, based on the current transformation.

The way to implement this is to transform maxArea to device coordinates, take its bounding box, and use that as the area for the temporary surface.