Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have a problem with colour keys

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I'm having a problem with the colour keys for icons and stuff. The book I am reading says there are two ways of setting the colour keys of a surface.
Either by setting the dwColourKeyrange (or whatever) members on the DDSURFACEDESC before you initialise the surface or by calling a function which sets the colour keys. Either way I am having the same problem, which is assigning the colour values. My book does it like this

dwColourKeyHighblah = RGBQUAD(x,y,z);
dwColourKeyLowsomething = RGBQUAD(a,b,c);

and yes, I cant remember offhand what these variables are called. whenever I do this the compiler gets stuborn with "RGBQUAD does not take 3 arguments". I've tried other amounts of arguments, instantiating an RGBQUAD object and assigning to it, in fact everything I can think of. the RGBQUAD turns out to be a DWORD, but other than this i'm stumped.

Does anybody know how to assign the desired colour values to colourkey range variables? I would be very gratefull for help.
dedbeet.

ps
I'm using directX7 (as in LPDIRECTDRAW4) because I have a book on it, i'm planning to learn the latest directX later.

 
Hi dedbeet,
i haven't done anything with this, but it seems that RGBQUAD is a simple wrapper for a RGBA color. So my first guess is, that you supply 4 values to the call, the fourth being the alpha value of the color (usually 255).
Or you could assign the color directly by calculating it via
Code:
color=red|green<<8|blue<<16|alpha<<24[\code].
If you want to set a constant color you would do fine defining it in hex, e.g.
[code]0xaabbggrr[\code]
where aa bb gg rr represent the hex notation of alpha, blue, green, red component respectively.

Christoph
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top