Page 1 of 1

How do you invert text on the display?

Posted: Fri Mar 11, 2016 7:06 pm
by ryemac3
I have a small clock interface that I'm working on. In order to set the clock, I have a button that steps the user through the various fields: hours, minutes, month, day, year, etc. Another push button increments the value. In order to let the user know what value they are setting, I wanted to invert the value being displayed. So far all I've been able to do is invert the entire display. I thought that passing oled.invert(hours); for example, would do the trick, but it just inverts the whole display.

How do you invert just a single portion of the display, or a single value on screen?

Or do I have to create an inverted font and swap out the characters?

Re: How do you invert text on the display?

Posted: Fri Mar 11, 2016 7:21 pm
by skimask
....what display?

Re: How do you invert text on the display?

Posted: Sat Mar 12, 2016 5:23 am
by scotta
I haven't tried it, but I think using some combination of setColor() and setDrawMode(), before writing your text, should allow you to write inverted text, or any other object.

You may find that the area that you want to write to has to be cleared or inverted before writing the text. You could do that with a filled rectangle, or writing text spaces before the actual text you want to display.

Re: How do you invert text on the display?

Posted: Sat Mar 12, 2016 5:46 am
by scotta
OK, I just tried it. Just using setColor(BLACK), before writing, should do what you want. Remember to use setColor(WHITE) to return to normal mode.

Re: How do you invert text on the display?

Posted: Sun Mar 13, 2016 9:05 am
by ryemac3
Cool. Thanks. That works.

Image

You can see how I've inverted the month in one image and minutes in the other. Although the font does leave something to be desired, it's progress nonetheless. Thanks.