Everything, is fairly straight forward in the pen example. It uses wxDC::DrawRectangle where is an abstract data class for wxPaintDC. Basically a bunch of rectangles are drawn with different patterns.
The patterns are defined constructor in wxPen
So… on to Regions… Now piece of sample codes gets a little more interesting to me…
This is one of those instance where a picture is worth a thousand words…
On a side note, at some point I need to get back to drag and drop. I just fired up Inkscape and dragged and dropped the png into it. I’m thinking about adding some some notes on the graphic. I’m going to have to learn how to do that… I basically bypassed it in this tutorial..
In zetcode’s sample code nearly each set of squares is build around the same template.
dc.DrawRectangle(100, 20, 50, 50);
dc.DrawRectangle(110, 40, 50, 50);
wxRegion region1(100, 20, 50, 50);
wxRegion region2(110, 40, 50, 50);
wxRect rect1 = region1.GetBox();
Ok.. lets see. SetBrush, Drawrectangle, been there/ done that..
wxRegion, SetClippingRegion , DestroyClippingRegion are new for me.
I basically copied this from the wxsite
A wxRegion represents a simple or complex region on a device context or window.
This class uses reference counting and copy-on-write internally so that assignments between two instances of this class are very cheap. You can therefore use actual objects instead of pointers without efficiency problems. If an instance of this class is changed it will create its own data internally so that other instances, which previously shared the data using the reference counting, are not affected.