color constants slightly off their readback value

colin9876

Active Member
Licensed User
Erel can u post the list of what the color constants are actually set to?
Are they stored in a file or in the core of the Basic4ppc app?

Theres a slight problem that Ive come accross with some colors.
Due to 'rounding' on the screen. It would be better if colour constants were set to exactly what they will be read back as e.g.

plot (1,1,cPurple)
if getpixel(1,1)=cpurple then msgbox("True") else Msgbox("False")

...Will return False.!

Reason is screen R,G,B,s are stored to the nearest 8 for each R,G,B component
If the constants were set to the exact screen value the colors will still be the same but you could also use the color constants for checking pixels!
 
Last edited:

colin9876

Active Member
Licensed User
example

cPurple is defined as = -8388480
RGB(128,0,128)

plot it and read it back gives -8126332
RGB(132,0,132)

What I was saying is better if cPurple defined as (132,0,132)
Looks exactly the same but reads back the same as it writes!
 
Last edited:

agraham

Expert
Licensed User
What I was saying is better if cPurple defined as (132,0,132) Looks exactly the same but reads back the same as it writes!
I think Erel knows what you are saying Colin but this is a well known artifact of mapping a large colour space onto a smaller one. Devices differ in the exact colour values used and so what is right for one device is not for another - as this purple example shows. It is correct for Erel's device but not yours. The way round it is to set then get a test pixel and use the value returned as the colout value.
 

colin9876

Active Member
Licensed User
Yes nice idea about write it & read it back to set it.

Just out of interest Erel what device did u try that cPurple did read and write at (128,0,128)?

All my pda phones read it back at (132,...) which is making me think that it is WM that does the rounding? - in which case all devices ought to be the same?
 
Top