Click or drag to resize
SepiaEffectGetRequiredSourceRectangle 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
C#
public Rect GetRequiredSourceRectangle(
	ICanvasResourceCreatorWithDpi resourceCreator,
	Rect outputRectangle,
	ICanvasEffect sourceEffect,
	uint sourceIndex,
	Rect sourceBounds
)

Parameters

resourceCreator
Type: Microsoft.Graphics.CanvasICanvasResourceCreatorWithDpi
outputRectangle
Type: Windows.FoundationRect
sourceEffect
Type: Microsoft.Graphics.Canvas.EffectsICanvasEffect
sourceIndex
Type: SystemUInt32
sourceBounds
Type: Windows.FoundationRect

Return Value

Type: Rect

Implements

ICanvasEffectGetRequiredSourceRectangle(ICanvasResourceCreatorWithDpi, Rect, ICanvasEffect, UInt32, Rect)
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