Not as easy as I thought as you are using an ArrayBuffer to assemble the pattern on the left hand side.
But I think I got it (almost). The issue is that setColor(1) will always mean black unless the color palette is reversed for the ArrayBuffer.
so in drawCirclesWIthPattern()
var pal_bw;
if (g.theme.dark)
pal_bw = new Uint16Array([0xffff,0x0000],0,1); // white, black
else
pal_bw = new Uint16Array([0x0000,0xffff],0,1); // black, white
drawBuffer.setColor(1);
drawBuffer.fillRect(0,0, drawBuffer.getWidth(), drawBuffer.getHeight());
CIRCLES.forEach((circle) => drawCircle(circle, drawBuffer, scale));
drawBuffer.setColor(1);
drawBuffer.setFontAlign(0, 0);
drawBuffer.setFont("Vector", 40 * scale);
pattern.forEach((circleIndex, patternIndex) => {
var circle = CIRCLES[circleIndex];
drawBuffer.drawString(
patternIndex + 1,
(circle.x + (scale === 1 ? 1 : 5)) * scale,
circle.y * scale
);
});
image = {
width: drawBuffer.getWidth(),
height: drawBuffer.getHeight(),
bpp: 1,
buffer: drawBuffer.buffer,
palette:pal_bw
};
The code at the bottom of drawCircle = becomes...
log("drawing circle");
log({ x: x, y: y, r: r });
drawBuffer.setColor(0);
drawBuffer.fillCircle(x, y, r);
};
My only doubt is if I have specified the color palette correctly for the Bangle 2.
My guess is that I have as I suspect that the ArrayBuffer / Palette interface is unchanged.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Hi there @crazysaem,
Not as easy as I thought as you are using an ArrayBuffer to assemble the pattern on the left hand side.
But I think I got it (almost). The issue is that setColor(1) will always mean black unless the color palette is reversed for the ArrayBuffer.
so in drawCirclesWIthPattern()
The code at the bottom of drawCircle = becomes...
My only doubt is if I have specified the color palette correctly for the Bangle 2.
My guess is that I have as I suspect that the ArrayBuffer / Palette interface is unchanged.