|
-
Jan 21st, 2005, 04:51 PM
#1
Thread Starter
Banned
Hex color
i noticed D3DX8 uses hex colors in this format: &HXXRRGGBB
how do i make a function that can create that format with XX in % and RR GG BB in 255
Last edited by nareth; Jan 22nd, 2005 at 06:13 AM.
-
Jan 21st, 2005, 05:17 PM
#2
Re: Hex color
 Originally Posted by nareth
i noticed D3DX8 uses hex colors in this format: &HXXRRGGBB
how do i make a function that can create that format with XX in % and RR GG BB in 255
Well, for starters, you could tell us what the input to the functino might be...
Nobody knows what software they want until after you've delivered what they originally asked for.
Don't solve problems which don't exist.
"If I had eight hours to cut down a tree, I'd spend six hours sharpening my axe." --- Abraham Lincoln (1809-1865)
2 idiots don't make a genius.
-
Jan 21st, 2005, 06:08 PM
#3
Re: Hex color
Where did you see that....you can usualy use the RGB() function to convert colors to a long in DX.
ØØ
-
Jan 22nd, 2005, 05:02 AM
#4
Thread Starter
Banned
Re: Hex color
 Originally Posted by NoteMe
Where did you see that....you can usualy use the RGB() function to convert colors to a long in DX.
ØØ
not in D3DX8 because it uses transperancie i tried using rgb but that failed drawing text so i need a function like
VB Code:
XRGB(ByVal X As Long, ByVal R As Long, ByVal G As Long, ByVal B As Long)
'X Should be a ratio of 1 and generate hex from 00 to FF
'R/G/B Should be 0-255 and generate hex from 00 to FF
-
Jan 22nd, 2005, 06:06 AM
#5
Re: Hex color
so you have a RGB value and you want to convert it to a hex number
XRGB(ByVal X As Long, ByVal R As Long, ByVal G As Long, ByVal B As Long)
VB Code:
myhex = "&H" & Hex(r) & Hex(g) & Hex(b)
just add x to that if want
rgds pete
-
Jan 22nd, 2005, 06:13 AM
#6
Thread Starter
Banned
Re: Hex color
thanks!
VB Code:
Public Function XRGB(X As Long, R As Long, G As Long, B As Long) As Long
Let XRGB = CLng("&H" & Hex(X) & Hex(R) & Hex(G) & Hex(B))
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|