Skip to content

Scrolling text may leave artifacts when a pixel is populated at trailing edge of graphic #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
fidodie opened this issue Jan 22, 2025 · 0 comments · May be fixed by #51
Open

Scrolling text may leave artifacts when a pixel is populated at trailing edge of graphic #50

fidodie opened this issue Jan 22, 2025 · 0 comments · May be fixed by #51
Assignees
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@fidodie
Copy link

fidodie commented Jan 22, 2025

Describe the problem

The endText function has the capability to scroll the printed text. In order to avoid leaving behind artifacts on the display while scrolling, the library must clear the pixels at the previous location of the text after each frame of the scrolling animation.

🐛 Artifacts are left behind in the matrix when scrolling text under any of the following sets of conditions:

  • Scroll direction is leftwards (SCROLL_LEFT)
  • A pixel is populated at the rightmost column of the bitmap for the final character in the string.

- OR -

  • Scroll direction is upwards (SCROLL_UP).
  • A pixel is populated at the bottom row of the bitmap for any character in the string.

- OR -

  • Scroll direction is downwards (SCROLL_DOWN).
  • A pixel is populated at the top row of the bitmap for any character other than the first character in the string.

Here you can see the problem as it occurs with the # character and SCROLL_LEFT:

Image

https://youtu.be/Eh01f96-NjY

To reproduce

SCROLL_LEFT

#include <ArduinoGraphics.h>
#include <Arduino_LED_Matrix.h>

ArduinoLEDMatrix matrix;

void setup() {
  matrix.begin();
  matrix.textFont(Font_4x6);
  matrix.textScrollSpeed(200);
}

void loop() {
  matrix.beginText(matrix.width(), 1, 0xFFFFFF);
  matrix.print("#");  // The bitmap for the Font_4x6 # character has two populated pixels on the rightmost column
  matrix.endText(SCROLL_LEFT);
}

🐛 A trail of artifacts is left on the display.

SCROLL_UP

#include <ArduinoGraphics.h>
#include <Arduino_LED_Matrix.h>

ArduinoLEDMatrix matrix;

void setup() {
  matrix.begin();
  matrix.textFont(Font_4x6);
  matrix.textScrollSpeed(300);
}

void loop() {
  matrix.beginText(1, matrix.height(), 0xFFFFFF);
  matrix.print("((");  // The bitmap for the Font_4x6 ( character has a populated pixel on the bottom row
  matrix.endText(SCROLL_UP);
}

🐛 A trail of artifacts is left on the display for each character in the string.

SCROLL_DOWN

#include <ArduinoGraphics.h>
#include <Arduino_LED_Matrix.h>

ArduinoLEDMatrix matrix;

void setup() {
  matrix.begin();
  matrix.textFont(Font_4x6);
  matrix.textScrollSpeed(300);
}

void loop() {
  matrix.beginText(0, matrix.height(), 0xFFFFFF);
  matrix.print("(((");
  matrix.endText(SCROLL_DOWN);
}

🐛 Although trail clearing works correctly for the first character, trail of artifacts is left on the display for each additional character in the string.

Expected behavior

Artifacts are not left behind on display when scrolling text.

ArduinoGraphics version

589b622

Display Library

Any

Verified with:

Additional context

Test/investigatory code:

#include <ArduinoGraphics.h>
#include <Arduino_LED_Matrix.h>

ArduinoLEDMatrix matrix;

Font fonts[] = { Font_4x6, Font_5x7 };
int directions[] = { SCROLL_LEFT, SCROLL_UP };

void setup() {
  matrix.begin();
  matrix.textScrollSpeed(50);
}

void loop() {
  for (byte fontIndex = 0; fontIndex < (sizeof(fonts) / sizeof(fonts[0])); fontIndex++) {
    matrix.textFont(fonts[fontIndex]);
    for (char character = 33; character < 127; character++) {
      matrix.beginText(matrix.width(), (matrix.height()-matrix.textFontHeight())/2, 0xFFFFFF);
      matrix.print(character);
      matrix.endText(SCROLL_LEFT);

      matrix.beginText((matrix.width()-matrix.textFontWidth())/2, matrix.height(), 0xFFFFFF);
      matrix.print(character);
      matrix.endText(SCROLL_UP);
    }
  }
}
@per1234 per1234 added type: imperfection Perceived defect in any part of project topic: code Related to content of the project itself labels Feb 12, 2025
@per1234 per1234 self-assigned this Feb 12, 2025
@per1234 per1234 changed the title Arduino R4 Wifi LED Matrix Behavior Scrolling text may leave artifacts when a pixel is populated at trailing edge of graphic Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants