iOSGraphics.ClipToRect works only once

If ClipToRect is used more than once, the first ClipToRect stays in effect, so it is impossible to use it to delimit several areas to draw in.

pic2 = new iOSBitmap(200,40,1.0,false) pic2.Graphics.ClipToRect(0, 0, pic.width, 3) pic2.graphics.FillRect(0,0,pic.width,pic.height) pic2.Graphics.ClipToRect(0, 0, pic.width, 40) pic2.graphics.FillRect(0,0,pic.width,pic.height)

The first ClipToRect limits drawing to 0,0,pic.width,3

Then the second one which allows drawing all over the picture never gets honored.

<https://xojo.com/issue/37598>

This is not a bug. When you call it the second time, you are clipping the already clipped area, which is only 3 pixels high.

Look at SaveState and RestoreState.

[quote=156955:@Greg O’Lone]This is not a bug. When you call it the second time, you are clipping the already clipped area, which is only 3 pixels high.

Look at SaveState and RestoreState.[/quote]

Ah. I see better. Thank you. The documentation is a little terse. Something like this would be a good addition to it :
See SaveState and RestoreState to redefine.