Private Async Function UpdateImageSource() As Task
Dim sb As SoftwareBitmap = btmp.ToSoftwareBitmap()
sbs = New SoftwareBitmapSource()
Await sbs.SetBitmapAsync(sb)
img.Source = sbs
img.Width = btmp.PixelWidth
img.Height = btmp.PixelHeight
End Function
Private Async Function ApplyTransform(t As BaseTransform) As Task
Dim bm = btmp.Transform(t)
btmp.Dispose()
btmp = bm
Await UpdateImageSource()
End Function
Private Async Sub btnScale_Click(sender As Object, e As RoutedEventArgs)
Dim px As Integer = btmp.PixelWidth * 1.6F + 0.5F
Dim py As Integer = btmp.PixelHeight * 1.6F + 0.5F
Await ApplyTransform(New Scaler(px, py, InterpolationMode.HighQualityCubic))
End Sub
Private Async Sub btnScaleOut_Click(sender As Object, e As RoutedEventArgs)
Dim px As Integer = btmp.PixelWidth * 0.625F + 0.5F
Dim py As Integer = btmp.PixelHeight * 0.625F + 0.5F
If px > 0 AndAlso py > 0 Then
Await ApplyTransform(New Scaler(px, py, InterpolationMode.HighQualityCubic))
End If
End Sub