I am trying to resize and rotate a bitmap with the function DrawBitmapRotated.
But I am wrong at somewhere. Does DrawBitmapRotated has ability to resize/resample while destination rectange is smaller than the source rectangle?
Please someone explain me how to use DrawBitmapRotated while source and destination rectangles are differently sized and not square.
Thank you.
But I am wrong at somewhere. Does DrawBitmapRotated has ability to resize/resample while destination rectange is smaller than the source rectangle?
B4X:
Sub btn_save_Click
Dim Out As OutputStream
Dim Smaller As Bitmap
bmp_note.Initialize3(cnvs_note.Bitmap)
Smaller = ResizeRotateBitmap(bmp_note, 440, 60)
fileName = DateTime.Now & ".PNG"
Out = File.OpenOutput(File.DirRootExternal & "/img",fileName, False)
Smaller.WriteToStream(out, 100, "PNG")
Out.Close
End Sub
Sub ResizeRotateBitmap(src_bmp As Bitmap, w As Int, h As Int) As Bitmap
Dim new As Bitmap
new.InitializeMutable(w, h)
Dim c As Canvas
c.Initialize2(new)
Dim dst_rect As Rect
dst_rect.Initialize(0, 0, w, h)
c.DrawBitmapRotated (src_bmp,Null, dst_rect,270)
Return new
End Sub
Please someone explain me how to use DrawBitmapRotated while source and destination rectangles are differently sized and not square.
Thank you.
Last edited: