Table of Contents

Interface IBitmapLoader

Namespace
Splat
Assembly
Splat.Drawing.dll

Defines methods for loading and creating bitmap images from various sources. Unless you are testing image loading, you don't usually need to implement this.

public interface IBitmapLoader
Extension Methods

Remarks

Implementations of this interface provide functionality to load bitmap images from streams, application resources, or to create new empty bitmaps. The specific image formats supported and resource resolution behavior may vary depending on the platform and implementation.

Methods

Create(float, float)

Creates an empty bitmap of the specified dimensions.

IBitmap? Create(float width, float height)

Parameters

width float

The width of the canvas.

height float

The height of the canvas.

Returns

IBitmap

A new image. Use ToNative() to convert this to a native bitmap.

Load(Stream, float?, float?)

Loads a bitmap from a byte stream.

Task<IBitmap?> Load(Stream sourceStream, float? desiredWidth, float? desiredHeight)

Parameters

sourceStream Stream

The stream to load the image from.

desiredWidth float?

The desired width of the image.

desiredHeight float?

The desired height of the image.

Returns

Task<IBitmap>

A future result representing the loaded image.

LoadFromResource(string, float?, float?)

Loads from the application's resources (i.e. from bundle on Cocoa, from Pack URIs on Windows, etc).

Task<IBitmap?> LoadFromResource(string source, float? desiredWidth, float? desiredHeight)

Parameters

source string

The source resource, as a relative path.

desiredWidth float?

Desired width.

desiredHeight float?

Desired height.

Returns

Task<IBitmap>

A future result representing the loaded image.