Jump to content
  • Advertisement
Sign in to follow this  
Halley62373

how to rotate a bitmap with DDraw?

This topic is 3333 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

Advertisement
You can't* - you need to use Direct3D or write a rotozoomer to do it in software (which is slow and non-trivial), DirectDraw does not support rotation*


* Well, theoretically it's up to the driver, but I don't know of any card available that supports zooming.

EDIT: Ok, I gather it supports scaling to some extent, but still not rotation.

[Edited by - Evil Steve on October 23, 2009 8:57:07 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by Halley62373
Thank you for your answer.My classmate can rotate the bitmap with DDraw.But he can't move the bitmap well rotating it.

can you help me?
How is he doing that? He must be using an external library; DirectDraw doesn't do rotation.

Share this post


Link to post
Share on other sites
I am not sure the code .
maybe like this

BitBlt(hdc,expression,expression,350,250,mdc,x,y,srccopy);

expresson: I forgot the code.

the bitmap can retate with only one function.

Share this post


Link to post
Share on other sites
BitBlt doesn't perform rotation - it's just a bit blit from one surface to another.

Also, BitBlt() is a GDI function, not DirectDraw. The DirectDraw function is IDirectDrawSurface7::Blt().

Are you actually using DirectDraw, or GDI?

Share this post


Link to post
Share on other sites
Sorry ,I make a mistake. I use GDI.

I want to make a bitmap moving well rotating ,how can I reach this?

I am beginner ,so sometimes I will mix some concepts,sorry.

Share this post


Link to post
Share on other sites
Sorry ,I make a mistake. I use GDI.

I want to make a bitmap moving well rotating ,how can I reach this?

I am beginner ,so sometimes I will mix some concepts,sorry.

Share this post


Link to post
Share on other sites
Ah, that makes more sense [smile]

Google has a few results, This one looks promising at first glance.

GDI doesn't support rotation either (Again, it's up to the driver, but almost none support it). You can use GDIPlus, but it's slower, or you'll have to use some other method.

If you can find out, I'd be interested in knowing how your classmate does it.

Share this post


Link to post
Share on other sites
You can use the PlgBlt function.

Something like this:


// Calculate upper left, upper right, and lower left points of rotated rectangle
LONG ax = static_cast<LONG>(srcWidth / 2 * std::cos(a)),
ay = static_cast<LONG>(srcHeight / 2 * std::sin(a));
POINT pts[] = {{x - ax + ay, y - ay - ax}, {x + ax + ay, y + ay - ax}, {x - ax - ay, y - ay + ax}};
// Do it
PlgBlt(hDC, pts, srcDC, 0, 0, srcWidth, srcHeight, NULL, 0, 0);





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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!