Quantcast
Channel: WriteableBitmapEx
Viewing all articles
Browse latest Browse all 360

New Post: Simple image blitting/compositing with a background image and a foreground image.

$
0
0
Hi Guys,

I am trying to add source image to destination image using blit function.

I used above code but it is not working for me.

Can any one help me please.

Here is my code..


Dim objRoomItem As SurveyDataSource.RoomItem = DirectCast(itemListView.SelectedValue, SurveyDataSource.RoomItem)
        Dim strImageData As String = GetByteArray(objInkManager)
        'cvink.Children.Clear()


        Dim background = BitmapFactory.[New](imgItem.ActualWidth, imgItem.ActualHeight).FromByteArray(Convert.FromBase64String(objRoomItem.ImageFile))

        Dim forground As WriteableBitmap = BitmapFactory.[New](objInkManager.BoundingRect.Width, objInkManager.BoundingRect.Height).FromByteArray(Convert.FromBase64String(strImageData))

        forground.Blit(New Rect(0, 0, background.PixelWidth, background.PixelHeight), background, New Rect(0, 0, background.PixelWidth, background.PixelHeight), WriteableBitmapExtensions.BlendMode.Alpha)

        'background.Blit(New Rect(0, 0, background.PixelWidth, background.PixelHeight), forground, New Rect(0, 0, forground.PixelWidth, forground.PixelHeight), WriteableBitmapExtensions.BlendMode.Alpha)
        'background.Clear(Windows.UI.Colors.White)

        Dim tempData As Byte()
        ReDim tempData(forground.PixelBuffer.Length)

        tempData = background.PixelBuffer.ToArray()

        strImageData = Convert.ToBase64String(tempData)

Viewing all articles
Browse latest Browse all 360

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>