Function Painter.save

Save matrix, clip, and anti-aliasing setting into internal stack.

int save (
  ref PaintSaver saver
);

Returns

Depth of the saved stack.

Example

// `pr` is a painter instance
{
    PaintSaver sv;
    pr.save(sv);
    pr.translate(100, 0);
    pr.fillRect(0, 0, 50, 50, NamedColor.green);
} // translation is gone when `sv` goes out of scope
pr.fillRect(0, 0, 50, 50, NamedColor.red);