Welcome, Guest. Please login or register.

Author Topic: Convert #COCOCO to #xxxxxxxx  (Read 2050 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Omega Space ProtonsTopic starter

  • Newbie
  • *
  • Join Date: Oct 2010
  • Posts: 41
    • Show only replies by Omega Space Protons
Convert #COCOCO to #xxxxxxxx
« 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:
Code: [Select]
ObtainBestPenA(GameWindow->WScreen->ViewPort.ColorMap, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, NULL);
except i want to convert different hex colors like:
Quote
#C0C0C0
#208040
#005b7f
Any help in this matter would be greatly appreciated.
 
Omega Space Protons
 

Offline xyzzy

  • Jr. Member
  • **
  • Join Date: May 2009
  • Posts: 74
    • Show only replies by xyzzy
Re: Convert #COCOCO to #xxxxxxxx
« Reply #1 on: October 25, 2010, 07:32:10 PM »
#208040 would be:

#20202020
#80808080
#40404040

etc, although its been a long time since i've played around with these things.
 

Offline Omega Space ProtonsTopic starter

  • Newbie
  • *
  • Join Date: Oct 2010
  • Posts: 41
    • Show only replies by Omega Space Protons
Re: Convert #COCOCO to #xxxxxxxx
« Reply #2 on: October 25, 2010, 07:40:42 PM »
Thanks and if understand correctly,
 
#208040 would be:
Quote
#20202020
#80808080
#40404040

#C0C0C0 would be:
Quote
#C0C0C0C0
#C0C0C0C0
#C0C0C0C0

#005b7f would be:
Quote
#00000000
#5b5b5b5b
#7f7f7f7f

#FFFFFF would be:
Quote
#FFFFFFFF
#FFFFFFFF
#FFFFFFFF

Is this correct or am i missing something else?
 
Omega Space Protons
 

Offline Piru

  • \' union select name,pwd--
  • Hero Member
  • *****
  • Join Date: Aug 2002
  • Posts: 6946
    • Show only replies by Piru
    • http://www.iki.fi/sintonen/
Re: Convert #COCOCO to #xxxxxxxx
« Reply #3 on: October 25, 2010, 07:53:18 PM »
Quote from: Omega Space Protons;586980
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:
Code: [Select]

... (rgb & 0xff0000) << 8, (rgb & 0xff00) << 16, (rgb & 0xff) << 24 ...
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16882
  • Country: gb
  • Thanked: 6 times
    • Show only replies by Karlos
Re: Convert #COCOCO to #xxxxxxxx
« Reply #4 on: October 25, 2010, 07:54:44 PM »
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.
int p; // A
 

Offline Kronos

  • Resident blue troll
  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 4017
    • Show only replies by Kronos
    • http://www.SteamDraw.de
Re: Convert #COCOCO to #xxxxxxxx
« Reply #5 on: October 25, 2010, 07:57:57 PM »
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
« Last Edit: October 25, 2010, 07:58:45 PM by Kronos »
1. Make an announcment.
2. Wait a while.
3. Check if it can actually be done.
4. Wait for someone else to do it.
5. Start working on it while giving out hillarious progress-reports.
6. Deny that you have ever announced it
7. Blame someone else
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16882
  • Country: gb
  • Thanked: 6 times
    • Show only replies by Karlos
Re: Convert #COCOCO to #xxxxxxxx
« Reply #6 on: October 25, 2010, 09:09:25 PM »
Quote from: Kronos;586990
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.
int p; // A