I have a canvas.
In the Paint event , I draw stuff.
In response to a pointerdown, or a pointerdrag, a SMALL part of the drawing needs to be updated.
If I call invalidate in the pointerdown, the whole canvas redraws, which is more or less acceptable, although with a lot of data to process, it could take 0.5 seconds to fully render.
But if I want to react in real time to a pointerdrag, the painting cannot keep up. Moving from to might involve 15 such renderings
Is there a way to draw in just a small area of a canvas at a time?
I cant find an invalidaterect() or (the old way) paint on canvas.graphics from a method.
There is no InvalidateRect in iOS.
But you could keep a reference to the rect to be updated and check if this rect isn’t nil in the iOSCanvas.paint event
It sounds like most of the display is static? The portion which is slow/expensive to render repeatedly can be rendered into a picture which is only updated when required and reused as the pointer is dragged.
Following Jason’s advice might be the best solution.
Just make sure to render the picture at the correct scale.
[code]Public Function MainScreenScale() as Double
//Jim McKay Retina detection
Static value As Double
if value < 1.0 then
'Function MainScreenScale() As Double
//declare function NSClassFromString lib "Foundation.Framework" (aClassName as CFStringRef) as Ptr
declare function NSClassFromString lib "Foundation" (aClassName as CFStringRef) as Ptr
soft declare function scale lib "UIKit" selector "scale" (classRef as Ptr) as CGFloat
soft declare function mainScreen lib "UIKit" selector "mainScreen" (classRef as Ptr) as ptr
value = scale(mainScreen(NSClassFromString("UIScreen")))