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

New Post: Blit not producing anticipated results

$
0
0
I managed to make this work by adding dummy "pushpins" to 2 diagonal corners of the InkManager to fake the manager into thinking it was the same size as my background. Now the user can mark up an image at will and the foreground (e.g. inkManager) will always be the same size as the background. When blitting the images, the foreground is then not stretched to the size of the background, preserving the scale and precision of the mark up.

Before blitting the images, I call this method:
private void addDummyCornerPins(WriteableBitmap backgroundBmp)
        {
            var windowHeightHalf = Window.Current.Bounds.Height / 2;
            var windowWidthHalf = Window.Current.Bounds.Width / 2;
            var imgHeightHalf = backgroundBmp.PixelHeight / 2;
            var imgWidthHalf = backgroundBmp.PixelWidth / 2;

            var ptListTopLeft = new List<Point>()
            { 
                new Point(windowWidthHalf - imgWidthHalf, windowHeightHalf + imgHeightHalf)
            };

            var ptBottomRight = windowWidthHalf + imgWidthHalf + windowHeightHalf - imgHeightHalf;
            var ptListBottomRight = new List<Point>()
            { 
                new Point(windowWidthHalf + imgWidthHalf, windowHeightHalf - imgHeightHalf)
            };

            var builder = new InkStrokeBuilder();
            var strokeTopLeft = builder.CreateStroke(ptListTopLeft);
            var strokeBottomRight = builder.CreateStroke(ptListBottomRight);

            CurrentInkManager.AddStroke(strokeTopLeft);
            CurrentInkManager.AddStroke(strokeBottomRight);
        }

Viewing all articles
Browse latest Browse all 360

Trending Articles



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