class
PixelData
A buffer describing a volume (3D), image (2D) or line (1D) of pixels in memory.
Pixels are stored as a succession of "depth" slices, each containing "height" rows of "width" pixels.
Public
Constructors
PixelData
PixelData
Constructs a new object with an internal buffer capable of holding "extents" volume of pixels, where each pixel is of the specified pixel format.
Extent offsets are also stored, but are not used internally.
PixelData
Constructs a new object with an internal buffer capable of holding volume of pixels described by provided width, height and depth, where each pixel is of the specified pixel format.
PixelData
Methods
GetRowPitch
Returns the number of bytes that offsets one row from another.
This can be exact number of bytes required to hold "width" pixel, but doesn't have to be as some buffers require padding.
GetSlicePitch
Returns the number of bytes that offsets one depth slice from another.
This can be exact number of bytes required to hold "width * height" pixels, but doesn't have to be as some buffers require padding.
SetRowPitch
Sets the pitch (in bytes) that determines offset between rows of the pixel buffer.
Call this before allocating the buffer.
SetSlicePitch
Sets the pitch (in bytes) that determines offset between depth slices of the pixel buffer.
Call this before allocating the buffer.
GetRowSkip
Returns the number of extra bytes in a row (non-zero only if rows are not consecutive (row pitch is larger than the number of bytes required to hold "width" pixels)).
GetSliceSkip
Returns the number of extra bytes in a depth slice (non-zero only if slices aren't consecutive (slice pitch is larger than the number of bytes required to hold "width * height").
GetFormat
Returns the pixel format used by the internal buffer for storing the pixels.
GetWidth
Returns width of the buffer in pixels.
GetHeight
Returns height of the buffer in pixels.
GetDepth
Returns depth of the buffer in pixels.
GetLeft
Returns left-most start of the pixel volume.
This value is not used internally in any way. It is just passed through from the constructor.
GetRight
Returns right-most end of the pixel volume.
This value is not used internally in any way. It is just passed through from the constructor.
GetTop
Returns top-most start of the pixel volume.
This value is not used internally in any way. It is just passed through from the constructor.
GetBottom
Returns bottom-most end of the pixel volume.
This value is not used internally in any way. It is just passed through from the constructor.
GetFront
Returns front-most start of the pixel volume.
This value is not used internally in any way. It is just passed through from the constructor.
GetBack
Returns back-most end of the pixel volume.
This value is not used internally in any way. It is just passed through from the constructor.
GetExtents
Returns extents of the pixel volume this object is capable of holding.
IsConsecutive
Return whether this buffer is laid out consecutive in memory (meaning the pitches are equal to the dimensions).
GetConsecutiveSize
Return the size (in bytes) this image would take if it was laid out consecutive in memory.
GetSize
Return the size (in bytes) of the buffer this image requires.
GetSubVolume
Returns pixel data containing a sub-volume of this object.
Returned data will not have its own buffer, but will instead point to this one. It is up to the caller to ensure this object outlives any sub-volume objects.
SampleColorAt
Samples a color at the specified coordinates using a specific filter.
- coords
- Coordinates to sample the color at. They start at top left corner (0, 0), and are in range [0, 1].
- filter
- Filtering mode to use when sampling the color.
Returns: Sampled color.
GetColorAt
Returns pixel color at the specified coordinates.
SetColorAt
Sets the pixel color at the specified coordinates.
GetColors
Converts all the internal data into an array of colors.
Array is mapped as such: arrayIdx = x + y * width + z * width * height.
SetColors
Initializes the internal buffer with the provided set of colors.
The array should be of width * height * depth size and mapped as such: arrayIdx = x + y * width + z * width * height.
SetColors
Initializes the internal buffer with the provided set of colors.
The array should be of width * height * depth size and mapped as such: arrayIdx = x + y * width + z * width * height.
GetDepthAt
Interprets pixel data as depth information as retrieved from the GPU's depth buffer.
Converts the device specific depth value to range [0, 1] and returns it.
GetDepths
Converts all the internal data into an array of floats as if each individual pixel is retrieved with getDepthAt().
Array is mapped as such: arrayIdx = x + y * width + z * width * height.
staticCreate
Constructs a new object with an internal buffer capable of holding "extents" volume of pixels, where each pixel is of the specified pixel format.
Extent offsets are also stored, but are not used internally.
staticCreate
Constructs a new object with an internal buffer capable of holding volume of pixels described by provided width, height and depth, where each pixel is of the specified pixel format.
staticGetRttiStatic
Operators
Private
Methods
GetInternalBufferSize
Returns the needed size of the internal buffer, in bytes.