Table of Contents

Method IsSoftwareContext

Namespace
PaintDotNet.Direct2D1
Assembly
PaintDotNet.Windows.Core.dll

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).

public static bool IsSoftwareContext(this IDeviceContext deviceContext)

Parameters

deviceContext IDeviceContext

Returns

bool

Remarks

If the device context is using software rendering, it can be appropriate to lower the complexity or quality of rendering in order to improve performance. Hardware accelerated rendering is always significantly faster.

This method is more accurate than using IsSupported(in DeviceContextProperties) with Software, which only returns true if the device context was created with CreateBitmapDeviceContext(IBitmap, in DeviceContextProperties). This method also returns true if the device was created using PaintDotNet.Direct2D1.IDirect2DFactory.CreateDevice(PaintDotNet.Dxgi.IDxgiDevice) with the WARP PaintDotNet.Dxgi.IDxgiAdapter.