aboutsummaryrefslogtreecommitdiff
path: root/examples/GraphicsLayer/Layer.cpp
diff options
context:
space:
mode:
authormrfaptastic <12006953+mrfaptastic@users.noreply.github.com>2020-12-07 22:44:56 +0000
committermrfaptastic <12006953+mrfaptastic@users.noreply.github.com>2020-12-07 22:44:56 +0000
commit82326230eb5d9bffabf81b88cd65c059b61a6921 (patch)
treec5fb77dd8a8cb02a9612b00476422e20b497044f /examples/GraphicsLayer/Layer.cpp
parent76351960b80ebbace056fad6b1107f92bb461703 (diff)
Updated GraphicsLayer example
Diffstat (limited to 'examples/GraphicsLayer/Layer.cpp')
-rw-r--r--examples/GraphicsLayer/Layer.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/examples/GraphicsLayer/Layer.cpp b/examples/GraphicsLayer/Layer.cpp
index 29ea97f..5c419c1 100644
--- a/examples/GraphicsLayer/Layer.cpp
+++ b/examples/GraphicsLayer/Layer.cpp
@@ -138,8 +138,11 @@ void Layer::drawCentreText(const char *buf, textPosition textPos, const GFXfont
{
int wstart = 0;
+/*
if (w > 42) wstart = (LAYER_WIDTH - w) / 2;
else wstart = (LAYER_WIDTH - w) / 2;
+*/
+ wstart = (LAYER_WIDTH - w) / 2;
if (textPos == TOP) {
setCursor(wstart, h+yadjust); // top
@@ -259,7 +262,7 @@ namespace LayerCompositor
* writeToBg = write the result back to the _bgLayer, and not directly to the output device!
* -> no need to do a subsequent bgLayer.display() otherwise.
*/
- void Stack(RGB64x32MatrixPanel_I2S_DMA &disp, const Layer &_bgLayer, const Layer &_fgLayer, bool writeBackToBg)
+ void Stack(MatrixPanel_I2S_DMA &disp, const Layer &_bgLayer, const Layer &_fgLayer, bool writeBackToBg)
{
for (int y = 0; y < LAYER_HEIGHT; y++) {
for (int x = 0; x < LAYER_WIDTH; x++)
@@ -290,7 +293,7 @@ namespace LayerCompositor
* Where the foreground pixels are not the background/transparent color, populate with
* whatever is in the background.
*/
- void Siloette(RGB64x32MatrixPanel_I2S_DMA &disp, const Layer &_bgLayer, const Layer &_fgLayer)
+ void Siloette(MatrixPanel_I2S_DMA &disp, const Layer &_bgLayer, const Layer &_fgLayer)
{
//const Layer *bg = &_bgLayer;
//const Layer *fg = &_fgLayer;
@@ -316,7 +319,7 @@ namespace LayerCompositor
- void Blend(RGB64x32MatrixPanel_I2S_DMA &disp, const Layer &_bgLayer, const Layer &_fgLayer, uint8_t ratio)
+ void Blend(MatrixPanel_I2S_DMA &disp, const Layer &_bgLayer, const Layer &_fgLayer, uint8_t ratio)
{
CRGB _pixel = 0 ;
@@ -329,7 +332,8 @@ namespace LayerCompositor
// (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);
// https://gist.github.com/StefanPetrick/0c0d54d0f35ea9cca983