Ticket Created
over 4 years ago

CIQQA-377

SDK 4.0.2 simulator - buffered bitmaps colors only black and white

The simulator does not display the correct color palette for buffered bitmaps.

When I build for a F6X and SDK 3.2.0 and start the simulator all buffered bitmaps only use black and white.

Code sample:

function bufferedBitmapFactory(options as {:width as Number, :height as Number, :palette as Array<ColorType>, :colorDepth as Number, :bitmapResource as WatchUi.BitmapResource}) as BufferedBitmapReference or BufferedBitmap {
        if (Graphics has :createBufferedBitmap) {
            return Graphics.createBufferedBitmap(options);
        } else {
            return new Graphics.BufferedBitmap(options);
        }
    }
    
function createBufferedBitmaps() {
        buffer1 = bufferedBitmapFactory({:width=>10, :height=>10, :palette=>[color1, color2, color3, color4]});
        buffer2 = bufferedBitmapFactory({:width=>10, :height=>10, :palette=>[color1, color2, color3]});
        buffer3 = bufferedBitmapFactory({:width=>20, :height=>20, :palette=>[color1, color2, color3, color4, color5]});
    }

  • Hi, currently this effect appears while I changed the SDK version to v4.0.2 (from 3.2.5) and simply start the simulator for my watch face code.

    https://apps.garmin.com/de-DE/apps/fc3f9b9f-add6-46cb-8e0b-9a2172a04c31

    Then the graphs in the buffered bitmaps do not have the correct color, only black and white is shown.

    By adding the upper factory function (check sample code) I thought that would fix the issue in the SDK v4 but colors are still missing.

    Is there a demo code or an example how to get the buffered bitmaps working with the new SDK v4.0.2? The current SDK doc doesn't include the information, it is still on v3.x.

    At the moment I do not understand the new concept of the buffered bitmaps. It would be nice to get some additional information about that.

    Here is how the colors are set at the buffered bitmap draw context (in pseudo code):

    onUpdate(){
    //define colors
    color1 = -1;
    color2 = #FF0000; //red
    color2 = #00FF00; //green
    ...
    
    createBufferedBitmaps();
    var bitmapDc = buffer1.getDc();
    bitmapDc.setColor(color2, -1);
    //draw something with the selected color to buffer1
    bitmapDC.draw...  // <--- here the color is not red, it's black
    bitmapDc.setColor(color3, -1);
    bitmapDC.draw...  // <--- here the color is not gree, it's white
    dc.drawBitmap(0, 0, buffer1);
    }

    The things is that running the simulator in SDK 3.2.5 everything works fine and running the same code in v4.x doesn't work correctly.

    When the watch face is exported with v4.0.2 and installed on the device (e.g. F6X) everything works fine. This also works fine without adapting the code to the new buffered bitmap behavior. So, the issue is only related to the simulator.

  • Hello .  I wasn't able to reproduce this using the 4.0.2 SDK and a small app that I made to test buffered bitmaps(see below).  Would you mind sharing the code that displays what colors you were using/how you were drawing the buffered bitmap.