Sub RotateView(v As View, bmp As Bitmap, degrees As Float)
Dim c As Canvas
Dim r As Rect
c.Initialize(v)
r.Initialize(0,0,v.Width,v.Height)
c.DrawRect(r,Colors.transparent,True,0)
c.DrawBitmapRotated(bmp,Null,r,degrees)
v.Invalidate
End Sub
I end up with a 45 degrees rotated image where the corners are cut off since they end up outside the imageview's boundaries ?
(the image size grows due to the rotation)
I guess it needs to be rotated, scaled, recentered and then drawn to the canvas ?
Sub ShowImage(bmp As Bitmap)
If bmp.width>bmp.height Then 'Image is landscape, rotate
Dim rbmp As RSImageProcessing
mBmp=rbmp.rotateBitmap(bmp, -90)
end if
.....rest of code
my view was square and the loaded image rectangular.
having the source image smaller than the destination view helps
I just added 1 line to the sub code to clean the mess when doing several rotations in a row. (it left trails as it didn't erase the destination bitmap/canvas)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.