CrossFadeEffectGetRequiredSourceRectangle Method |
Namespace: Microsoft.Graphics.Canvas.Effects
public Rect GetRequiredSourceRectangle( ICanvasResourceCreatorWithDpi resourceCreator, Rect outputRectangle, ICanvasEffect sourceEffect, uint sourceIndex, Rect sourceBounds )
This API is only available when running on Windows 10 build 14393 (Anniversary Update) or greater.
To query multiple sources, use GetRequiredSourceRectangles(ICanvasResourceCreatorWithDpi, Rect, ICanvasEffect, UInt32, Rect).CanvasBitmap myBitmap = ...; var blurEffect = new GaussianBlurEffect { Source = myBitmap }; var desaturatedBlur = new SaturationEffect { Source = blurEffect }; Rect outputRegionThatWillBeDrawn = ...; Rect neededPartOfTheBitmap = desaturatedBlur.GetRequiredSourceRectangle( drawingSession, outputRegionThatWillBeDrawn, blurEffect, 0, myBitmap.Bounds); // We now only need to make sure the 'outputRegionThatWillBeDrawn' // region of 'myBitmap' is valid, because we know this draw call // will not access any other parts of the bitmap: drawingSession.DrawImage(desaturatedBlur, position, outputRegionThatWillBeDrawn);