Table of Contents

Class OverlayManagerBackgroundImage

Namespace
VisioForge.Core.Types.X.VideoEffects
Assembly
VisioForge.Core.dll

Represents a background image for the overlay manager that can be stretched and rendered behind other overlay elements. Implements the VisioForge.Core.Types.X.VideoEffects.IOverlayManagerBackground

public class OverlayManagerBackgroundImage : IOverlayManagerBackground, IDisposable

Inheritance

Implements

Inherited Members

Constructors

OverlayManagerBackgroundImage(Bitmap, double)

Initializes a new instance of the VisioForge.Core.Types.X.VideoEffects.OverlayManagerImage class.

public OverlayManagerBackgroundImage(Bitmap image, double alpha = 1)

Parameters

image Bitmap

The image.

alpha double

The alpha.

OverlayManagerBackgroundImage(SKBitmap, double)

Initializes a new instance of the VisioForge.Core.Types.X.VideoEffects.OverlayManagerImage class.

public OverlayManagerBackgroundImage(SKBitmap image, double alpha = 1)

Parameters

image SKBitmap

The image.

alpha double

The alpha.

Remarks

A bitmap in SkiaSharp.SKColorType.Rgba8888 is used as is and stays the caller's to dispose; any other is copied.

OverlayManagerBackgroundImage(string, double)

Initializes a new instance of the VisioForge.Core.Types.X.VideoEffects.OverlayManagerImage class.

[JsonConstructor]
public OverlayManagerBackgroundImage(string filename, double alpha = 1)

Parameters

filename string

The filename.

alpha double

The alpha.

Remarks

The constructor a pipeline document binds: the filename is the one member that names the image, so it is the only one that can survive a save/load. The overloads taking a SKBitmap or a System.Drawing.Bitmap stay runtime-only.

Exceptions

InvalidOperationException

The file cannot be read.

Properties

Alpha

Gets the alpha.

[JsonInclude]
public double Alpha { get; }

Property Value

double

Remarks

[JsonInclude] because the setter is non-public and a document would otherwise lose a non-default alpha.

Cache

Gets or sets the cache: the decoded Cairo surface the renderer draws, or null when the background has no image. Runtime state, not configuration - a Cairo surface has no JSON shape, so it is kept out of a pipeline document and rebuilt from VisioForge.Core.Types.X.VideoEffects.OverlayManagerBackgroundImage.Filename on the way back.

[JsonIgnore]
public object Cache { get; set; }

Property Value

object

Enabled

Gets or sets a value indicating whether this VisioForge.Core.Types.X.VideoEffects.IOverlayManagerElement is enabled.

public bool Enabled { get; set; }

Property Value

bool

Filename

Gets the path of the image file this background was built from, or null for one built from an in-memory bitmap.

[JsonInclude]
public string Filename { get; }

Property Value

string

Remarks

[JsonInclude] because the setter is non-public: it is the only member that names the image, and a document without it cannot restore the background. Because it is also a mandatory constructor argument, a background built from a bitmap - which has no file - is refused at write time rather than saved as an image-less document.

Name

Gets or sets the name.

public string Name { get; set; }

Property Value

string

StretchMode

Gets or sets the stretch mode.

public OverlayManagerImageStretchMode StretchMode { get; set; }

Property Value

OverlayManagerImageStretchMode

Methods

Dispose(bool)

Releases unmanaged and - optionally - managed resources.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

~OverlayManagerBackgroundImage()

Finalizes an instance of the VisioForge.Core.Types.X.VideoEffects.OverlayManagerBackgroundImage class.

protected ~OverlayManagerBackgroundImage()

GetImage()

Gets the image.

public SKBitmap GetImage()

Returns

SKBitmap

Bitmap.

Update(Bitmap, double)

Updates the specified image.

public void Update(Bitmap image, double alpha = 1)

Parameters

image Bitmap

The image.

alpha double

The alpha.

Update(SKBitmap, double)

Updates the specified image.

public void Update(SKBitmap image, double alpha = 1)

Parameters

image SKBitmap

The image.

alpha double

The alpha.

Remarks

A bitmap in SkiaSharp.SKColorType.Rgba8888 is used as is and stays the caller's to dispose; any other is copied.

Update(string, double)

Updates the specified filename.

public void Update(string filename, double alpha = 1)

Parameters

filename string

The filename.

alpha double

The alpha.

Exceptions

InvalidOperationException

The file cannot be read; the current image is kept.

See Also