[cairo] graph plotting using cairo
behdad at behdad.org
Sun Aug 12 22:30:59 PDT 2007
On Sat, 2007-08-11 at 05:23 -0400, Kalle Vahlman wrote:
> show_layout() finished in 0,002034
> layout_path() & fill() finished in 0,164095
> layout_path() & stroke() finished in 0,624981
> The numbers are seconds elapsed during drawing 100 times the text
> "Test text" with each method, offsetting each iteration with
> translation and having a global translation and rotation of 15
> Perhaps Behdad could hint on why this is and if there is possibly some
> hidden downside to using show_layout() (since it seems too good to be
> true ;)?
Very simple: show_layout uses cairo glyph API which means you get a
bunch of cached glyph rasters composited onto the final surface. Fast.
The other two though append the path for the entire text to cairo_t and
then pass it through tesselator and rasterizer... You get the glyph
shape rasterized for every appearance of every glyph, not matter if they
are the same glyph or not..
The downside, well, no subpixel positioning because the cached glyphs
are pixel-aligned. It only matters if you use CAIRO_HINT_METRICS_OFF,
which is not the default.
"Those who would give up Essential Liberty to purchase a little
Temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin, 1759
More information about the cairo