[cairo] Paint error with group

Wangming mingwonder.wang at huawei.com
Wed Jan 18 18:23:09 PST 2012


Hi,

I am use cairo-6816f70da54e730e88b98c8592aa6fc84e082928.zip(latest cario versio, 2011-12-16) to develop application. And I am use the OpenGL ES2.0 backend for cairo.

I found that the composition result was incorrect if I use cairo_push_group and cairo_pop_group_to_source to generate the source. But the result will be correct if I do not use it.

Here is my code with incorrect result.

/************************code begin**************************************/
cairo_surface_t* cairosurf = cairo_gl_surface_create_for_egl_higo(1280, 720);
cairo_t* cr = cairo_create(cairosurf);


cairo_translate(cr, 0, 0);

cairo_set_source_rgba (cr, 0.0, 1.0, 0.0, 0.8);
cairo_rectangle(cr, 100, 100, 300 , 200);
cairo_fill (cr);

cairo_push_group (cr);

cairo_set_source_rgba (cr, 0.0, 0.0, 0.9, 0.4);
cairo_rectangle(cr, 150, 150, 600, 400);
cairo_fill (cr);

cairo_pop_group_to_source (cr);

cairo_set_operator (cr, CAIRO_OPERATOR_OVER);

cairo_paint (cr);
cairo_gl_higo_refresh();
/************************code end**************************************/

Here is my code with correct result.

/************************code begin**************************************/
cairo_surface_t* cairosurf = cairo_gl_surface_create_for_egl_higo(1280, 720);
cairo_t* cr = cairo_create(cairosurf);


cairo_translate(cr, 0, 0);

cairo_set_source_rgba (cr, 0.0, 1.0, 0.0, 0.8);
cairo_rectangle(cr, 100, 100, 300 , 200);
cairo_fill (cr);

cairo_set_operator (cr, CAIRO_OPERATOR_OVER);

cairo_set_source_rgba (cr, 0.0, 0.0, 0.9, 0.4);
cairo_rectangle(cr, 150, 150, 600, 400);
cairo_fill (cr);

cairo_paint (cr);
cairo_gl_higo_refresh();
/************************code end**************************************/

I used some method to get group source and paint its texture onto screen after call cairo_paint (cr). I found that the texture content is wrong.

Can anybody give me any suggestions to solve the problem?

Thanks in advance.

Best Regards
Ming


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20120119/92983556/attachment.html>


More information about the cairo mailing list