×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Direct Draw Scaling Surfaces In 16-bit+ Color Modes

Direct Draw Scaling Surfaces In 16-bit+ Color Modes

Direct Draw Scaling Surfaces In 16-bit+ Color Modes

(OP)
Hey, this problem has been bugging me for a while now. I want to be able to dynamically change the size of the sprites in a DirectDraw game I'm making, without having fifty textures for each sprite. I found that you can blit in a box larger or smaller than the original sprite and DirectX will resize it for you.  My problem is that the transparency color i'm using ( hot pink, RGB(255, 0, 255 ) ) seems to mesh with this and when I change the size of my sprites they all have a pink outline around them! It seems that directdraw is using the transparent color for the stretch operation and averaging a bit, i.e RGB(252, 0, 253) and changing it to that..which isn't set as transparent. This doesn't seem to happen when I'm in 8 bit palettized mode but thats not the mode I want! I tried other transparent colors and the same happens, it puts an outline around the sprite with that color. Is there a way to tell directX that I don't want it to use the transparent color when it averages out the pixels or whatever it does without specifying multiple color keys? Or am I going to have to change the name of my game to "pretty pink ponies"? Thanks, I know this was a long post.

RE: Direct Draw Scaling Surfaces In 16-bit+ Color Modes

Hi!

The color key is just an information that tells DX if it recognize CK during Blit do not copy that pixel. But CK colored space is part of your image plane, and if you resize it DX will smooth that color with other pixels.

There are two way to solve this.

1. Ugly but fast:

Do not use any filtering method during resize (e.g. LINEAR).

2. Slower but best quality (DX8+ or DX7+? dont remember):

Use ARGB pixel format instead of color key. Save your images to file format that support alpha channel (I prefer PNG. www.pnglib.org), load it to ARGB surface (with D3DX Library or pnglib), and let DX do the resizing work with any filtering method.

Good luck,

Unborn

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close