Page 1 of 1
Pi HDMI component colours are not right
Posted: Sun Aug 24, 2025 11:55 am
by RGV250
Hi,
I have been doing some tests to get used to the HDMI component and it does not seem to be working as it should.
First off I could not change the background colour, I have given that a miss for now but do not like the yellow it seems to default to.
I then started looking at positions, font and colours. The positions seem to be fine but the colours are not, see image.
Red does not appear to do anything.
Green shows up as red?
Blue works fine.
Combinations also do not appear to work, in the test I tried purple (red/blue) and it still looked blue. Light blue shows as white.
The first numbers are x/y position, then the colour it should be and the RGB values.
I also tried different fonts which did not seem to work but that could be me so I will look it up a bit more first.

- Pi Text test.jpg (91.79 KiB) Viewed 119 times
Regards,
Bob
Re: Pi HDMI component colours are not right
Posted: Sun Aug 24, 2025 12:15 pm
by chipfryer27
Hi Bob
No access to hardware to check (travelling just now) but could it be an issue with R/G/B positions? It appears above that Blue is correct so maybe Red and Green are mixed up giving you G/R/B instead...???
Maybe try 200/0/0 for Green and 0/255/0 for Red (using values from above) to check?
Regards
Re: Pi HDMI component colours are not right
Posted: Sun Aug 24, 2025 12:25 pm
by LeighM
The component was developed back in the days of 32 bit OS. I suspect that now with 64 bit the colour depth has increased. I'll have a play when I next get chance

Re: Pi HDMI component colours are not right
Posted: Sun Aug 24, 2025 12:44 pm
by RGV250
Hi,
I tried reversing red/green and probably worse as one text did not show at all.
I am going to try with a 32 bit OS now, will let you know how it went later.
Regards,
Bob
Re: Pi HDMI component colours are not right
Posted: Sun Aug 24, 2025 1:09 pm
by RGV250
Tried with 32 bit OS but still the same.
Bob
Re: Pi HDMI component colours are not right
Posted: Sun Aug 24, 2025 1:14 pm
by LeighM
Thanks.
I was nearly correct

I've just run it in debug mode (set 1 in the debug macro) and my setup reports 16 bits per pixel.
That's a lower colour depth than the code assumes.
The plot continues...
Re: Pi HDMI component colours are not right
Posted: Sun Aug 24, 2025 2:21 pm
by LeighM
Just had a quick look at the component, and it looks like it uses the same colour encoding for the Raspberry Pi target code as for the simulation code, namely 32 bit colour depth and 8 bits for the individual colours. I think the Pi frame buffer (16 bpp) should be RGB565 format.
edit: Ah, silly me, these are editable property fields in the component
Change them to 16, 5, 6, 5 and all will be well

Re: Pi HDMI component colours are not right
Posted: Sun Aug 24, 2025 2:54 pm
by RGV250
Hi,
Thanks for all your help, it works a treat. The green looked black at 200 but at 255 it is fine. I have noticed you can change the background default there as well.
Hopefully the change background function will work now as well.
Bob
Re: Pi HDMI component colours are not right
Posted: Sun Aug 24, 2025 3:21 pm
by LeighM
Yes, background colour is a common trap
You need to remember that SetColour just changes the "ink" for the next drawing operation.
So after SetBackgroundColour you need a ClearScreen
Re: Pi HDMI component colours are not right
Posted: Sun Aug 24, 2025 6:39 pm
by RGV250
Thanks, without that info I would have been caught out yet again, this is why I think there should be examples as I would not have had to ask so many questions.
I have progressed quite well now but having a bit of a problem with PrintNumber, if I put in 12345 it prints as expected, if I then use a variable (still INT) and put the number as it's start value that works. I am not sure if the variable has to be INT as it accepts Long or UINT but if I put a fixed value of 45678 (UINT) or 123456789 (Long) it shows a negative value so I am sticking with INT although that seems a bit of a limitation.
Then there is a problem when trying to display a count IE TestValue = TestValue + 1 and then display TestValue, all I get is a strange couple of characters.
Going to need a few beers to try to narrow the problem down.
Bob