[cairo] Bug drawing PNG images with transparency

Franz Schmid Franz.Schmid at altmuehlnet.de
Tue Aug 1 04:43:23 PDT 2006


Hi all,

during the development of Scribus i've encountered a strange bug
with the drawing of images with an alpha channel.

The code i've used to draw the images is as following:

	cairo_set_fill_rule(m_cr, cairo_get_fill_rule(m_cr));
	cairo_surface_t *image2;
	image2  = cairo_image_surface_create_for_data ((uchar*)image->bits(), CAIRO_FORMAT_ARGB32, image->width(), image->height(), image->width()*4);
	cairo_scale(m_cr, m_zoomFactor, m_zoomFactor);
	cairo_set_source_surface (m_cr, image2, 0, 0);
	cairo_paint_with_alpha(m_cr, fill_trans);
	cairo_surface_destroy (image2);

I've attached four images to illustrate the problem:
drawbug2.png shows as it should be
drawbug1.png shows the display with m_zoomFactor set to 0.5
drawbug3.png shows the display with fill_trans set to 0.5
path909.png is the image i'm drawing

This happens constantly with all kind of images which have an
alpha channel. I'm using the stable 1.2.0 release of cairo.

Best Regards,
Franz Schmid
Scribus Core-Developer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: drawbug1.png
Type: image/png
Size: 5837 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060801/8dc5da8c/drawbug1-0001.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: drawbug2.png
Type: image/png
Size: 12284 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060801/8dc5da8c/drawbug2-0001.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: drawbug3.png
Type: image/png
Size: 12307 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060801/8dc5da8c/drawbug3-0001.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: path909.png
Type: image/png
Size: 12949 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060801/8dc5da8c/path909-0001.png


More information about the cairo mailing list