Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


color keys in dx7

This topic is 6276 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to use color keys for off-screen surfaces in DX7. Could someone give me help on how to use the IDIRECTDRAWSURFACE7::SetColorKey function, or how to set the high and low colorspace values in the DDSURFACEDESC before creating the surface? If you''ve made a game that does this and I can download the source code that would help also. -Amish

Share this post

Link to post
Share on other sites
I''ll get around to writing my own one day, but currently I''m just using the sample code that MS gives you for colour keying.

(From the DX7 SDK Docs)

Color keys are specified using the pixel format of a surface. If a surface is in a palettized format, the color key is given as an index or a range of indices. If the surface is in a non-palattized display mode, the color keys are specified in the raw pixel format. For instance, to set a bright purple color key in 16-bit 5:6:5 mode, you would use a value of 0xf81F (All 5 red bits are set, and all 5 blue bits are set).

Basically, the two values in the DDCOLORKEY structure are used to specify a "range" of transparent colours. The values you put in each member of the structure depends on the pixel format of the surfaces, if it''s 8bit, the values are palette indexes, if its 24bit rgb, then they''re the rgb pixel values of the colour(s) you want in the key.

Sorry there''s no code, but look in the SDK, should help you out.

- Jamie


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!