[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Rotating a picture.....

Posted on 2004-10-24
15
Medium Priority
?
313 Views
Last Modified: 2012-06-27
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
0
Comment
Question by:imarshad
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 3
  • 2
  • +1
15 Comments
 
LVL 53

Accepted Solution

by:
Dhaest earned 1200 total points
ID: 12397644
HOWTO: Rotate a Bitmap Image in 90-Degree Increments
http://support.microsoft.com/default.aspx?scid=KB;en-us;q186260
0
 
LVL 13

Author Comment

by:imarshad
ID: 12397697
Not 90 degree but any angle.....
0
 
LVL 8

Assisted Solution

by:ampapa
ampapa earned 400 total points
ID: 12398794
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 32

Expert Comment

by:Erick37
ID: 12421745
Is speed an issue?
0
 
LVL 13

Author Comment

by:imarshad
ID: 12430583
>>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
 
LVL 53

Assisted Solution

by:Dhaest
Dhaest earned 1200 total points
ID: 12430600
0
 
LVL 13

Author Comment

by:imarshad
ID: 12431835
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
 
LVL 8

Assisted Solution

by:ampapa
ampapa earned 400 total points
ID: 12432125
Here is another link that might help: http://www.devx.com/vb2themax/Tip/19359
0
 
LVL 13

Author Comment

by:imarshad
ID: 12622003
No more help?
0
 
LVL 32

Expert Comment

by:Erick37
ID: 12636108
The sample pointed to by ampapa dod not work in eVB?
0
 
LVL 13

Author Comment

by:imarshad
ID: 12645047
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
 
LVL 32

Assisted Solution

by:Erick37
Erick37 earned 400 total points
ID: 12647020
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
 
LVL 13

Author Comment

by:imarshad
ID: 12647148
>>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
 
LVL 13

Author Comment

by:imarshad
ID: 12647162
>>The question is does that sample run on CE?

Yes it does run......

Imran
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question