On Mon, 2009-06-29 at 10:21 +0100, Richard Wilson wrote:
> From: netsurf-dev-bounces(a)netsurf-browser.org
> [mailto:netsurf-dev-bounces@netsurf-browser.org] On Behalf Of
> Michael Drake
>
> The existing plotter API has been slowly extended as NetSurf
> has evolved, and it's a bit inconsistent.
>
> John-Mark has put a proposal for improving it up here:
>
>
http://wiki.netsurf-browser.org/plotter-api
This all looks nicer to me, although I'd like to extend the API slightly to
simplify more complex plotters. The first change I'd like to forward is
simply:
bool (*initialise)(void *pw); /** <optional, may be NULL */
bool (*finalise)(void *pw); /** <optional, may be NULL */
These would be called upon the plotters being changed, and would allow for
any memory required by the plotters (knockout renderer's buffers etc) or
caching (LUTs for font matching?) to be cleanly handled.
Adrian had independently suggested the same to me :) I've made this
change.
The second change is to extend the bitmap API slightly to support
the CSS3
image-orientation tag (
http://www.w3.org/TR/css3-page/#orienting) I'd
suggest that the simplest manner to support this is to just add an extra
parameter to both bitmap and bitmap_tile.
bool (*bitmap)(void *pw, const plot_rect *rect, struct bitmap *bitmap,
colour_t bg_colour, float orientation);
bool (*bitmap_tile)(void *pw, const plot_rect *rect, struct bitmap *bitmap,
colour_t bg_colour, float orientation, bool repeat_x, bool repeat_y);
I wonder if the orientation can be sorted out in the core. Thus bitmaps
presented to the plotters are always oriented correctly.
Regarding the merging of these two functions -- I'm in two
minds. On the
positive side, it would give simpler code paths to follow, but on the
negative, it would add a bunch of pointless parameters to all non-background
image code. I'd possibly like to merge repeat_x and repeat_y into a flag
word too...
Yeah, I'm not entirely convinced about merging them, either. The GTK
tiled plotter, for example, does much the same a Tinct when plotting
tiled bitmaps -- expand small images to something larger and then tile
that for performance. I can see that being complicated by only having
one entry point.
J.