Jump to content
  • Advertisement
Sign in to follow this  
ELFanatic

drawing non square images

This topic is 4320 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 would like to Blit a non square image onto the screen, it's a rather large image so I was thinking that I should load it onto a Direct3Dsurface but I don't know how to paint the surface on to the monitor and still maintain alphablending. What I find interesting is LoadSurfaceFromFile has a colorkey. So there has to be away to paint it and make the image transparent. Help me!

Share this post


Link to post
Share on other sites
Advertisement
use ID3DXSprite and a texture with alpha data in it (32bit per pixel) like png or tga or dds or something

Share this post


Link to post
Share on other sites
Assume you're using D3D (not DDraw), you can load a texture with D3DXCreateTextureFromFileEx(), and specify a colour key there. A common colour is magenta. Then you would make e.g. a circle image, and fill the outside area with magenta, then specify that as your colour key. When you draw the image, the magenta parts won't be drawn.

Share this post


Link to post
Share on other sites
Thanks for all the help but I have to use textures with all those solutions huh? I meant that I wanted to use an image with non square dimensions. I'm defining my resolution at 800x600 and I want a bar at the bottom. Which means I either use several 128x128 textures (because it will be the width of the screen but doubtfully taller than 128) or I use one 1024x1024.

Share this post


Link to post
Share on other sites
I think square textures is a rather uncommon restriction these days. All that is required often times is that each side is a power of two, but they don't have to be the same power of two. So you can have a texture that is 1024x32 if you want.

Share this post


Link to post
Share on other sites
Quote:
Original post by Agony
I think square textures is a rather uncommon restriction these days. All that is required often times is that each side is a power of two, but they don't have to be the same power of two. So you can have a texture that is 1024x32 if you want.


Really? sweet jiggity! Okay good, so I'm a little behind on the times but that's still great to hear.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!