|
-
Dec 21st, 2007, 05:50 AM
#1
Thread Starter
New Member
Rotate Image (without control)
I'm in a bit of a tight spot. I have to write a function (module) that takes two filenames and rotates one to the right 90 degrees. The problem is, I can't use a Picture Box to convert the image bits to a DIB, it all has to be done in the API.
I have all day to do it, but I'm a bit lost. I have code to rotate the image, but then it's in a pointer to a DC with no header information (to my knowledge.) Does anybody have experience with this?
-
Dec 21st, 2007, 06:40 AM
#2
Re: Rotate Image (without control)
i believe the stretchblt api has a rotate function. Not 100% on that though.
-
Dec 21st, 2007, 06:51 AM
#3
Thread Starter
New Member
Re: Rotate Image (without control)
 Originally Posted by Lord Orwell
i believe the stretchblt api has a rotate function. Not 100% on that though.
Only problem is I have to translate between a device-dependent bitmap and device-independent bitmap.
-
Dec 21st, 2007, 07:33 AM
#4
Re: Rotate Image (without control)
 Originally Posted by Ryuichi
Only problem is I have to translate between a device-dependent bitmap and device-independent bitmap.
That should not be a problem. You could do it with two memory DC's, one with the DDB selected and one with the DIB selected. You can copy between the two with BitBlt. I guess you could even do what you want to do with just one memory DC with the DDB selected, you could capture the DDB in DIB form using GetDibBits, rotate the bits, and put them back with SetDibBitstoDevice.
Edit: I don't think StretchBlt can rotate, but it can mirror a bitmap along the x and y axis
Last edited by Milk; Dec 21st, 2007 at 07:48 AM.
-
Dec 21st, 2007, 08:20 AM
#5
Thread Starter
New Member
Re: Rotate Image (without control)
 Originally Posted by Milk
That should not be a problem. You could do it with two memory DC's, one with the DDB selected and one with the DIB selected. You can copy between the two with BitBlt. I guess you could even do what you want to do with just one memory DC with the DDB selected, you could capture the DDB in DIB form using GetDibBits, rotate the bits, and put them back with SetDibBitstoDevice.
Edit: I don't think StretchBlt can rotate, but it can mirror a bitmap along the x and y axis
That is a good start, thank you. Now how do I save the DIB to a file?
-
Dec 21st, 2007, 12:17 PM
#6
Re: Rotate Image (without control)
It's not something I've ever had to do but I think a Bitmap file is pretty much the same as a DIB with a slightly different header. I know that there is some code for this amongst the DIBSection classes at vbaccelerator
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|