Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : ili9341: magenta is the new grey
Author | Message | ||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 8592 |
I've been playing trying to plot some anti-aliased lines to make a better meter display when I came across the following issue (probably applies to the other displays but I haven't had chance to test them): The display on the ili9341 has a 16 bit colour code - RGB565. This means that there are 5-bits defining the red level (32 different values), 6-bits for green (64 different values) and 5-bits for blue. Geoff's code in 4.7b8 packs a 24-bit number into the RGB format by dividing red by 8, green by 4 and blue by 8 and then positioning the bits correctly in a 16-bit integer. You would assume therefore that rgb(250,250,250) would give a light grey colour. Unfortunately it doesn't - try running the code below (the display must be in landscape mode). The workround is to add 1 increment to the green intensity. option explicit option default none cls rgb(white) dim integer i for i=0 to 255 step 1 line i,0,i,239,4,rgb(i,i,i) next i line 256,0,256,239,,0 print "This is strange!" pause 4000 for i=0 to 255 step 1 line i,0,i,239,4,rgb(i,min(i+4,255),i) next i line 256,0,256,239,,0 print "This is better" end ' function min(a as integer, b as integer) as integer if a<b then min=a else min=b endif end function |
||||
viscomjim Guru Joined: 08/01/2014 Location: United StatesPosts: 925 |
Do you think this applies to the ST7735 also? |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3165 |
I have been checking the code and there may be a bug which is causing this. I will investigate further. Yes, this bug would also affect the ST7735. Geoff Graham - http://geoffg.net |
||||
Print this page |