Re: JSUI-MGraphics patch-a-day


Darwin Grosse

Here is the patch for November 20, 2011:

So digging into cairographics site, I ran across some information about dealing with the distortion of a warped transform matrix. In this example, I use the save() and restore() functions to reset the transformation before the stroke() call is made, thereby making the lines work better.

With the toggle box in the patch unchecked, it works identically to yesterday’s patch. If you turn on the toggle, though, the drawing routine is changed so that stroke() is not called until we restore the transform to its normal state.

The save() and restore() functions are perfect for this sort of application: a situation where you alter the environment considerably, but don’t want to pay a penalty in graphic output quality. I hope this makes sense, but the (somewhat subtle) visible end result should speak for itself.

Enjoy!

Nov 21, 2011 at 12:56am #214986