PixelShaderEffect Class |
Namespace: Microsoft.Graphics.Canvas.Effects
public sealed class PixelShaderEffect : ICanvasEffect, IGraphicsEffect, IGraphicsEffectSource, ICanvasImage, IDisposable
The PixelShaderEffect type exposes the following members.
Name | Description | |
---|---|---|
PixelShaderEffect | Initializes a new instance of the PixelShaderEffect class. |
Name | Description | |
---|---|---|
BufferPrecision | Specifies what precision to use for intermediate buffers when drawing this effect. | |
CacheOutput | Enables caching the output from drawing this effect. | |
MaxSamplerOffset |
Describes the maximum offset the shader will add to or subtract from a texture
coordinate when sampling from an input that uses Offset coordinate mapping mode.
| |
Name | Attaches a user-defined name string to the effect. | |
Properties |
Collection of properties configures the constant buffer that will be passed to the custom pixel shader.
| |
Source1 | Gets or sets the first input source for the custom pixel shader. | |
Source1BorderMode | Sets the border mode used when sampling the first input texture. | |
Source1Interpolation | Sets the interpolation mode used when sampling the first input texture. | |
Source1Mapping | Describes what texture coordinates the shader will use when sampling its first input texture. | |
Source2 | Gets or sets the second input source for the custom pixel shader. | |
Source2BorderMode | Sets the border mode used when sampling the second input texture. | |
Source2Interpolation | Sets the interpolation mode used when sampling the second input texture. | |
Source2Mapping | Describes what texture coordinates the shader will use when sampling its second input texture. | |
Source3 | Gets or sets the third input source for the custom pixel shader. | |
Source3BorderMode | Sets the border mode used when sampling the third input texture. | |
Source3Interpolation | Sets the interpolation mode used when sampling the third input texture. | |
Source3Mapping | Describes what texture coordinates the shader will use when sampling its third input texture. | |
Source4 | Gets or sets the fourth input source for the custom pixel shader. | |
Source4BorderMode | Sets the border mode used when sampling the fourth input texture. | |
Source4Interpolation | Sets the interpolation mode used when sampling the fourth input texture. | |
Source4Mapping | Describes what texture coordinates the shader will use when sampling its fourth input texture. | |
Source5 | Gets or sets the fifth input source for the custom pixel shader. | |
Source5BorderMode | Sets the border mode used when sampling the fifth input texture. | |
Source5Interpolation | Sets the interpolation mode used when sampling the fifth input texture. | |
Source5Mapping | Describes what texture coordinates the shader will use when sampling its fifth input texture. | |
Source6 | Gets or sets the sixth input source for the custom pixel shader. | |
Source6BorderMode | Sets the border mode used when sampling the sixth input texture. | |
Source6Interpolation | Sets the interpolation mode used when sampling the sixth input texture. | |
Source6Mapping | Describes what texture coordinates the shader will use when sampling its sixth input texture. | |
Source7 | Gets or sets the seventh input source for the custom pixel shader. | |
Source7BorderMode | Sets the border mode used when sampling the seventh input texture. | |
Source7Interpolation | Sets the interpolation mode used when sampling the seventh input texture. | |
Source7Mapping | Describes what texture coordinates the shader will use when sampling its seventh input texture. | |
Source8 | Gets or sets the eighth input source for the custom pixel shader. | |
Source8BorderMode | Sets the border mode used when sampling the eighth input texture. | |
Source8Interpolation | Sets the interpolation mode used when sampling the eighth input texture. | |
Source8Mapping | Describes what texture coordinates the shader will use when sampling its eighth input texture. |
Name | Description | |
---|---|---|
Dispose | Releases all resources used by the effect. | |
GetBounds(ICanvasResourceCreator) | Retrieves the bounds of this PixelShaderEffect. | |
GetBounds(ICanvasResourceCreator, Matrix3x2) | Retrieves the bounds of this PixelShaderEffect. | |
GetInvalidRectangles | Queries what regions of the effect output have changed since it was last drawn. | |
GetRequiredSourceRectangle | Queries what part of an effect source image is needed to draw an output region. | |
GetRequiredSourceRectangles | Queries what parts of the effect source images are needed to draw an output region. | |
InvalidateSourceRectangle | Notifies the effect that one of its source images has changed. | |
IsSupported |
Checks whether the pixel shader used by this effect is compatible with the
Direct3D feature level of the specified device.
|
Supported by Win2D but not Windows.UI.Composition.
This effect renders graphics using a custom pixel shader. Depending on the chosen shader, it supports from 0 to 8 sources. These can be any ICanvasImage, and are passed into the shader as input textures.
Steps to use a custom pixel shader:
See the PixelShaderEffect(Byte) constructor documentation for more details about steps #1 and #2.
Note that custom pixel shaders work in units of pixels rather than dips. For instance the value returned by D2DGetScenePosition (from d2d1effecthelpers.hlsli) is in pixels. If your shader manipulates position or size values, you have two options:
var effect = new PixelShaderEffect(File.ReadAllBytes("MyShader.bin")) { Source1 = tigerBitmap }; effect.Properties["tint"] = new Vector4(0.5f, 1, 0, 1); drawingSession.DrawImage(effect);