SampleBuffer

Description

abstract class Tinman.Terrain.Buffers.SampleBuffer<T val>

Derived from

SampleBufferBase abstract
ISampleBufferGeneric<T>

Extended by

SampleBufferFloat32 abstract
SampleBufferInt32 abstract
SampleBufferInt64 abstract

Abstract base class for ISampleBuffer implementations.

Protected / Constructors

Sample​Buffer

2 overloads


protected constructor SampleBuffer1 → (3)

width in : int32

[>0]
Width of this sample buffer.

height in : int32

[>0]
Height of this sample buffer.

tupleSize in : int32

[1..4]
The tuple size of each buffer sample.

Creates a new instance of SampleBuffer.

A new sample buffer array will be allocated.


protected constructor SampleBuffer2 → (6)

width in : int32

[>0]
Width of this sample buffer.

height in : int32

[>0]
Height of this sample buffer.

offset in : int32

[>=0]
Offset of top-left sample of this sample buffer in buffer array.

stride in : int32

[>0]
The stride of this sample buffer.

tupleSize in : int32

[1..4]
The tuple size of each buffer sample.

samples in : T [ ]

[not-null]
The buffer samples.

Creates a new instance of SampleBuffer.

This sample buffer will use the given data array.

Protected / Methods

Clear​Internal


protected abstract method ClearInternal → (3)

samples in : T [ ]

The array.

offset in : int32

Offset into samples in.

count in : int32

Number of array elements to clear.

Clears array elements to their default values.

Copy​Internal


protected abstract method CopyInternal → (5)

source in : T [ ]

The source array.

sourceOffset in : int32

Offset into source in.

target in : T [ ]

The target array.

targetOffset in : int32

Offset into target in.

count in : int32

Number of array elements to copy.

Copies array elements from source in to target in.

Downsample_1x2


protected abstract method Downsample_1x2 → (6)

filter in : DownsampleFilter

The downsample filter to use.

ref : int32

X-coordinate of the second column of the previous block.

width in : int32

The buffer width.

offset0 ref : int32

The row offset in this buffer.

resultSamples in : T [ ]

The output sample buffer.

resultOffset ref : int32

Offset into output sample buffer.

Performs downsampling on a row of 1x2 blocks.

Downsample_2x1


protected abstract method Downsample_2x1 → (5)

filter in : DownsampleFilter

The downsample filter to use.

offset0 ref : int32

The first row offset in this buffer.

offset1 ref : int32

The second row offset in this buffer.

resultSamples in : T [ ]

The output sample buffer.

resultOffset ref : int32

Offset into output sample buffer.

Performs downsampling on a single 2x1 block.

Downsample_2x2


protected abstract method Downsample_2x2 → (7)

filter in : DownsampleFilter

The downsample filter to use.

ref : int32

X-coordinate of the second column of the previous block.

width in : int32

The buffer width.

offset0 ref : int32

The first row offset in this buffer.

offset1 ref : int32

The second row offset in this buffer.

resultSamples in : T [ ]

The output sample buffer.

resultOffset ref : int32

Offset into output sample buffer.

Performs downsampling on a row of 2x2 blocks.

Equals​Internal

2 overloads


protected abstract method EqualsInternal1 → (5)

source in : T [ ]

The source array.

sourceOffset in : int32

Offset into source in.

target in : T [ ]

The target array.

targetOffset in : int32

Offset into target in.

count in : int32

Number of array elements to compare.

returns → bool

true if the array elements are equal, false if not.

Compares array elements in source in with those in target in for equality.


protected abstract method EqualsInternal2 → (4)

source in : T [ ]

The source array.

sourceOffset in : int32

Offset into source in.

value in : T

The value to compare with.

count in : int32

Number of array elements to compare.

returns → bool

true if the array elements are equal, false if not.

Compares array elements in source in with the given value in for equality.

Interpolate4


[Pure]
protected abstract method Interpolate4 → (6)

in : T

Sample block value.

in : T

Sample block value.

in : T

Sample block value.

in : T

Sample block value.

in : int32

Interpolation factor, in the range [0..65536].

smooth in : bool

true to use smooth interpolation (InterpolationMode.UniformB), false to use accurate interpolation (InterpolationMode.CatmullRom).

returns → T

The interpolated value.

Interpolates a sample value from the given sample block.

Interpolation occurs between in, in:

+---+---+---+---+
| a | b | c | d |
+---+---+---+---+

The interpolation factors are mapped as follows:

  • f = 0 => in

  • f = 65536 => in

Interpolate4x4


[Pure]
protected abstract method Interpolate4x4 → (4)

offset in : int32

Offset to a in samples.

fx in : int32

Horizontal interpolation factor, in the range [0..65536].

fy in : int32

Vertical interpolation factor, in the range [0..65536].

smooth in : bool

true to use smooth interpolation (InterpolationMode.UniformB), false to use accurate interpolation (InterpolationMode.CatmullRom).

returns → T

The interpolated value.

Interpolates a sample value from the given sample block.

Interpolation occurs between f, g, j and k:

+---+---+---+---+
| a | b | c | d |
+---+---+---+---+
| e | f | g | h |
+---+---+---+---+
| i | j | k | l |
+---+---+---+---+
| m | n | o | p |
+---+---+---+---+

The interpolation factors are mapped as follows:

  • (fx = 0, fy = 0) => f

  • (fx = 65536, fy = 0) => g

  • (fx = 0, fy = 65536) => j

  • (fx = 65536, fy = 65536) => k

New​Buffer


protected abstract method NewBuffer → (2)

width in : int32

Width of the buffer.

height in : int32

Height of the buffer.

returns → ISampleBufferGeneric<T>

The ISampleBuffer object.

Creates a new sample buffer of the same type as this buffer.

New​Shared​Buffer


protected abstract method NewSharedBuffer → (4)

width in : int32

Width of the sub buffer.

height in : int32

Height of the sub buffer.

offset in : int32

Offset of top-left sample of sub buffer.

stride in : int32

Stride of this sample buffer.

returns → ISampleBufferGeneric<T>

The ISampleBuffer object.

Creates a new sample buffer that shares a subregion of this sample buffer.

Protected / Attributes

Bytes​Per​Tuple


protected abstract attribute BytesPerTuple → (get)

value : int32

[>0]
The number of bytes per buffer sample tuple element.

Returns the number of bytes per buffer sample tuple element.

samples


protected readonly attribute samples → (T [ ])

The buffer sample array.