color constants slightly off their readback value

Discussion in 'Bug Reports' started by colin9876, Dec 11, 2007.

  1. colin9876

    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: Dec 11, 2007
  2. Erel

    Erel Administrator Staff Member Licensed User

    The color constants were tested to match both the device and the desktop.
    It is possible that some devices change the color value a little bit different than other devices.
    I've just checked cPurple and it matches correctly.
     
  3. colin9876

    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: Dec 11, 2007
  4. agraham

    agraham Expert Licensed User

    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.
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    That is the recommended solution.
     
  6. colin9876

    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?
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    I've tested it with a Windows Mobile 2003 device (HP hx2410).
     
Loading...