I'm trying to port some code from Delphi to Firemonkey (XE6).
I've run into a problem with a function which draws to a TCanvas supplied by the caller. The Canvas could be from a TPaintBox, a TPanel, a TForm or a TBitmap. The function reads the TCanvas.ClipRect property to avoid doing cpu-intensive drawing outside of it. (The cliprect represents invalidated areas of the TForm, TPaintBox etc.)
Unfortunately the TCanvas ClipRect property no longer seems to exist. Does anyone know how I can access the TCanvas.ClipRect in Firemonkey? I did notice that TPaintBox and TPanel now have a ClipRect property, so I could maybe use those, but the TForm and TBitmap don't.
Please note, I'm not trying to create or change a cliprect in a Canvas, I'm trying to read it.
TCanvas.ClipRect
, as you can see by examining theFMX.Graphics.pas
source code.FMX.Graphics.TCanvas
is an abstract class, which means you can't actually create it; you create a descendent of it that implements the functionality and can add other functionality.FMX.Forms.TCustomForm.AddUpdateRects
usesTCanvasStyle.SupportClipRects in TCanvasManager.DefaultCanvas.GetCanvasStyle
to see if the current canvas even supports ClipRects, which indicates that not allTCanvas
descendants do. If the descendent doesn't support it, you can't get it. – Ken White