← Back to team overview

elementary-dev-community team mailing list archive

Re: Why does Cairo.set_source_rgb paint the whole canvas?

 

The effect you observe is caused by the paint call at the bottom. Remove
that and it should work fine. But you also have to insert
ctx.set_operator(Cairo.Operator.CLEAR);
ctx.paint();
ctx.set_operator(Cairo.Operator.OVER);
at the very bottom of the draw method which clears the canvas. Clutter
doesn't do that for you.
On Apr 15, 2013 6:05 AM, "Craig" <weberc2@xxxxxxxxx> wrote:

> I posted this question on StackOverflow, but I'm hoping you guys can help
> answer it as well:
>
> I'm playing around with Clutter/cairo and I'm trying to draw a rectangle;
> however, it appears that theset_source_rgb is automatically painting the
> whole canvas with its source, regardless of whether or not I tell it to
> draw a rectangle (that is, even when I remove the ctx.rectangle() and
> ctx.fill()lines, the rectangle is still drawn). Why is this? And what do
> I need to do to have the rectangle do the painting rather than the
> set_source_rgb?
>
> The source can be found in the original SO question here:
> http://stackoverflow.com/questions/16007420/why-does-cairo-set-source-rgb-paint-the-whole-canvas
>
> Please advise, because I'm stumped!
>
> Thanks List!
> - Craig
>
> --
> Mailing list: https://launchpad.net/~elementary-dev-community
> Post to     : elementary-dev-community@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~elementary-dev-community
> More help   : https://help.launchpad.net/ListHelp
>
>

References