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

New Post: issues using blit for simple 'color me' (coloring picture) app: inkmanager's size limited to strokes

$
0
0
My current code is this:
//Image background
            var backgroundBmp = await BitmapFactory.New(1, 1).FromContent(new Uri(BackgroundImage));
            //Image foreground
            WriteableBitmap foregroundBmp;
            using (InMemoryRandomAccessStream a = new InMemoryRandomAccessStream())
            {
                await _inkManager.SaveAsync(a);
                a.Seek(0);
                foregroundBmp = await new WriteableBitmap(1, 1).FromStream(a,BitmapPixelFormat.Bgra8);
            }
            // Combined
            backgroundBmp.Blit(new Rect(0, 0, foregroundBmp.PixelWidth,foregroundBmp.PixelHeight), foregroundBmp, new Rect(0, 0,backgroundBmp.PixelWidth,backgroundBmp.PixelHeight), WriteableBitmapExtensions.BlendMode.Alpha);

            // Save
            FileSave = await ApplicationData.Current.TemporaryFolder.CreateFileAsync(TempFileNameForDrawing, CreationCollisionOption.ReplaceExisting);
            Guid encoderId = Windows.Graphics.Imaging.BitmapEncoder.PngEncoderId;
            await WinRTXamlToolkit.Imaging.WriteableBitmapSaveExtensions.SaveToFile(backgroundBmp, FileSave, encoderId);
In the backgroundBmp.Blit line I use the rectangle from the foregroundBmp and the backgroundBmp. They are however different in size, which you would expect since the inkManager on which the foregroundBmp is based only returns the actual strokes and the rectangle bounding those. How would I go about getting the inkmanager to return the full canvas?

Viewing all articles
Browse latest Browse all 360

Trending Articles



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