This is from the SimDesignerCanvas thread:
[quote=91052:@Christoph De Vocht]I found a way to speedup the Canvas paint event A LOT ! In my experience this multiplies with at least 3 times the drawing speed.
Put this in the paint event (all credits to Sam for this !!)
declare sub CGContextSaveGState lib “Cocoa” ( context as integer )
declare sub CGContextSetInterpolationQuality lib “Cocoa” ( context as integer, quality as integer )
declare Sub CGContextRestoreGState lib “Cocoa” ( context as integer )
Dim CGContextRef as integer = g.handle( g.HandleTypeCGContextRef )
CGContextSaveGState CGContextRef
CGContextSetInterpolationQuality CGContextRef, 1
// ---------------------- Do drawing stuff here
// ---------------------- Finished, then restore the previous state.
CGContextRestoreGState CGContextRef[/quote]
I am ignorant in this area … but when something seems to good to be true, then it’s time to ask questions before charging ahead.
Is this generally applicable to all graphics objects or just graphic objects in all paint events in all controls (say a listbox).
Is there any downside to using this? If not why is this not part of the Xojo framework?
What if one uses it with a graphics object from a clipped region? What if one creates a clipped graphics object on a graphics object AFTER one has done this to it?
What about with the graphics object from a picture?
- Karen