Characteristic Locus
Namespace Meadow.Foundation.Graphics.Buffers
Assembly Meadow.Foundation.dll

Syntax

public interface IPixelBuffer

Properties

BitDepth

The BitDepth of the chosen ColorMode.

Declaration
int BitDepth { get; }

Property Value

Type Description
int

Buffer

The byte array that holds all pixel data

Declaration
byte[] Buffer { get; }

Property Value

Type Description
byte[]

ByteCount

The number of bytes in this pixel buffer

Declaration
int ByteCount { get; }

Property Value

Type Description
int

ColorMode

The ColorMode of the pixel buffer

Declaration
ColorMode ColorMode { get; }

Property Value

Type Description
ColorMode

Height

The height of the pixel buffer

Declaration
int Height { get; }

Property Value

Type Description
int

Width

The width of the pixel buffer

Declaration
int Width { get; }

Property Value

Type Description
int

Methods

Clear()

Clears the buffer (writes 0s to the byte array)

Declaration
void Clear()

Clear(int, int, int, int)

Clears a region of the buffer (writes 0s to the byte array)

Declaration
void Clear(int originX, int originY, int width, int height)

Parameters

Type Name Description
int originX

The X coord to start

int originY

The Y coord to start

int width

The width of the region to clear

int height

The height of the region to clear

Fill(Color)

Fills the buffer with the provided color

Declaration
void Fill(Color color)

Parameters

Type Name Description
Color color

The color to fill

Fill(int, int, int, int, Color)

Fills part of the buffer with the provided color

Declaration
void Fill(int originX, int originY, int width, int height, Color color)

Parameters

Type Name Description
int originX

The X coord to start filling

int originY

The Y coord to start filling

int width

The width to fill

int height

The height to fill

Color color

The color to fill

GetPixel(int, int)

Get the color of a pixel - may be scaled based on buffer color depth

Declaration
Color GetPixel(int x, int y)

Parameters

Type Name Description
int x

X coordinate of the pixel: 0,0 at top left

int y

Y coordinate of the pixel: 0,0 at top left

Returns

Type Description
Color

InvertPixel(int, int)

Invert the color of a pixel at the provided location

Declaration
void InvertPixel(int x, int y)

Parameters

Type Name Description
int x

The X coord to invert

int y

The Y coord to invert

SetPixel(int, int, Color)

Set the color of the pixel at the provided coordinates

Declaration
void SetPixel(int x, int y, Color color)

Parameters

Type Name Description
int x

X coordinate of the pixel: 0,0 at top left

int y

Y coordinate of the pixel: 0,0 at top left

Color color

The pixel color

WriteBuffer(int, int, IPixelBuffer)

Writes another pixel buffer into this buffer.

Declaration
void WriteBuffer(int originX, int originY, IPixelBuffer buffer)

Parameters

Type Name Description
int originX

The X origin to start writing

int originY

The Y origin to start writing

IPixelBuffer buffer

The buffer to write into this buffer