ISampleBuffer
Description
- Derived from
- Extended by
-
SampleBuffer abstract
Base interface for classes that represent buffers for heightmap sample values.
Subclasses provide an array that stores the 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 region.
For square regions (i.e. same width and height), all Transforms can be applied in-place. For rectangular regions, width and height might be 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 resp. 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 sample are accessed by this method.
Clone
Clones the sample buffer.
The original and cloned buffers will share the buffer samples. Use this method if you need a separate buffer instance (e.g. for configuring buffer specific properties while keeping the original buffer unmodified).
Pack
Returns a densely packed sample buffer object that contains the same data as this buffer.
- See also
ScaleOffset
Scales the buffer samples and adds the given offset.
Each tuple component (see TupleSize) of each buffer sample is modified according to this formula:
v' := clamp(round(scale * v + offset))
where v
is the sample value currently present in the buffer, v'
is the transformed sample and clamp
and round
are some buffer specific functions that convert the transformed samples back to valid buffer values.
SubBuffer
Represents a ISampleBuffer object that represents a rectangular subregion of this sample buffer.
Modifications made to this sample buffer will be visible to the returned buffer and vice versa.
Public / Attributes
ScanlineRange
The PixelRange of this buffer, where raw pixels values correspond to the buffer samples.
Extensions
ReadFromImage
Replaces the values in this sample buffer with the pixels read from the given source image.
Both IImageInfo.Width and IImageInfo.Height of image in must be equal to the width and height of this ISampleBuffer object.
- IOException
-
If an I/O error has occurred while reading the image pixels.