Table of Contents

Class DeviceContextExtensions

Namespace
PaintDotNet.Direct2D1
Assembly
PaintDotNet.Framework.dll
public static class DeviceContextExtensions
Inheritance
DeviceContextExtensions
Inherited Members

Methods

CreateBitmap(IDeviceContext, SizeInt32, in BitmapProperties)
CreateBitmap(IDeviceContext, SizeInt32, DevicePixelFormat, float, float, BitmapOptions, IDeviceColorContext?)
CreateBitmap(IDeviceContext, SizeInt32, DxgiFormat, AlphaMode, float, float, BitmapOptions, IDeviceColorContext?)
CreateBitmap(IDeviceContext, SizeInt32, void*, int, DevicePixelFormat, float, float, BitmapOptions, IDeviceColorContext?)
CreateBitmap(IDeviceContext, SizeInt32, void*, int, DxgiFormat, AlphaMode, float, float, BitmapOptions, IDeviceColorContext?)
CreateBitmapBrush(IDeviceContext, IDeviceBitmap, ExtendMode, ExtendMode, InterpolationMode, float, in Matrix3x2Float?)
CreateBitmapSourceFromImage<TPixel>(IDeviceContext, SizeInt32, IDeviceImage)

Creates an IBitmapSource<TPixel> that renders the given IDeviceImage into CPU accessible memory.

If the IDeviceContext is using hardware acceleration, rendering will be performed on the GPU and then copied to CPU memory. This is done on-demand when CopyPixels(void*, int, uint, in RectInt32?) is called. No caching is used.

CreateBitmapSourceFromImage<TPixel>(IDeviceContext, SizeInt32, IDeviceImage, DevicePixelFormat)

Creates an IBitmapSource<TPixel> that renders the given IDeviceImage into CPU accessible memory.

If the IDeviceContext is using hardware acceleration, rendering will be performed on the GPU and then copied to CPU memory. This is done on-demand when CopyPixels(void*, int, uint, in RectInt32?) is called. No caching is used.

CreateBufferedImage(IDeviceContext, IDeviceImage)

Creates a buffered version of the given image. This can be used to work around limitations in Direct2D's effect rendering system that can result in an InvalidGraphConfigurationException when an IDeviceImage is used both in an effect graph and in a command list.

CreateCompatibleDeviceContext(IDeviceContext, SizeFloat, SizeInt32, DxgiFormat, AlphaMode, CompatibleDeviceContextOptions)
CreateImageBrush(IDeviceContext, IDeviceImage, RectFloat, ExtendMode, ExtendMode, InterpolationMode, float, in Matrix3x2Float?)
CreateImageFromBitmap(IDeviceContext, IBitmapSource, BitmapImageOptions)

Creates an image that renders the given bitmap. This method supports bitmaps of arbitrary sizes and in many pixel formats, whereas CreateBitmap() is limited by the MaximumBitmapSize property and requires that the bitmap be in a pixel format natively supported by Direct2D (e.g. indexed or straight alpha pixel formats are not supported).

CreateImageFromBitmap(IDeviceContext, IBitmapSource, IDeviceColorContext?, BitmapImageOptions)

Creates an image that renders the given bitmap. This method supports bitmaps of arbitrary sizes and in many pixel formats, whereas CreateBitmap() is limited by the MaximumBitmapSize property and requires that the bitmap be in a pixel format natively supported by Direct2D (e.g. indexed or straight alpha pixel formats are not supported).

CreateLinearGradientBrush(IDeviceContext, Point2Float, Point2Float, IGradientStopCollection, float, in Matrix3x2Float?)
CreateRadialGradientBrush(IDeviceContext, Point2Float, Point2Float, float, float, IGradientStopCollection, float, in Matrix3x2Float?)
CreateSharedBitmap(IDeviceContext, IBitmap, RectInt32, in SharedBitmapProperties?)
CreateSharedBitmap(IDeviceContext, IBitmap, in SharedBitmapProperties?)
CreateSolidColorBrush(IDeviceContext, ColorRgba128Float, float, in Matrix3x2Float?)
DrawArc(IDeviceContext, Point2Float, in ArcSegment, IDeviceBrush, float, IStrokeStyle?)
DrawArc(IDeviceContext, Point2Float, Point2Float, SizeFloat, float, SweepDirection, ArcSize, IDeviceBrush, float, IStrokeStyle?)
DrawBezier(IDeviceContext, Point2Float, in BezierSegment, IDeviceBrush, float, IStrokeStyle?)
DrawBezier(IDeviceContext, Point2Float, Point2Float, Point2Float, Point2Float, IDeviceBrush, float, IStrokeStyle?)
DrawBeziers(IDeviceContext, Point2Float, ReadOnlySpan<BezierSegment>, IDeviceBrush, float, IStrokeStyle?)
DrawBeziers(IDeviceContext, ReadOnlySpan<Point2Float>, IDeviceBrush, float, IStrokeStyle?)
DrawCurve(IDeviceContext, ReadOnlySpan<Point2Float>, IDeviceBrush, float, IStrokeStyle?)
DrawEllipse(IDeviceContext, Point2Float, float, IDeviceBrush, float, IStrokeStyle?)
DrawEllipse(IDeviceContext, Point2Float, float, float, IDeviceBrush, float, IStrokeStyle?)
DrawEllipse(IDeviceContext, RectFloat, IDeviceBrush, float, IStrokeStyle?)
DrawEllipse(IDeviceContext, float, float, float, IDeviceBrush, float, IStrokeStyle?)
DrawEllipse(IDeviceContext, float, float, float, float, IDeviceBrush, float, IStrokeStyle?)
DrawGlyphRun(IDeviceContext, Point2Float, in GlyphRun, IDeviceBrush, TextMeasuringMode)

Draws a series of glyphs to the device context.

DrawImage(IDeviceContext, IDeviceImage, RectFloat, in RectFloat?, InterpolationMode, CompositeMode)

Draws the image, fitting the given imageRect from the image to the given targetRect on the device context. If null is passed for imageRect then the whole image is used, and it is also required that the image has a finite extent (which is calculated by calling IDeviceContext.GetImageLocalBounds()). If the image has an infinite extent, the results are undefined and may or may not cause an exception to be thrown.

DrawLine(IDeviceContext, float, float, float, float, IDeviceBrush, float, IStrokeStyle?)
DrawLines(IDeviceContext, ReadOnlySpan<Point2Float>, IDeviceBrush, float, IStrokeStyle?)
DrawPolygon(IDeviceContext, ReadOnlySpan<Point2Float>, IDeviceBrush, float, IStrokeStyle?)
DrawRectangle(IDeviceContext, Point2Float, SizeFloat, IDeviceBrush, float, IStrokeStyle?)
DrawRectangle(IDeviceContext, Point2Float, float, float, IDeviceBrush, float, IStrokeStyle?)
DrawRectangle(IDeviceContext, float, float, SizeFloat, IDeviceBrush, float, IStrokeStyle?)
DrawRectangle(IDeviceContext, float, float, float, float, IDeviceBrush, float, IStrokeStyle?)
DrawRoundedRectangle(IDeviceContext, Point2Float, SizeFloat, float, IDeviceBrush, float, IStrokeStyle?)
DrawRoundedRectangle(IDeviceContext, Point2Float, SizeFloat, float, float, IDeviceBrush, float, IStrokeStyle?)
DrawRoundedRectangle(IDeviceContext, Point2Float, float, float, float, IDeviceBrush, float, IStrokeStyle?)
DrawRoundedRectangle(IDeviceContext, Point2Float, float, float, float, float, IDeviceBrush, float, IStrokeStyle?)
DrawRoundedRectangle(IDeviceContext, RectFloat, float, IDeviceBrush, float, IStrokeStyle?)
DrawRoundedRectangle(IDeviceContext, RectFloat, float, float, IDeviceBrush, float, IStrokeStyle?)
DrawRoundedRectangle(IDeviceContext, float, float, SizeFloat, float, IDeviceBrush, float, IStrokeStyle?)
DrawRoundedRectangle(IDeviceContext, float, float, SizeFloat, float, float, IDeviceBrush, float, IStrokeStyle?)
DrawRoundedRectangle(IDeviceContext, float, float, float, float, float, IDeviceBrush, float, IStrokeStyle?)
DrawRoundedRectangle(IDeviceContext, float, float, float, float, float, float, IDeviceBrush, float, IStrokeStyle?)
DrawText(IDeviceContext, string, ITextFormat, Point2Float, SizeFloat, IDeviceBrush, DrawTextOptions, TextMeasuringMode)
DrawText(IDeviceContext, string, ITextFormat, Point2Float, float, float, IDeviceBrush, DrawTextOptions, TextMeasuringMode)
DrawText(IDeviceContext, string, ITextFormat, float, float, SizeFloat, IDeviceBrush, DrawTextOptions, TextMeasuringMode)
DrawText(IDeviceContext, string, ITextFormat, float, float, float, float, IDeviceBrush, DrawTextOptions, TextMeasuringMode)
DrawTextLayout(IDeviceContext, float, float, ITextLayout, IDeviceBrush, DrawTextOptions)
FillArc(IDeviceContext, Point2Float, in ArcSegment, IDeviceBrush, IDeviceBrush?)
FillArc(IDeviceContext, Point2Float, Point2Float, SizeFloat, float, SweepDirection, ArcSize, IDeviceBrush, IDeviceBrush?)
FillBezier(IDeviceContext, Point2Float, in BezierSegment, IDeviceBrush, IDeviceBrush?, FillMode)
FillBezier(IDeviceContext, Point2Float, Point2Float, Point2Float, Point2Float, IDeviceBrush, IDeviceBrush?, FillMode)
FillBeziers(IDeviceContext, Point2Float, ReadOnlySpan<BezierSegment>, IDeviceBrush, IDeviceBrush?, FillMode)
FillBeziers(IDeviceContext, ReadOnlySpan<Point2Float>, IDeviceBrush, IDeviceBrush?, FillMode)
FillCurve(IDeviceContext, ReadOnlySpan<Point2Float>, IDeviceBrush, IDeviceBrush?, FillMode)
FillEllipse(IDeviceContext, Point2Float, float, IDeviceBrush)
FillEllipse(IDeviceContext, Point2Float, float, float, IDeviceBrush)
FillEllipse(IDeviceContext, float, float, float, IDeviceBrush)
FillEllipse(IDeviceContext, float, float, float, float, IDeviceBrush)
FillPolygon(IDeviceContext, ReadOnlySpan<Point2Float>, IDeviceBrush, IDeviceBrush?, FillMode)
FillRectangle(IDeviceContext, Point2Float, SizeFloat, IDeviceBrush)
FillRectangle(IDeviceContext, Point2Float, float, float, IDeviceBrush)
FillRectangle(IDeviceContext, float, float, SizeFloat, IDeviceBrush)
FillRectangle(IDeviceContext, float, float, float, float, IDeviceBrush)
FillRoundedRectangle(IDeviceContext, Point2Float, SizeFloat, float, IDeviceBrush)
FillRoundedRectangle(IDeviceContext, Point2Float, SizeFloat, float, float, IDeviceBrush)
FillRoundedRectangle(IDeviceContext, Point2Float, float, float, float, IDeviceBrush)
FillRoundedRectangle(IDeviceContext, Point2Float, float, float, float, float, IDeviceBrush)
FillRoundedRectangle(IDeviceContext, RectFloat, float, IDeviceBrush)
FillRoundedRectangle(IDeviceContext, RectFloat, float, float, IDeviceBrush)
FillRoundedRectangle(IDeviceContext, float, float, SizeFloat, float, IDeviceBrush)
FillRoundedRectangle(IDeviceContext, float, float, SizeFloat, float, float, IDeviceBrush)
FillRoundedRectangle(IDeviceContext, float, float, float, float, float, IDeviceBrush)
FillRoundedRectangle(IDeviceContext, float, float, float, float, float, float, IDeviceBrush)
GetEffectRequiredInputRectangle(IDeviceContext, IDeviceEffect, in RectFloat?, in EffectInputDescription)
GetEffectRequiredInputRectangle(IDeviceContext, IDeviceEffect, in RectFloat?, IDeviceEffect, int, RectFloat)
IsSoftwareContext(IDeviceContext)

Returns a flag indicating whether the device context is using software rendering. This also indicates that CreateSharedBitmap(IBitmapLock, in SharedBitmapProperties?) may be used to create a device bitmap that shares memory with a CPU bitmap (without copying).

IsSupported(IDeviceContext, DeviceContextType, DevicePixelFormat?, DeviceContextUsage?)
PushLayer(IDeviceContext, in RectFloat?, IGeometry?, AntialiasMode, in Matrix3x2Float?, float, IDeviceBrush?, LayerOptions, IDeviceLayer?)
SaveDrawingState(IDeviceContext)
UseAntialiasMode(IDeviceContext, AntialiasMode)
UseAxisAlignedClip(IDeviceContext, RectFloat, AntialiasMode)
UseBeginDraw(IDeviceContext)
UseEffectBufferPrecision(IDeviceContext, BufferPrecision)
UseLayer(IDeviceContext, in RectFloat?, IGeometry?, AntialiasMode, in Matrix3x2Float?, float, IDeviceBrush?, LayerOptions, IDeviceLayer?)
UsePrimitiveBlend(IDeviceContext, PrimitiveBlend)
UseRotateAtTransform(IDeviceContext, float, Point2Float, MatrixMultiplyOrder)
UseRotateAtTransform(IDeviceContext, float, float, float, MatrixMultiplyOrder)
UseRotateTransform(IDeviceContext, float, MatrixMultiplyOrder)
UseScaleAtTransform(IDeviceContext, Vector2Float, Point2Float, MatrixMultiplyOrder)
UseScaleAtTransform(IDeviceContext, float, float, Point2Float, MatrixMultiplyOrder)
UseScaleAtTransform(IDeviceContext, float, float, float, float, MatrixMultiplyOrder)
UseScaleTransform(IDeviceContext, Vector2Float, MatrixMultiplyOrder)
UseScaleTransform(IDeviceContext, float, float, MatrixMultiplyOrder)
UseTarget(IDeviceContext, IDeviceImage?)
UseTextAntialiasMode(IDeviceContext, TextAntialiasMode)
UseTextRenderingMode(IDeviceContext, TextRenderingMode)
UseTextRenderingParameters(IDeviceContext, ITextRenderingParameters?)
UseTransform(IDeviceContext, in Matrix3x2Float, MatrixMultiplyOrder)
UseTranslateTransform(IDeviceContext, Point2Float, MatrixMultiplyOrder)
UseTranslateTransform(IDeviceContext, Vector2Float, MatrixMultiplyOrder)
UseTranslateTransform(IDeviceContext, float, float, MatrixMultiplyOrder)