private ICanvasImage CreateEdgeDetection() { textLabel = requiresWin10; var edgeDetectionEffect = new EdgeDetectionEffect { Source = bitmapTiger }; // Animation changes the edge detection settings. animationFunction = elapsedTime => { edgeDetectionEffect.Amount = 0.7f + (float)Math.Sin(elapsedTime * 2) * 0.3f; edgeDetectionEffect.BlurAmount = Math.Max((float)Math.Sin(elapsedTime * 0.7) * 2, 0); }; return edgeDetectionEffect; }
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) }; }