windows - How do i undo the effect of IntersectClipRect? -
given following code snippet:
procedure tpicture.paintline(_canvas: tcanvas; _left, _top, _right, _bottom: integer); begin intersectcliprect(_canvas.handle, _left, _top, _right, _bottom); try _canvas.moveto(_left - 10, _top - 10); _canvas.lineto(_right + 10, _bottom + 10); // (this example only, actual drawing more complex.) selectcliprgn(_canvas.handle, 0); // end; end;
i want undo clipping effected call intersectcliprect active clipping becomes active again. in above code, done selectcliprgn(...,0) turns off clipping altogether. works, kind of, afterwards there no clipping active some drawing executed after above paint areas should not painted to.
so, correct way undo effect of intersectcliprect?
edit: removed unnecessary createrectrgn , deleteobject code after understood comment sertac, make question more readable others might stumble upon later.
iirc, first store current clip region using getcliprgn
, , after you're done, selectcliprgn
stored region again.
looking @ code, should enough selectcliprgn
your rgn
again, because:
the intersectcliprect function creates new clipping region intersection of current clipping region , specified rectangle.
Comments
Post a Comment