Can anyone post a minimal working example of using a BufferedBitmap for off-screen drawing that works under SDK 4.0.10 (the most recent version?)
I have searched this forum for every mention of BufferedBitmap and BufferedBitmapReference. There are people who claim to have gotten a version that works (~10 months ago), but when I try any of the posted solutions today I still can't get anything to run without errors. I don't know if I'm missing something, or if Garmin is still messing with the SDK in minor updates.
Note: The SDK documentation for version 4.0 is still wrong: It claims that BufferedBitmap has a .getDc() method, which it no longer does. And that is the whole problem, I am unable to draw to a buffered bitmap without a Dc.
Many thanks!
import Toybox.Graphics;
//************************************************************
// Attempt #1:
function onUpdate(dc as Dc) as Void {
var buffer = Graphics.createBufferedBitmap({:width => dc.getWidth, :height => dc.getHeight});
buffer.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_BLACK);
buffer.clear();
}
// Error: Symbol Not Found Error
// Details: Could not find symbol 'setColor'
//************************************************************
// Attempt #2:
function onUpdate(dc as Dc) as Void {
var buffer = Graphics.createBufferedBitmap({:width => dc.getWidth, :height => dc.getHeight});
buffer = buffer.get();
buffer.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_BLACK);
buffer.clear();
}
// Error: Unhandled Exception
// Exception: UnexpectedTypeException: Expected Number/Float/Boolean/Long/Double, given Method
