Go Down

Topic: display.print() does not accept \r ??? (Read 2110 times) previous topic - next topic

Nick Gammon

I note in their library this bit of code:

Code: [Select]

void Adafruit_GFX::setTextColor(uint16_t c) {
  textcolor = c;
  textbgcolor = c;
  // for 'transparent' background, we'll set the bg
  // to the same as fg instead of using a flag
}


Sounds like you are in transparent mode.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

guix

#16
Dec 19, 2012, 09:28 pm Last Edit: Dec 19, 2012, 09:29 pm by guix Reason: 1
I've looked into both libraries Adafruit_GFX and Adafruit_HX8340B and I can't see anything related to a function named "print", how is it possible that display.print or println can be used? Is there a magic trick? I would like to understand.


So you are saying that drawing just ORs the new pixels over the existing ones? Strange. Well you will have to find a "clear rectangle" function then.


Yepp...That's exactly what it does...
I will take a picture this evening.


I note in their library this bit of code:

Code: [Select]

void Adafruit_GFX::setTextColor(uint16_t c) {
  textcolor = c;
  textbgcolor = c;
  // for 'transparent' background, we'll set the bg
  // to the same as fg instead of using a flag
}


Sounds like you are in transparent mode.


I will try to set the text color BLACK (or whatever the background is) and write the spaces...

Nick Gammon


I've looked into both libraries Adafruit_GFX and Adafruit_HX8340B and I can't see anything related to a function named "print", how is it possible that display.print or println can be used? Is there a magic trick? I would like to understand.


It is derived from Print:

Code: [Select]

class Adafruit_GFX : public Print {
public:
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Nick Gammon


I will try to set the text color BLACK (or whatever the background is) and write the spaces...


Use this function:

Code: [Select]

void Adafruit_GFX::setTextColor(uint16_t c, uint16_t b) {
   textcolor = c;
   textbgcolor = b;
}


Set different text and background colours (eg. white, black). See what that does.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics


I note in their library this bit of code:

Code: [Select]

void Adafruit_GFX::setTextColor(uint16_t c) {
  textcolor = c;
  textbgcolor = c;
  // for 'transparent' background, we'll set the bg
  // to the same as fg instead of using a flag
}


Sounds like you are in transparent mode.


RIGHT ON TARGET!

I just defined a color for both BG and FG and voila' the characters now are perfectly dispalyed!

THANKS!

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy