Hi,
I’m using version 2.7.6 of the C SDK on Windows 11. I’ve been trying for hours to get setStencil to work, but whenever I apply a stencil to a sprite, the sprite is not displayed.
The following module level variables are declared:
LCDBitmap* _mask;
LCDBitmap* _circle;
LCDSprite* _sprite;
My initialisation code looks like this:
// Create mask bitmap
_mask = _pd->graphics->newBitmap(32, 32, kColorClear);
_pd->graphics->pushContext(_mask);
_pd->graphics->fillRect(0, 0, 32, 16, kColorBlack);
_pd->graphics->popContext();
// Create sprite bitmap
_circle = _pd->graphics->newBitmap(32, 32, kColorClear);
_pd->graphics->pushContext(_circle);
_pd->graphics->drawEllipse(0, 0, 32, 32, 2, 0, 360, kColorBlack);
_pd->graphics->drawEllipse(4, 4, 24, 24, 1, 0, 360, kColorBlack);
_pd->graphics->popContext();
// Create sprite
_sprite = _pd->sprite->newSprite();
_pd->sprite->setImage(_sprite, _circle, kBitmapUnflipped);
_pd->sprite->moveTo(_sprite, 200, 120);
_pd->sprite->setStencil(_sprite, _mask);
_pd->sprite->addSprite(_sprite);
My update code is simply this:
_pd->sprite->drawSprites();
_pd->graphics->drawBitmap(_mask, 104, 104, kBitmapUnflipped);
return 1;
If expect to see this:

But instead, the sprite is not displayed, so I see this:

If I comment out the “setStencil” line, I see this.

The documentation just gives a one liner regarding setStencil, but it seems to be straightforward enough, so I’m assuming it’s a bug. I could be wrong!
Any ideas what’s going on here?
Cheers,
Rich.
