ISampleBufferBase
Description
- Derived from
- Extended by
-
HeightmapRegion sealed
ISampleBuffer
Base interface for classes that represent value buffers that are organized as flat arrays with a common indexing scheme.
Subclasses provide arrays that store buffer samples. This array can be accessed as follows:
Samples[Offset + y * Stride + x * TupleSize + z] := value
where x and y are the coordinates of the buffer sample and z is the index of the tuple component to access.
Public / Methods
ApplyTransform
Perform an in-place Transform of the samples in the given buffer region.
For square regions (i.e., same width and height), all Transforms can be applied within the region. For rectangular regions, width and height might get swapped ( Transforms.WillSwapAxes) while the top-left sample of the given region remains in the same place.
If this sample buffer is not big enough to hold the swapped width or height, output samples will be discarded.
This method reads samples from the given input region and writes samples to the transformed output region. No other samples are accessed by this method.
OffsetAt
2 overloads
Computes the buffer index for the given sample.
The returned buffer index may only be used to access the samples in the specified row (see y in).
Computes the buffer index for the given sample.
Shift
Shifts the samples in this buffer by the given amount.
This method allows sample buffers to be used in a toroidal manner (i.e., as a two-dimensional ringbuffer).
Specifying a positive value for x in will create space for new samples at the left buffer border, a negative value for x in will create space at the right border.
Specifying a positive value for y in will create space for new samples at the top buffer border, a negative value for y in will create space at the bottom border.
The content of the samples in the additional space at the buffer border is unspecified and must be set by the caller.
Public / Attributes
IsPacked
Returns whether this sample buffer is densely packed.
A packed sample buffer can be indexed with the following scheme:
Samples[(y * Width + x) * TupleSize + 0] := 1st value of sample at (x,y). Samples[(y * Width + x) * TupleSize + 1] := 2nd value of sample at (x,y). ... Samples[(y * Width + x) * TupleSize + TupleSize - 1] := last value of sample.
Thus, the samples of a densely packed buffer form a contiguous region in memory.
IsPooled
Is this sample buffer being held in a pool?
Using a sample buffer that is being held in a pool is an error and indicates incorrect use of IDeletable.Delete.
After calling IDeletable.Delete, a sample buffer is considered to be in a pool and IsPooled will return true.
After taking a sample buffer out of the pool, Restore must be called.