Page 1 of 1

Cairo composing

Posted: Mon Apr 02, 2012 3:17 pm
by YesCop
Hi everybody,
I am back as Mr T. used to say.
I made some intensive tests of cairo. And I have something I can't do and can't explain why.
I would just want to copy one surface to another using the operator SOURCE.
Before I tested it with drawing in the same context

Code: Select all

		cairo_set_source_rgba (cr, 1.0, 0.0, 0.0, 0.9);
		cairo_rectangle(cr, 0, 300,150, 100);
		cairo_fill(cr);
		cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
		cairo_set_source_rgba (cr, 0.0, 0.0, 1.0, 0.5);
		cairo_rectangle(cr, 70, 350,150, 100);
		cairo_fill(cr);
Here the copy works as it must.
Now if I want to copy one surface (surface00 from a different context) to another

Code: Select all

		cairo_set_source_surface(cr, surface00, 0, 600);		
		cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
		cairo_paint(cr);
The result is, in fact depends on the surfaces.
Here if surface00 is created by cairo_image_surface_create and surface(from cr) by cairo_amigaos_surface_create, I have a copy of surface00 in cr.
All my previous drawings in cr are deleted.

If I do the same but surface (cr) is created by cairo_pdf_surface_create, all is perfect.

So I don't know why. I thought a bug in cairo's cairo_amigaos_create but if I am right, the OS4 developpers use cairo to display windows and that works.
So if any of the OS4 developpers or any users of cairo could help, I would appreciate a lot.

YesCop

Re: Cairo composing

Posted: Mon Apr 02, 2012 9:11 pm
by chris
cairo_amigaos_surface_create() needs to be supplied with an ARGB32 BitMap. If you pass anything else to it you tend to get no output.

Re: Cairo composing

Posted: Tue Apr 03, 2012 12:29 am
by YesCop
Hi Chris,

Yes it is done. Imagine that i make a drawing and use the operator OVER. All is fine.
But if I replace OVER by SOURCE, there is a problem, that's the purpose of my post.

Re: Cairo composing

Posted: Tue Apr 03, 2012 7:42 pm
by chris
If it's definitely ARGB32 then I've exhausted my Cairo knowledge, sorry.

Re: Cairo composing

Posted: Sat Apr 14, 2012 1:38 pm
by YesCop
Hi Chris,
First, I will thank you for your interest, you were the only one. :?

I hope this time that someone could explain me what is the problem with cairo. A few months ago, I posted about cairo in the sdk forum without answer neither. Is it cairo a taboo ? 8-)
I sincerally hope that some (OS or not) developpers could answer to me. :!:

Cheers,
YesCop