I think I get what you're saying. It sounds like we need a pd->graphics->setStencilPattern()
like pd->sprite has. Here's a helper function that makes an image from a pattern so that you can create images for your patterns then use setStencilImage() instead:
LCDBitmap* makePatternImage(LCDPattern* pattern)
{
LCDBitmap* image = pd->graphics->newBitmap(32, 8, kColorBlack);
pd->graphics->pushContext(image);
pd->graphics->fillRect(0, 0, 32, 8, (LCDColor)pattern);
pd->graphics->popContext();
return image;
}
Testing this I discovered that the LCDOpaquePattern macro in pd_api_gfx.h doesn't work right, gives an array initialized from non-constant array expression
error. I swear I tested that.. Maybe it was in a different context where this isn't a problem. But it looks like it works fine if you remove the type cast. Those extra 0xff
s are for the mask part of the pattern, and since they default to zero in an assignment like this you get a fully transparent pattern if you leave them out.
#define MakePattern(r0,r1,r2,r3,r4,r5,r6,r7) {(r0),(r1),(r2),(r3),(r4),(r5),(r6),(r7),0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}
LCDPattern pattern = MakePattern(0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa);
stencil = makePatternImage(&pattern);