Stuart.EditGroup.GetSelectionBorder C# (CSharp) Method

GetSelectionBorder() private method

private GetSelectionBorder ( ICanvasImage mask, float zoomFactor ) : ICanvasImage
mask ICanvasImage
zoomFactor float
return ICanvasImage
        ICanvasImage GetSelectionBorder(ICanvasImage mask, float zoomFactor)
        {
            // Scale so our border will always be the same width no matter how the image is zoomed.
            var scaleToCurrentZoom = new ScaleEffect
            {
                Source = mask,
                Scale = new Vector2(zoomFactor)
            };

            // Find edges of the selection.
            var detectEdges = new EdgeDetectionEffect
            {
                Source = scaleToCurrentZoom,
                Amount = 0.1f
            };

            // Colorize.
            var colorItMagenta = new ColorMatrixEffect
            {
                Source = detectEdges,

                ColorMatrix = new Matrix5x4
                {
                    M11 = 1,
                    M13 = 1,
                    M14 = 1,
                }
            };

            // Scale back to the original size.
            return new ScaleEffect
            {
                Source = colorItMagenta,
                Scale = new Vector2(1 / zoomFactor)
            };
        }