[cairo] Real-time ellipse creation - invalid matrix (not invertible) exception
lockert.fredrick at gmail.com
Thu Aug 23 07:40:10 PDT 2012
On 23 August 2012 22:39, Maximilian Heinzler <maxi at heinzler.de> wrote:
> 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.
Thanks mate, that did in fact solve the matrix exception.
if(radius_x == 0)
radius_x += 0.1;
if(radius_y == 0)
radius_y += 0.1;
Actually, only one of the values had to be 0. So passing either
center_x or center_y lines, would cause it to throw an exception.
Funny that the documentation doesn't mention that 0 values are invalid
(at least I can't remember to have seen any mention of it), would
probably save some people some head scratching, me thinks.
Again, thank you very much Maximilian.
More information about the cairo