Re: Drawing antialiased shapes with alpha transparency



On Wed, 2005-01-05 at 16:05 -0300, Daniel Serpell wrote:
> See the examples at http://cvs.cairographics.org/cairo-demo/

Ah, I already saw that site after talking to somebody on freenode/#cairo
(I thought the link broken because the first time I tried it showed only
a python error, which was apparently temporary) but missed the simple
example that you pointed out.

> 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.

Thanks, this is what I will do.

-Samuel
-- 
 ------------------------------------------------------
|      Samuel Abels       |   http://www.debain.org    |
| spam ad debain dod org  | knipknap ad jabber dod org |
 ------------------------------------------------------



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]