Click or drag to resize
StraightenEffectGetRequiredSourceRectangle Method
Queries what part of an effect source image is needed to draw an output region.

Namespace:  Microsoft.Graphics.Canvas.Effects
Assembly:  Microsoft.Graphics.Canvas (in Microsoft.Graphics.Canvas.dll) Version: 0.0.0.0
Syntax
Remarks
Examples
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);
See Also