Table of Contents

Class BitmapSourceEffect2

Namespace
PaintDotNet.Direct2D1.Effects
Assembly
PaintDotNet.Windows.Framework.dll

Similar to BitmapSourceEffect, but has improved performance and reduced functionality.

This effect will stream the bitmap source to the GPU as needed; the bitmap is not cached.

This effect will copy the pixels from the bitmap source directly to GPU memory, and as such will only work with pixel formats that can be copied directly to the GPU. It will not perform premultiplication, pixel format conversion, or color space conversion, nor will it ensure that the alpha channel contains opaque values for pixel formats that do not support alpha (such as Bgr32). Mipmap chains are also not supported.

For most purposes, it is recommended to use CreateImageFromBitmap(IDeviceContext, IBitmapSource, BitmapImageOptions) which will perform format conversions from pixel formats that cannot be directly copied to the GPU (e.g. Bgr24, indexed formats, etc.), and will ensure pixel formats like Bgr32 have an opaque alpha chanel.

public sealed class BitmapSourceEffect2 : CustomEffect<BitmapSourceEffect2.Props>, ISerializable, IDeviceEffect, IDeviceImage, IDirect2DResource, IFactoryProperty, IDeviceEffectProperties, IInternalImpl, IObjectRef, IIsDisposed, IDisposable
Inheritance
BitmapSourceEffect2
Implements
Inherited Members

Remarks

If you are using a bitmap in a straight alpha pixel format, such as Bgra32, you should use this effect as the input to a PremultiplyEffect unless you are certain that the next effect in the graph is expecting straight alpha pixel values (most do not).

If you are using a bitmap in a pixel format that does not have an alpha channel, such as Bgr32, you must ensure that all pixels are actually encoded with an opaque alpha channel. Otherwise rendering may be incorrect. You can use the MakeOpaqueEffect to ensure that the alpha channel is opaque.

The following pixel formats are supported: Alpha8, Bgr32, Bgra32, Pbgra32, Rgba64, Prgba64, Rgb64Half, Rgba64Half, Prgba64Half, Rgb128Float, Rgba128Float, and Prgba128Float.

Constructors

BitmapSourceEffect2(IDeviceEffectFactory)