![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I cut some code but this is basically how I rotate a bitmap. Can't be the best way because it takes too long! Any help would be appreciated. |
#3
| |||
| |||
|
|
I cut some code but this is basically how I rotate a bitmap. Can't be the best way because it takes too long! Any help would be appreciated. 'Rotate180 Dim TmpBitmap As New Drawing.Bitmap(OldWidth, OldHeight) For X As Integer = 0 To OldWidth - 1 For Y As Integer = 0 To OldHeight - 1 TmpBitmap.SetPixel(OldWidth - X - 1, OldHeight - Y - 1, CType(PictureBoxPic.Image, Drawing.Bitmap).GetPixel(X, Y)) Next Y Next X PictureBoxPic.Image.Dispose() PictureBoxPic.Image = TmpBitmap End Sub |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
I signed on early today hoping to beat any replies. I did find that Image can rotate and flip itself late yesterday and tried it. But I have another application in which the amount of rotation is arbitrary. So I looked up LockBits after I read your replies and am not sure from the example how to apply it in this situation. I'll read somemore later but if you happen to know of an example similar to my app it would help. Anyway, I wanted to reply now so I can say thanks for the replies. |
#6
| |||
| |||
|
|
" active" <activeNOSPAM (AT) a-znet (DOT) com> wrote in message news:eCeP5egmHHA.4848 (AT) TK2MSFTNGP05 (DOT) phx.gbl... I signed on early today hoping to beat any replies. I did find that Image can rotate and flip itself late yesterday and tried it. But I have another application in which the amount of rotation is arbitrary. So I looked up LockBits after I read your replies and am not sure from the example how to apply it in this situation. I'll read somemore later but if you happen to know of an example similar to my app it would help. Anyway, I wanted to reply now so I can say thanks for the replies. Look into no 2 in my post. You need to create a graphics object and paint the bitmap onto itself. You can use graphics.RotateTransform to rotate the way in which it paints the bitmap onto itself. Now I'm not sure if you can paint a bitmap onto itself, if you can't then you should create a copy. Michael |
#7
| |||
| |||
|
|
" active" <activeNOSPAM (AT) a-znet (DOT) com> wrote in message news:eCeP5egmHHA.4848 (AT) TK2MSFTNGP05 (DOT) phx.gbl... I signed on early today hoping to beat any replies. I did find that Image can rotate and flip itself late yesterday and tried it. But I have another application in which the amount of rotation is arbitrary. So I looked up LockBits after I read your replies and am not sure from the example how to apply it in this situation. I'll read somemore later but if you happen to know of an example similar to my app it would help. Anyway, I wanted to reply now so I can say thanks for the replies. Look into no 2 in my post. You need to create a graphics object and paint the bitmap onto itself. You can use graphics.RotateTransform to rotate the way in which it paints the bitmap onto itself. Now I'm not sure if you can paint a bitmap onto itself, if you can't then you should create a copy. Michael |
#8
| |||
| |||
|
|
I have to admit I passed over item 2 because I couldn't understand how coping would do it, but I see now. Thanks "Michael C" <nospam (AT) nospam (DOT) com> wrote in message news:%23k0vtChmHHA.4316 (AT) TK2MSFTNGP06 (DOT) phx.gbl... " active" <activeNOSPAM (AT) a-znet (DOT) com> wrote in message news:eCeP5egmHHA.4848 (AT) TK2MSFTNGP05 (DOT) phx.gbl... I signed on early today hoping to beat any replies. I did find that Image can rotate and flip itself late yesterday and tried it. But I have another application in which the amount of rotation is arbitrary. So I looked up LockBits after I read your replies and am not sure from the example how to apply it in this situation. I'll read somemore later but if you happen to know of an example similar to my app it would help. Anyway, I wanted to reply now so I can say thanks for the replies. Look into no 2 in my post. You need to create a graphics object and paint the bitmap onto itself. You can use graphics.RotateTransform to rotate the way in which it paints the bitmap onto itself. Now I'm not sure if you can paint a bitmap onto itself, if you can't then you should create a copy. Michael |
#9
| |||
| |||
|
|
You cannot copy a bitmap onto itself. -- -- Bob Powell [MVP] Visual C#, System.Drawing Ramuseco Limited .NET consulting http://www.ramuseco.com Find great Windows Forms articles in Windows Forms Tips and Tricks http://www.bobpowell.net/tipstricks.htm Answer those GDI+ questions with the GDI+ FAQ http://www.bobpowell.net/faqmain.htm All new articles provide code in C# and VB.NET. Subscribe to the RSS feeds provided and never miss a new article. "Michael C" <nospam (AT) nospam (DOT) com> wrote in message news:%23k0vtChmHHA.4316 (AT) TK2MSFTNGP06 (DOT) phx.gbl... " active" <activeNOSPAM (AT) a-znet (DOT) com> wrote in message news:eCeP5egmHHA.4848 (AT) TK2MSFTNGP05 (DOT) phx.gbl... I signed on early today hoping to beat any replies. I did find that Image can rotate and flip itself late yesterday and tried it. But I have another application in which the amount of rotation is arbitrary. So I looked up LockBits after I read your replies and am not sure from the example how to apply it in this situation. I'll read somemore later but if you happen to know of an example similar to my app it would help. Anyway, I wanted to reply now so I can say thanks for the replies. Look into no 2 in my post. You need to create a graphics object and paint the bitmap onto itself. You can use graphics.RotateTransform to rotate the way in which it paints the bitmap onto itself. Now I'm not sure if you can paint a bitmap onto itself, if you can't then you should create a copy. Michael |
#10
| |||
| |||
|
|
Try something like this.. Bitmap bm=(Bitmap)Image.FromFile("the image"); Bitmap copy=new Bitmap(bm.Width, bm.Height); Graphics g=Graphics.FromImage(copy); Matrix mx=new Matrix(); Matrix.RotateAt(bm.Width/2,bm.Height/2); g.DrawImage(bm); copy.Save("file.xxx",ImageFormat.jpg); -- -- Bob Powell [MVP] Visual C#, System.Drawing Ramuseco Limited .NET consulting http://www.ramuseco.com Find great Windows Forms articles in Windows Forms Tips and Tricks http://www.bobpowell.net/tipstricks.htm Answer those GDI+ questions with the GDI+ FAQ http://www.bobpowell.net/faqmain.htm All new articles provide code in C# and VB.NET. Subscribe to the RSS feeds provided and never miss a new article. " active" <activeNOSPAM (AT) a-znet (DOT) com> wrote in message news:eke98OhmHHA.4772 (AT) TK2MSFTNGP05 (DOT) phx.gbl... I have to admit I passed over item 2 because I couldn't understand how coping would do it, but I see now. Thanks "Michael C" <nospam (AT) nospam (DOT) com> wrote in message news:%23k0vtChmHHA.4316 (AT) TK2MSFTNGP06 (DOT) phx.gbl... " active" <activeNOSPAM (AT) a-znet (DOT) com> wrote in message news:eCeP5egmHHA.4848 (AT) TK2MSFTNGP05 (DOT) phx.gbl... I signed on early today hoping to beat any replies. I did find that Image can rotate and flip itself late yesterday and tried it. But I have another application in which the amount of rotation is arbitrary. So I looked up LockBits after I read your replies and am not sure from the example how to apply it in this situation. I'll read somemore later but if you happen to know of an example similar to my app it would help. Anyway, I wanted to reply now so I can say thanks for the replies. Look into no 2 in my post. You need to create a graphics object and paint the bitmap onto itself. You can use graphics.RotateTransform to rotate the way in which it paints the bitmap onto itself. Now I'm not sure if you can paint a bitmap onto itself, if you can't then you should create a copy. Michael |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |