C-API I really don't understand how LCDSolidColor works with Fonts

When I draw text, I create a bitmap with a transparent background, and overlay that with some coloured text, black or white typically. Then this is just blitted wherever I need it.

But what I can't work out, is that if I paint kColorWhite text on a kColorBlack background it just doesn't show up. I have to use kColorXOR instead of the white, then it's fine.

/me shrugs

It would be great if someone could explain how this works to me... or indeed point me to some reference doco.

Looking at the code, it seems you’re passing the wrong type to setDrawMode which is producing the unexpected results you’re setting.

That API expects a LCDBitmapDrawMode rather than a LCDColor. From the docs:

void playdate->graphics->setDrawMode(LCDBitmapDrawMode mode);

typedef enum
{
	kDrawModeCopy,
	kDrawModeWhiteTransparent,
	kDrawModeBlackTransparent,
	kDrawModeFillWhite,
	kDrawModeFillBlack,
	kDrawModeXOR,
	kDrawModeNXOR,
	kDrawModeInverted
} LCDBitmapDrawMode;

You’ll either want to pass in the draw mode to your helper method, or do a conversion between LCDColor an LCDBitmapDrawMode (eg: kColorBlack should map to kDrawModeFillBlack).

1 Like