'SRC and DEST are an array of X-then-Y coordinates in the same direction (ie: clockwise)
Sub DrawBMPpoly(BG As Canvas, BMP As Bitmap, SRC() As Float, DEST() As Float, Alpha As Int, NeedsClipPath As Boolean)
Dim temp As Int, P As Path
If SRC.Length = DEST.Length Then
ExDraw.save2(BG, ExDraw.MATRIX_SAVE_FLAG)
mPaint.Initialize
mPaint.SetAlpha(Alpha)
mMatrix.setPolyToPoly(SRC, 0, DEST, 0, DEST.Length *0.5)
If NeedsClipPath Then
P.Initialize(DEST(0),DEST(1))
For temp = 2 To DEST.Length -1 Step 2
P.LineTo(DEST(temp),DEST(temp+1))
Next
BG.ClipPath(P)
End If
ExDraw.drawBitmap4(BG, BMP, mMatrix, mPaint)
ExDraw.restore(BG) 'before Activity.Invalidate
If NeedsClipPath Then BG.RemoveClip
End If
End Sub