CropEffectGetRequiredSourceRectangle Method |
Namespace: Microsoft.Graphics.Canvas.Effects
public Rect GetRequiredSourceRectangle( ICanvasResourceCreatorWithDpi resourceCreator, Rect outputRectangle, ICanvasEffect sourceEffect, uint sourceIndex, Rect sourceBounds )
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);