[cairo] Real-time ellipse creation - invalid matrix (not invertible) exception

Maximilian Heinzler maxi at heinzler.de
Thu Aug 23 06:39:18 PDT 2012

I think the problem appears if the mouse is the same position as the initial click. This would cause a cr->scale(0, 0), which results in an invalid matrix. So just do a little check before this drawing operation or set a minimum size for the ellipse.

-----Original Message-----
From: cairo-bounces+maxi=heinzler.de at cairographics.org [mailto:cairo-bounces+maxi=heinzler.de at cairographics.org] On Behalf Of Lockert Fredrick
Sent: Thursday, August 23, 2012 3:28 PM
To: Carlos López González
Cc: cairo at cairographics.org
Subject: Re: [cairo] Real-time ellipse creation - invalid matrix (not invertible) exception

On 23 August 2012 17:56, Carlos López González <genetita at gmail.com> wrote:
> I think that you have to restore after stroke, not before:
> cr->set_source_rgb(1.0, 1.0, 1.0);
> cr->fill_preserve();
> cr->stroke();
> cr->restore(); /// restore after stroke operation, not before

That would cause the stroke to be scaled with the arc, which would
create an undesired thick line around it.

The problem lies in the arc's scale operation. Whenever it goes from
positive to negative, it sometimes result in an invalid matrix. If the
mouse is moved fast enough though, it doesn't create an exception...
this confuses me more or less.

Thanks for your suggestion though, I really do appreciate it.

- Fredrick
cairo mailing list
cairo at cairographics.org

More information about the cairo mailing list