It tried to improve the coloring of the atomic-captures animation, (changing the color of the blast wave from white -> yellow -> orange -> red -> grey during the explosion) because cairo offers an easy way to adjust the colors. But it seems there is something seriously wrong also with this animation. When I set -animationSpeed 500, so that I can see what happens exactly, it turns out that from the 15 sequences the animation is supposed to draw, only 5 or so show up. And they show up seconds later that they were actually drawn. (I put a printf in the code to see when they were drawn.)
So apparently something is seriously slowing down the drawing, while there also seems to be a problem flushing the draw operations to the display, which is probably also why -animateMoving is not working properly. Because there seemed to be no explicit calls in the code to flush what is drawn, I googled a bit on 'cairo' to see how this is supposed to work, and it seems that drawing something generates an expose event. But the expose-event handler draws an entirely new board. This will probably overwriting the animated piece. (Animate dragging will not suffer from this, because DrawDragPiece is called from the board drawing routine.) And because the board is drawn without clipping, this will be very slow. I guess it will be essential to speed up the drawing process by letting the expose-event handler set a clipping region on the exposed area, or it would try to draw an entire board for every tiny dot you try to draw in it. Accordingtomy google source this could be achieved by two cairo calls (cairo_rectangle(cr, coords); clip(cr);), but the problem is that the cairo context cr does not exist yet in the handler, but is created and destroyed for every element of the board that is drawn. I wonder if this is proper use of cairo; it would seem more logical to create it once, and pass it as parameter to the routines for drawing squares, pieces, grid etc. When you take a careful look at dragging a piece, you can see that the background still shines a bit through the piece. This is a consequence of sythesizing the image to draw directly on the display: first the background is drawn (and becomes visible), then the dragged piece is drawn over it. It would be better to draw in a buffer, and then copy the buffer to the display.
