Re: Drawing antialiased shapes with alpha transparency
- From: Daniel Serpell <daniel_serpell yahoo com>
- To: Samuel Abels <newsgroups debain org>
- Cc: gtkmm-list gnome org
- Subject: Re: Drawing antialiased shapes with alpha transparency
- Date: Wed, 5 Jan 2005 16:05:53 -0300
Hi!
El Wed, Jan 05, 2005 at 06:33:11PM +0100, Samuel Abels escribio:
> On Wed, 2005-01-05 at 11:40 -0300, Daniel Serpell wrote:
> > You could try cairo: www.cairographics.org
>
> Now I am probably going completely off topic, but I can't think of a
> better place right now...
>
[...]
>
> Unfortunately libcairo is poorly documented. The examples look fairly
> simple, but are also incomplete (where is the pixmap created, what is
> cr, etc.); most of the documentation links on the cairo homepage are
> broken either.
See the examples at http://cvs.cairographics.org/cairo-demo/
> Do you know whether this supports rendering into an RGBA buffer, thus
> preserving the alpha? I haven't found any information on this.
I think is already supported.
> I like the general idea of cairo and though I would probably have to
> rewrite some parts of the canvas I would like to use it if it supports
> this.
>
> Also, I don't know which of
>
> cairo_t* cr;
> cairo_surface_t* surface;
>
> is the buffer. And is it a standard RGBA buffer that can be drawn using
> Gdk::Pixbuf::create_from_data()?
None of them :-)
You connect your own buffer to a cairo_t object using:
cairo_set_target_image (cairo_t *cr,
char *data,
cairo_format_t format,
int width,
int height,
int stride);
"format" is CAIRO_FORMAT_ARGB32 in your example, "data" is your own RGBA
buffer, "stride" is the size of each row in the buffer (in bytes).
For a very simple example, using only memory buffers, see:
http://cvs.cairographics.org/cairo-demo/png/spiral.c?rev=1.2&view=auto
The buffer can be obtained from a Gdk::Pixbuf if you want.
Daniel.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]