How to Clear a GFXcanvas Buffer

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
MacPit69
 
Posts: 3
Joined: Tue Sep 27, 2022 9:39 am

How to Clear a GFXcanvas Buffer

Post by MacPit69 »

Hello
I tried to use an GFXcanvas object from the Adafruit_GFX Library to update a value displayed on an TFT with ILI9341-Controller.

if I do that:

Code: Select all

GFXcanvas1 Value1(128, 28);
Value1.setFont(&FreeSans18pt7b);
Value1.setCursor(0, 28);
Value1.println("AAAA");
tft.drawBitmap(x2, y1, Value1.getBuffer(), 128, 28, ILI9341_CYAN, ILI9341_ORANGE);

Value1.setFont(&FreeSans18pt7b);
Value1.setCursor(0, 28);
Value1.println("BBBB");
tft.drawBitmap(x2, y1, Value1.getBuffer(), 128, 28, ILI9341_CYAN, ILI9341_ORANGE);
the Output will be a mix of "AAAA" & "BBBB".
if I remove the second "setCursor" Statement the output will ever be "AAAA"

How can I Display the "BBBB" without any Pixels on the Display from the "AAAA" ?

Thx for help and sorry for my English *smile*

MacPit69

User avatar
adafruit_support_mike
 
Posts: 67391
Joined: Thu Feb 11, 2010 2:51 pm

Re: How to Clear a GFXcanvas Buffer

Post by adafruit_support_mike »

Delete the old GFXCanvas, create a new one, and draw in that.

It looks like you're drawing text over an image, and there's no easy way to erase that kind of text to make room for more.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”