Hi folks,
I make my pictures with photoshop, with this i can specify the color as hex or a RGB value. however i have to specify the color in just an integer.
now i know that 0 = pure black and 16.700000 (rounded) is white but i can't seem to find a way to get right colors.
like say i have this heximal value if i convert it with the windows calculator to an integer the color is not the color i want.
Is there a way to convert a heximal value to an integer so it will be the same color?
Color problem
Color problem
My PSP games:
Boxy II: http://www.ghoti.nl/boxyii.php
Elementals: http://www.ghoti.nl/Elementals.php
Boxy II: http://www.ghoti.nl/boxyii.php
Elementals: http://www.ghoti.nl/Elementals.php
It depends on the colorformat of the displaying application. For psp it would be BGR, meaning color = B << 16 | G << 8 | R, where R, G and B are each byte values in range 0-255, | means a logical OR and << N is a logical shift left by N bits. In readable mathematics it is the same as B * 65536 + G * 256 + R (note this is only correct in this special case, as OR is not the same as +). If you want to to create a corresponding hex value its just the same as writing each single component as hex value, which is then made of two values (0 = 00h, 255 = ffh) and append the hex values in the correct order, where B is leftmost and R would be rightmost.
Example: R 255 = HEX FF, G 127 = HEX 7F, B 128 = HEX 80, thus making a color of HEX 80 7F FF in BGR format. Reverting this process and then using above formula gives you a HEX->INT conversion.
However Photoshop uses RGB format, so if you want to specify a color there, you have R and B switched. This means if you want to display a picture made in photoshop (and saved in RGB mode, which is used in most image file formats) on your psp, you have to read in the colors and switch these two bytes to get the correct result.
Example: R 255 = HEX FF, G 127 = HEX 7F, B 128 = HEX 80, thus making a color of HEX 80 7F FF in BGR format. Reverting this process and then using above formula gives you a HEX->INT conversion.
However Photoshop uses RGB format, so if you want to specify a color there, you have R and B switched. This means if you want to display a picture made in photoshop (and saved in RGB mode, which is used in most image file formats) on your psp, you have to read in the colors and switch these two bytes to get the correct result.
Thanks that worked now the colors come out the way i want thanks
My PSP games:
Boxy II: http://www.ghoti.nl/boxyii.php
Elementals: http://www.ghoti.nl/Elementals.php
Boxy II: http://www.ghoti.nl/boxyii.php
Elementals: http://www.ghoti.nl/Elementals.php