[cairo] Drawing a recurring pattern

cool-RR cool-rr at cool-rr.com
Fri May 21 14:59:22 PDT 2010


Hello!

I am new to cairo and I'm using wxcairo to draw custom widgets in my
wxPython app.

I am making a Game of Life simulation. I want to draw a 2D grid of squares.
(I'm interested just in the wireframe of the grid now: The cells I've drawn
successfully.)

Can you suggest what would be a good way to draw the grid?

What I figured, as a total noob, is to make a `Pattern`, let's says with a
size of (5, 5), assuming that's the cell size I'm using for my grid, and
then draw two grey lines, one from (0, 0) to (0, 4) and one from (0, 0) to
(4, 0).

Then I use the needed extend style to draw this on my actual context.

Is this a good way?

Question: How will I set the position of the grid?

Also: What class of `Pattern` should I use for it?

Thanks,
Ram Rachum.

(P.S. Please put me in the `to` field if you send a message on this thread.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20100521/f9c8f0b8/attachment.html>


More information about the cairo mailing list