Shapes and paints should also be managed by redraw manager. Redraw manager must know life-cycle of shapes and paints to avoid to use them after being free. If a shape is released when it is dirty, redraw manager will try to access them, after released, for redrawing. We can make a copy information need by redraw manager to redraw them, but it is more complicate, and induce runtime overhead.
So, redraw manage had better also manage life-cycle of shapes and paints. Shapes and paints should be created and freed through interfaces provided by redraw manager. To reduce overhead of interfaces, they can be implemented as C macros.
To refactory redraw manage to manage life-cycle of shapes and paints, following functions/macros are introduced.