Amiga.org
Amiga computer related discussion => General chat about Amiga topics => Topic started by: Omega Space Protons on October 25, 2010, 07:24:39 PM
-
I would like to know how i can convert hex #C0C0C0 to the Amigas hex equivilent of #xxxxxxxx which is 8 digits per color instead of 2. For example red green blue is normally C0,C0,C0 or red = C0(192), green = C0(192), blue C0(192) or #COCOCO in full notation. However the amiga reques that functions such as ObtainBestPenA have the color in hex as #FFFFFFFF, #FFFFFFFF, FFFFFFFF or red = #FFFFFFFF(4294967295), green = #FFFFFFFF(4294967295), blue = #FFFFFFFF(4294967295) or:
ObtainBestPenA(GameWindow->WScreen->ViewPort.ColorMap, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, NULL);
except i want to convert different hex colors like:
#C0C0C0
#208040
#005b7f
Any help in this matter would be greatly appreciated.
Omega Space Protons
-
#208040 would be:
#20202020
#80808080
#40404040
etc, although its been a long time since i've played around with these things.
-
Thanks and if understand correctly,
#208040 would be:
#20202020
#80808080
#40404040
#C0C0C0 would be:
#C0C0C0C0
#C0C0C0C0
#C0C0C0C0
#005b7f would be:
#00000000
#5b5b5b5b
#7f7f7f7f
#FFFFFF would be:
#FFFFFFFF
#FFFFFFFF
#FFFFFFFF
Is this correct or am i missing something else?
Omega Space Protons
-
I would like to know how i can convert hex #C0C0C0 to the Amigas hex equivilent of #xxxxxxxx which is 8 digits per color instead of 2.
The correct way to convert is to use:
... (rgb & 0xff0000) << 8, (rgb & 0xff00) << 16, (rgb & 0xff) << 24 ...
-
That's correct. The Amiga allows 32 bits per gun precision for colour as far as pens go. However, you aren't actually going to see any difference caused by changing the lower 24-bits of each value since the best display adapters available can't show more than 8 bits per gun.
-
Doesn't make (much) sense...
I would just fill up the extra digits with 0, 0xc0c0c0c becomes: 0xc0000000 0xc00000000 xc00000000 xc0000000
But in the end everthing after the 1st 2 digits will be ignored anyways, as there is no HW (in Amiga context) that actually uses more than 8Bit per color.
32Bit per color only makes sense if you are doing lots of image-manipulation to miminize rounding errors (think PhotoShop).
edit:Too slow
-
32Bit per color only makes sense if you are doing lots of image-manipulation to miminize rounding errors (think PhotoShop).
According to my nvidia X server settings tool, my graphics card supports a plethora of HDR framebuffer modes with up to 32 bits per gun. None of them have an associated XVisualID value however, so I'm guessing that although they are valid render targets for GL, they can't be displayed directly by X.