Table of Contents

Method GetSourceBitmap

Namespace
PaintDotNet.Effects
Assembly
PaintDotNet.Effects.Core.dll

GetSourceBitmap(IEffectEnvironment, in PixelFormat)

Gets a bitmap that renders the source layer's contents in the requested pixel format.

public static IEffectInputBitmap GetSourceBitmap(this IEffectEnvironment environment, in PixelFormat pixelFormat)

Parameters

environment IEffectEnvironment

The effect environment.

pixelFormat PixelFormat

The requested pixel format for the bitmap. The native pixel format used by Paint.NET is currently Bgra32, which can be accessed using the ColorBgra32 struct. Specifying a different pixel format is valid, but will incur conversion overhead.

Returns

IEffectInputBitmap

The bitmap.

Remarks

This method is equivalent to calling:

this.Environment.Document.Layers[this.Environment.SourceLayerIndex].GetSourceBitmap(pixelFormat)

GetSourceBitmap<TPixel>(IEffectEnvironment)

Gets a bitmap that renders the source layer's contents in the requested pixel format.

public static IEffectInputBitmap<TPixel> GetSourceBitmap<TPixel>(this IEffectEnvironment environment) where TPixel : unmanaged, INaturalPixelInfo

Parameters

environment IEffectEnvironment

The environment.

Returns

IEffectInputBitmap<TPixel>

The bitmap.

Type Parameters

TPixel

The requested pixel struct for the bitmap. The native pixel struct used by Paint.NET is currently ColorBgra32, which corresponds to the Bgra32 pixel format. Specifying a different pixel struct/format is valid, but will incur conversion overhead.

Remarks

This method is equivalent to calling:

this.Environment.Document.Layers[this.Environment.SourceLayerIndex].GetSourceBitmap<TPixel>()