Table of Contents

Method TryGetImage

Namespace
PaintDotNet.Clipboard
Assembly
PaintDotNet.Core.dll

TryGetImage(IClipboard)

Retrieves the image that is on the clipboard, if possible.

public static IClipboardImage? TryGetImage(this IClipboard clipboard)

Parameters

clipboard IClipboard

Returns

IClipboardImage

Remarks

The image may be in any pixel format that is supported as per IsSupported(in PixelFormat). To retrieve the image in a specific pixel format, use TryGetImage(IClipboard, in PixelFormat), TryGetImage<TPixel>(IClipboard), or TryGetImageBgra32(IClipboard).

TryGetImage(IClipboard, in PixelFormat)

Retrieves the image that is on the clipboard, if possible.

The image is converted to the requested pixel format if necessary.

public static IClipboardImage? TryGetImage(this IClipboard clipboard, in PixelFormat pixelFormat)

Parameters

clipboard IClipboard
pixelFormat PixelFormat

Returns

IClipboardImage

TryGetImage<TPixel>(IClipboard)

Retrieves the image that is on the clipboard, if possible.

The image is converted to the requested pixel format if necessary.

public static IClipboardImage<TPixel>? TryGetImage<TPixel>(this IClipboard clipboard) where TPixel : unmanaged, INaturalPixelInfo

Parameters

clipboard IClipboard

Returns

IClipboardImage<TPixel>

Type Parameters

TPixel