Pi HDMI component colours are not right

Any bugs you encounter with Flowcode should be discussed here.
Post Reply
RGV250
Posts: 333
http://meble-kuchenne.info.pl
Joined: Sat Mar 19, 2022 4:53 pm
Has thanked: 32 times
Been thanked: 33 times

Pi HDMI component colours are not right

Post 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
Pi Text test.jpg (91.79 KiB) Viewed 115 times
HDMI_Text_Test.fcfx
(12.95 KiB) Downloaded 4 times
Regards,
Bob

chipfryer27
Valued Contributor
Posts: 1676
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 372 times
Been thanked: 581 times

Re: Pi HDMI component colours are not right

Post 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

LeighM
Valued Contributor
Posts: 486
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 83 times
Been thanked: 260 times

Re: Pi HDMI component colours are not right

Post 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 :D

RGV250
Posts: 333
Joined: Sat Mar 19, 2022 4:53 pm
Has thanked: 32 times
Been thanked: 33 times

Re: Pi HDMI component colours are not right

Post 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

RGV250
Posts: 333
Joined: Sat Mar 19, 2022 4:53 pm
Has thanked: 32 times
Been thanked: 33 times

Re: Pi HDMI component colours are not right

Post by RGV250 »

Tried with 32 bit OS but still the same.

Bob

LeighM
Valued Contributor
Posts: 486
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 83 times
Been thanked: 260 times

Re: Pi HDMI component colours are not right

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

LeighM
Valued Contributor
Posts: 486
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 83 times
Been thanked: 260 times

Re: Pi HDMI component colours are not right

Post 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 :o
Change them to 16, 5, 6, 5 and all will be well :D

RGV250
Posts: 333
Joined: Sat Mar 19, 2022 4:53 pm
Has thanked: 32 times
Been thanked: 33 times

Re: Pi HDMI component colours are not right

Post 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

LeighM
Valued Contributor
Posts: 486
Joined: Mon Dec 07, 2020 1:00 pm
Has thanked: 83 times
Been thanked: 260 times

Re: Pi HDMI component colours are not right

Post 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

RGV250
Posts: 333
Joined: Sat Mar 19, 2022 4:53 pm
Has thanked: 32 times
Been thanked: 33 times

Re: Pi HDMI component colours are not right

Post 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

Post Reply