Show / Hide Table of Contents

Class ImageAsset

Image asset type. Used to render sprites on screen, or as a render target to draw on.

Inheritance
System.Object
IAsset
ImageAsset
Implements
System.IDisposable
Inherited Members
IAsset._handle
IAsset.Tag
IAsset.Dispose()
IAsset.HaveHandle
IAsset.IsValid
IAsset.FullPath
IAsset.Path
IAsset.FullIdentifier
Namespace: BonEngineSharp.Assets
Assembly: BonEngineSharp.dll
Syntax
public class ImageAsset : IAsset, IDisposable

Constructors

ImageAsset(IntPtr)

Create the asset.

Declaration
public ImageAsset(IntPtr handle)
Parameters
Type Name Description
System.IntPtr handle

Asset handle inside the low-level engine.

Properties

AlphaChannel

Return if this image have alpha channel.

Declaration
public bool AlphaChannel { get; }
Property Value
Type Description
System.Boolean

AssetType

Get asset type.

Declaration
public override AssetType AssetType { get; }
Property Value
Type Description
AssetType
Overrides
IAsset.AssetType

FilteringMode

Get image filtering mode.

Declaration
public ImageFilterMode FilteringMode { get; }
Property Value
Type Description
ImageFilterMode

Height

Get image height.

Declaration
public int Height { get; }
Property Value
Type Description
System.Int32

Width

Get image width.

Declaration
public int Width { get; }
Property Value
Type Description
System.Int32

Methods

Clear()

Clears image to transparent pixels, including alpha channels.

Declaration
public void Clear()

Finalize()

Dispose on destructor.

Declaration
protected override void Finalize()
Overrides
IAsset.Finalize()

FreeReadingBuffer()

Free a reading buffer created by PrepareReadingBuffer(). This is done automatically anyway when asset is freed from memory on the CPP side of BonEngine.

Declaration
public void FreeReadingBuffer()

GetPixel(PointI)

Get pixel color from image. Note: you must call PrepareReadingBuffer() before using this function, otherwise you'll just get 0,0,0,0 values.

Declaration
public Color GetPixel(PointI position)
Parameters
Type Name Description
PointI position

Pixel position to query.

Returns
Type Description
Color

Pixel color.

PrepareReadingBuffer()

Prepare a reading buffer so we can query pixels data from this image asset. You must call this before calling GetPixel().

Declaration
public void PrepareReadingBuffer()

PrepareReadingBuffer(RectangleI)

Prepare a reading buffer so we can query pixels data from this image asset. You must call this before calling GetPixel().

Declaration
public void PrepareReadingBuffer(RectangleI sourceRect)
Parameters
Type Name Description
RectangleI sourceRect

Source rect to read.

SaveToFile(String)

Save image asset to file.

Declaration
public void SaveToFile(string path)
Parameters
Type Name Description
System.String path

Filename for the output image.

Implements

System.IDisposable
Back to top Generated by DocFX