Click or drag to resize
ArithmeticCompositeEffect Class
Combines two images using a flexible equation that can be configured to perform computations such as addition, subtraction, multiplication, or interpolation.
Inheritance Hierarchy
SystemObject
  Microsoft.Graphics.Canvas.EffectsArithmeticCompositeEffect

Namespace:  Microsoft.Graphics.Canvas.Effects
Assembly:  Microsoft.Graphics.Canvas (in Microsoft.Graphics.Canvas.dll) Version: 0.0.0.0
Syntax
C#
public sealed class ArithmeticCompositeEffect : ICanvasEffect, 
	IGraphicsEffect, IGraphicsEffectSource, ICanvasImage, IDisposable

The ArithmeticCompositeEffect type exposes the following members.

Constructors
  NameDescription
Public methodArithmeticCompositeEffect
Initializes a new instance of the ArithmeticCompositeEffect class.
Top
Properties
  NameDescription
Public propertyBufferPrecision
Specifies what precision to use for intermediate buffers when drawing this effect.
Public propertyCacheOutput
Enables caching the output from drawing this effect.
Public propertyClampOutput
If set, the effect clamps color values to between 0 and 1 before passing them on to the next effect in the graph. If false, the effect will not clamp values, although subsequent effects or the output surface may later clamp if they are not of high enough precision. Default value false.
Public propertyMultiplyAmount
Weights how much the multiplication result (Source1 * Source2) should be included in the output image. Default value 1.
Public propertyName
Attaches a user-defined name string to the effect.
Public propertyOffset
Adds a constant offset to the output image. Default value 0.
Public propertySource1
Gets or sets the first input source for ArithmeticComposite effect.
Public propertySource1Amount
Weights how much the first image (Source1) should be included in the output image. Default value 0.
Public propertySource2
Gets or sets the second input source for ArithmeticComposite effect.
Public propertySource2Amount
Weights how much the second image (Source2) should be included in the output image. Default value 0.
Top
Methods
  NameDescription
Public methodDispose
Releases all resources used by the effect.
Public methodGetBounds(ICanvasResourceCreator)
Retrieves the bounds of this ArithmeticCompositeEffect.
Public methodGetBounds(ICanvasResourceCreator, Matrix3x2)
Retrieves the bounds of this ArithmeticCompositeEffect.
Public methodGetInvalidRectangles
Queries what regions of the effect output have changed since it was last drawn.
Public methodCode exampleGetRequiredSourceRectangle
Queries what part of an effect source image is needed to draw an output region.
Public methodGetRequiredSourceRectangles
Queries what parts of the effect source images are needed to draw an output region.
Public methodInvalidateSourceRectangle
Notifies the effect that one of its source images has changed.
Top
Remarks

This effect combines two images using a weighted sum:

result = (Source1 * Source1Amount) + (Source2 * Source2Amount) + (Source1 * Source2 * MultiplyAmount) + Offset

Different settings of these coefficients can blend the images in many different ways, for instance:

  • To add two images:
    • Source1Amount = 1
    • Source2Amount = 1
    • MultiplyAmount = 0
    • Offset = 0
  • To multiply two images:
    • Source1Amount = 0
    • Source2Amount = 0
    • MultiplyAmount = 1
    • Offset = 0
  • To subtract Source2 from Source1:
    • Source1Amount = 1
    • Source2Amount = -1
    • MultiplyAmount = 0
    • Offset = 0
  • To interpolate between Source1 and Source2 by amount 't':
    • Source1Amount = 1 - t
    • Source2Amount = t
    • MultiplyAmount = 0
    • Offset = 0
  • To invert Source1:
    • Source1Amount = -1
    • Source2Amount = 0
    • MultiplyAmount = 0
    • Offset = 1

This Windows Runtime type corresponds to the D2D Arithmetic composite effect.

See Also