ISampleBufferGeneric

Description

interface Tinman.Terrain.Buffers.ISampleBufferGeneric<T val>

Derived from

ISampleBuffer

Extended by

SampleBuffer abstract

Base interface for ISampleBuffer implementations, defining operations that depend on the sample type.

Public / Methods

Fill


public method Fill → (6)

value in : T

The value to fill with.

opt : int32 = 0

[0..ISampleBufferBase.Width]
X-coordinate of top-left buffer sample to clear.

opt : int32 = 0

[0..ISampleBufferBase.Height]
Y-coordinate of top-left buffer sample to clear.

countX opt : int32 = -1

[>=-1]
Number of buffer samples to clear along X-axis. If -1, samples up to the right buffer edge will be cleared.

countY opt : int32 = -1

[>=-1]
Number of buffer samples to clear along Y-axis. If -1, samples down to the bottom buffer edge will be cleared.

step opt : int32 = 1

[>=1]
The step distance between buffer samples.

Fills buffer samples with the given value.

Gather


public method Gather → (5)

target in : T [ ]

[not-null]
The target array.

coords in : Vec2I [ ]

[not-null]
Buffer coordinates of samples to gather from this region.

indices in : int32 [ ]

[not-null]
Indices into coords in, determining which samples to gather. Also output sample indices for storing results into target in.

first in : int32

[0..indices.Length]
Index of first element in indices in to process.

count in : int32

[0..indices.Length-first]
Number of samples to gather.

Fetches scattered samples from this sample buffer and stores them into the given array.

Is​Uniform


public method IsUniform → (1)

value in : T

The sample value.

returns → bool

true if all samples are equal to value in, false if not.

Checks if all samples of this buffer are equal to the given value in.

Pad​Value


public method PadValue → (3)

width in : int32

[>0]
The new width, in samples.

height in : int32

[>0]
The new height, in samples.

value opt : T = default(T)

The sample value to use for padding the right and bottom edges.

returns → ISampleBuffer

The resulting sample buffer.

Resizes this sample buffer to the given size by padding the right and bottom edges with the specified value.

Public / Attributes

Samples


public attribute Samples → (get)

value : T [ ]

[not-null]
The buffer sample array.

The samples of this buffer.

The buffer stores ISampleBuffer.TupleSize values per sample in row-major order.
The returned array can be indexed as follows:

Samples[Offset + y * Stride + x * TupleSize + 0] := 1st value of sample at (x,y).
Samples[Offset + y * Stride + x * TupleSize + 1] := 2nd value of sample at (x,y).
...
Samples[Offset + y * Stride + x * TupleSize + TupleSize - 1] := last value of sample.

where x and y are the coordinates of the sample to access.