[cairo] Dia as a new Cairo testbed

Keith Packard keithp at keithp.com
Tue May 25 08:52:39 PDT 2004

Around 14 o'clock on May 25, Hans Breuer wrote:

> As an API user I'd rather prefer to do less conversion than more. One thing
> which took some to get right was the expectation of cairo to get pixels 32
> bit aligned even when I pass CAIRO_FORMAT_RGB24 to
> cairo_surface_create_for_image(), another thing is it apparently expecting
> BGR instead of RGB.

Yeah, it's hard to get the balance right here -- there are a million image 
formats and we don't want to fill your address space with conversion 
functions that you will never need, nor do we want to end up with the Xlib 
mess which has general image conversion routines which you can never use 
because they're too slow.

What we might do is canvas existing applications and see if there aren't a 
few common formats around and write functions that create in-memory 
surfaces from that data.

> And yet another thing, that Cairo doesn't make the copy it needs and 
> transforming/copying to it's native format itself, but instead insist on 
> keeping and free()ing _my_ data ;-)

That's intentional -- the in-memory surfaces are designed to be exposed to 
the application so you can get the pixels back out when you want to.   
That's also why cairo insists on a fixed format -- all of the drawing code 
has to be able to directly manipulate that data.

What you want is more of a DrawPixels API which takes an image in *your* 
format and paints it into a cairo surface (or creates a cairo surface from 
that data).

> In that case it uses the Pango backend (FT2 or to some extent win32)
> directly. Where I prefer the latter cause of performance and
> just-on-font-engine reasons. But that's a different story ...

Cairo exposes a low-level text API for FreeType if you want to use that,
and should eventually have similar APIs for Win32 and OS X. The reason I
suggested using Pango was that it would limit the font back-end dependent
code you had to maintain.  But, if you're already doing that, you might 
take a look at the cairo_ft_font functions which give you a pointer to the 
FreeType face associated with a cairo_font_t object (assuming that font 
came from FreeType in the first place).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20040525/7e4946b0/attachment.pgp

More information about the cairo mailing list