Pages: 1 [2]   Go Down
Author Topic: display.print() does not accept \r ???  (Read 1392 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
Offline Offline
Brattain Member
*****
Karma: 480
Posts: 18720
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I note in their library this bit of code:

Code:
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.
Logged


France
Offline Offline
Edison Member
*
Karma: 37
Posts: 1004
Scientia potentia est.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: December 19, 2012, 03:29:53 pm by guix » Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 1
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I note in their library this bit of code:

Code:
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...
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 480
Posts: 18720
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
class Adafruit_GFX : public Print {
 public:
Logged


Global Moderator
Offline Offline
Brattain Member
*****
Karma: 480
Posts: 18720
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Use this function:

Code:
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.
Logged


Offline Offline
Newbie
*
Karma: 1
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I note in their library this bit of code:

Code:
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!
Logged

Pages: 1 [2]   Go Up
Jump to: