Rotating a picture.....

Hi all,
        I am developing a system for embedded systems(pocket PC and Windows CE)...... I have written a function ImageLoad that loads the Image(Map in BMP) from File into memory (using SHLoadDIBitmap) The max size for the Map is 4000x4000 pixels....This function returns the hDC of the image.......Then I draw the image (only 640x480 i.e. the current position) pixels from the Memory hDC to destination hDC using Bitblt......

My problem is that I want to rotate the 640 x 480 pixels at any angle before bliting them into the destination DC........
i.e I want to have something like this

Rotate(srchDC as long, angle as long) as RothDC..... i.e a function that rotates the image(only 640x480) in memory and returns the device context of the rotated image.....This is one possibility.....Any other will be greatly appreciated...........like using an array to rotate the 640x480 image and then displaying the reult into a picture box......

I hope I have made my question clear.....If something is not clear do post and do help me.........

Note::: I am developing in EVB but any code in VB might also be helpful to me(If it is not using any API not supported by EVB)

Imran
LVL 13
imarshadAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DhaestCommented:
HOWTO: Rotate a Bitmap Image in 90-Degree Increments
http://support.microsoft.com/default.aspx?scid=KB;en-us;q186260
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
imarshadAuthor Commented:
Not 90 degree but any angle.....
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Erick37Commented:
Is speed an issue?
0
imarshadAuthor Commented:
>>Is speed an issue?
No not that much.......
If I can rotate these pixels in about 1.5 to 2 sec. I will be happy.......

Imran
0
imarshadAuthor Commented:
Dhaest,
         Your first comment (Microsoft code) is almost exactly what I want.......Only that I want to improve it to support any angle.......

The other links mostly use SetPixel and GetPixel which is unfortunatily not supported by EVB.......

Imran
0
ampapaCommented:
Here is another link that might help: http://www.devx.com/vb2themax/Tip/19359
0
imarshadAuthor Commented:
No more help?
0
Erick37Commented:
The sample pointed to by ampapa dod not work in eVB?
0
imarshadAuthor Commented:
It might work...... But I am looking for something like what DHAEST has suggested.....I mean the first link(from Microsoft)
that will take my hdc as input and will return the DC of rotated picture..... Only that it is only rotating in increments of 90 degrees.....

Imran
0
Erick37Commented:
Looking briefly at the MS sample, it seems that they are using BitBlt to perform the pixel operations instead of GetPixel/SetPixel.  So then it will be quite easy to use any of the above samples which rotate an image by any angle and just replace the bit of code using GetyPixel/SetPixel with a call to BitBlt.  

The article says: "With a little work, the code can be modified to rotate to any angle, but that is beyond the scope of this article."  I will take a closer look tonight if I get the chance.

The question is does that sample run on CE?
0
imarshadAuthor Commented:
>>just replace the bit of code using GetyPixel/SetPixel with a call to BitBlt.
Yes and I never thought about this earlier..... But I think speed can be an issue now......as calling Bitblt for 640x480 times might be very very slow........ (As far as I have understood from this is that I will need to individually Bitblt each pixel to a new position(on basis of rotation) in the memory and then bitblt the resultant image into the displaying area).......

Imran
0
imarshadAuthor Commented:
>>The question is does that sample run on CE?

Yes it does run......

Imran
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.