Hello,
I tried out everything I found in the forum but no code example works for me.
I flipped the bitmap of an non square and partly transparent imageview and it works fine. I've tried to translate this to
a rotating sub to do in the same manor, but find no working solution. I tried also out a DestRec with dip values thatare
explicit larger than a 45° rotated bitmap of my imageview, but at the end even when I change width and height for the
imageview the dimension stay as initial values. For rotating square bitmaps the code works fine. I know that I have to
recalculate left and top for non square bitmaps but that should be a peace of cake, even for me
Any hints please? Thanks in advance!
I tried out everything I found in the forum but no code example works for me.
I flipped the bitmap of an non square and partly transparent imageview and it works fine. I've tried to translate this to
a rotating sub to do in the same manor, but find no working solution. I tried also out a DestRec with dip values thatare
explicit larger than a 45° rotated bitmap of my imageview, but at the end even when I change width and height for the
imageview the dimension stay as initial values. For rotating square bitmaps the code works fine. I know that I have to
recalculate left and top for non square bitmaps but that should be a peace of cake, even for me
Any hints please? Thanks in advance!
rotating a bitmap:
Sub Gesture_onPointerDown(ptrIndex As Int, PID As Int, MotionEvent As Object)
' flipp image works fine
Dim i As ImageView
i=Sender
Dim j As Int=i.tag
Dim vert As Boolean, hor As Boolean
Dim bmp As Bitmap=i.bitmap
Dim bmpflip As Bitmap
bmpflip.InitializeMutable(bmp.width, bmp.height)
Dim cv As Canvas
cv.Initialize2(bmpflip)
cv.DrawColor(Colors.ARGB(0, 0, 0, 0)) ' 0 means fully transparent
If bmp.Width>bmp.Height Then
vert=True
hor=False
Else
vert=False
hor=True
End If
Dim DestRect As Rect
DestRect.Initialize(0dip, 0dip, bmp.Width, bmp.height)
cv.DrawBitmapFlipped(bmp, Null, DestRect, vert, hor)
i.Bitmap=bmpflip
i.Invalidate
End Sub
Sub Gesture_onDoubleTap(X As Float, Y As Float, MotionEvent As Object)
' rotating the bitmap works not
Dim i As ImageView
i=Sender
Dim j As Int=i.tag
Dim bmp As Bitmap=i.bitmap
Dim bmprot As Bitmap
bmprot.InitializeMutable(bmp.width, bmp.height)
Dim cv As Canvas
cv.Initialize2(bmprot)
cv.DrawColor(Colors.ARGB(0, 0, 0, 0)) ' 0 means fully transparent
Dim DestRect As Rect
DestRect.Initialize(0dip, 0dip, bmp.Width, bmp.height) ' also tried changing width and height, 210dip x 210dip or added a multiplyer to width and height
cv.DrawBitmaprotated(bmp, Null, DestRect, 90)
i.Bitmap=bmprot ' also tried setLayoutAnimated(0, i.left, i.top, new width, new height)
i.Invalidate
end sub