GraphicsLayer minor tweaks
This commit is contained in:
parent
82326230eb
commit
09dabb2e35
2 changed files with 35 additions and 12 deletions
|
@ -86,6 +86,7 @@ void setup() {
|
|||
|
||||
}
|
||||
|
||||
int LayerCompositor_mode = 0;
|
||||
void loop() {
|
||||
|
||||
for (int x = 0; x < dma_display.width(); x++) {
|
||||
|
@ -119,8 +120,28 @@ void loop() {
|
|||
* Step 3: Merge foreground and background layers and send to the matrix panel!
|
||||
* Use our special sauce LayerCompositor functions
|
||||
*/
|
||||
LayerCompositor::Siloette(dma_display, bgLayer, textLayer);
|
||||
//LayerCompositor::Stack(dma_display, bgLayer, textLayer);
|
||||
switch (LayerCompositor_mode)
|
||||
{
|
||||
case 0:
|
||||
LayerCompositor::Siloette(dma_display, bgLayer, textLayer);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
LayerCompositor::Stack(dma_display, bgLayer, textLayer);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
LayerCompositor::Blend(dma_display, bgLayer, textLayer);
|
||||
break;
|
||||
}
|
||||
|
||||
EVERY_N_SECONDS(5) { // FastLED Macro
|
||||
LayerCompositor_mode++;
|
||||
dma_display.clearScreen();
|
||||
if (LayerCompositor_mode > 2) LayerCompositor_mode = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// LayerCompositor::Blend(dma_display, bgLayer, textLayer, 127);
|
||||
|
||||
} // end loop
|
||||
|
|
|
@ -295,8 +295,6 @@ namespace LayerCompositor
|
|||
*/
|
||||
void Siloette(MatrixPanel_I2S_DMA &disp, const Layer &_bgLayer, const Layer &_fgLayer)
|
||||
{
|
||||
//const Layer *bg = &_bgLayer;
|
||||
//const Layer *fg = &_fgLayer;
|
||||
|
||||
for (int y = 0; y < LAYER_HEIGHT; y++) {
|
||||
for (int x = 0; x < LAYER_WIDTH; x++)
|
||||
|
@ -327,14 +325,18 @@ namespace LayerCompositor
|
|||
{
|
||||
for (int x = 0; x < LAYER_WIDTH; x++)
|
||||
{
|
||||
/*
|
||||
// set the blend ratio for the video cross fade
|
||||
// (set ratio to 127 for a constant 50% / 50% blend)
|
||||
uint8_t ratio = beatsin8(5);
|
||||
*/
|
||||
|
||||
// (set ratio to 127 for a constant 50% / 50% blend)
|
||||
_pixel = blend(_bgLayer.pixels->data[y][x], _fgLayer.pixels->data[y][x], ratio);
|
||||
_pixel = _bgLayer.pixels->data[y][x];
|
||||
|
||||
// (set ratio to 127 for a constant 50% / 50% blend)
|
||||
//_pixel = blend(_bgLayer.pixels->data[y][x], _fgLayer.pixels->data[y][x], ratio);
|
||||
|
||||
// Blend with background if foreground pixel isn't clear/transparent
|
||||
if (_fgLayer.pixels->data[y][x] != _fgLayer.transparency_colour)
|
||||
{
|
||||
_pixel = blend(_bgLayer.pixels->data[y][x], _fgLayer.pixels->data[y][x], ratio);
|
||||
} // if the foreground is transparent, then print whatever is the bg
|
||||
|
||||
|
||||
// https://gist.github.com/StefanPetrick/0c0d54d0f35ea9cca983
|
||||
disp.drawPixelRGB888(x,y, _pixel.r, _pixel.g, _pixel.b );
|
||||
|
|
Loading…
Reference in a new issue