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

New Post: Win8.1 Blit Transparent Ink

$
0
0
I'm working on an app where the user is "marking up" an underlying image with the Ink API. One of the ink types is a Highlight tool. When I blit the ink strokes and background image together the transparency is lost leading to what was highlighted in the background image being completely blocked out. Here is what my code looks like any ideas how to preserve the transparency?
Thanks,
Chris
var backgroundBmp = await BitmapFactory.New(1, 1).FromStream(await file.OpenAsync(FileAccessMode.Read), Windows.Graphics.Imaging.BitmapPixelFormat.Unknown);
                
WriteableBitmap foregroundBmp;
using (InMemoryRandomAccessStream a = new InMemoryRandomAccessStream())
 {
   await inkManager.SaveAsync(a);
   a.Seek(0);
   foregroundBmp = await new WriteableBitmap(1, 1).FromStream(a, Windows.Graphics.Imaging.BitmapPixelFormat.Bgra8);
  }
backgroundBmp.Blit(new Rect(inkManager.BoundingRect.X, inkManager.BoundingRect.Y, foregroundBmp.PixelWidth, foregroundBmp.PixelHeight),
                    foregroundBmp, new Rect(0,0, foregroundBmp.PixelWidth, foregroundBmp.PixelHeight),
                    WriteableBitmapExtensions.BlendMode.Alpha);

Viewing all articles
Browse latest Browse all 360

Trending Articles



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