VTK-m
2.0
|
Base type for more complex pixels (RGB, Greyscale, etc) that describes various values such as bit-depth, channel width, bytes per pixel, and how various data should be polled. More...
#include <PixelTypes.h>
Public Types | |
using | Superclass = vtkm::Vec< typename ComponentTypeFromSize< BitDepth >::type, Channels > |
using | ComponentType = typename Superclass::ComponentType |
using | BaseType = BasePixel< BitDepth, Channels > |
Public Types inherited from vtkm::Vec< ComponentTypeFromSize< BitDepth >::type, Channels > | |
using | ComponentType = ComponentTypeFromSize< BitDepth >::type |
Public Member Functions | |
BasePixel ()=default | |
BasePixel (const unsigned char *imageData, const vtkm::Id index) | |
Fills in this->Components by calling ConstructPixelFromImage. More... | |
virtual | ~BasePixel ()=default |
virtual ComponentType | Diff (const BaseType &pixel) const =0 |
Calculates this difference between two pixels as a single value. More... | |
virtual vtkm::Vec4f_32 | ToVec4f () const =0 |
Generates a Vec4f_32 from the current data available in the pixel. More... | |
void | FillImageAtIndexWithPixel (unsigned char *imageData, const vtkm::Id index) |
Takes an output imageData pointer and in index to a location in that dataset and fills in the pixel data at the location. More... | |
Public Member Functions inherited from vtkm::Vec< ComponentTypeFromSize< BitDepth >::type, Channels > | |
Vec ()=default | |
VTKM_EXEC_CONT void | CopyInto (Vec< ComponentTypeFromSize< BitDepth >::type, Size > &dest) const |
Static Public Member Functions | |
static constexpr vtkm::IdComponent | GetBitDepth () |
Static Public Attributes | |
static constexpr vtkm::IdComponent | BIT_DEPTH = BitDepth |
static constexpr vtkm::IdComponent | NUM_BYTES = BitDepth / 8 |
static constexpr vtkm::IdComponent | MAX_COLOR_VALUE = (1 << BitDepth) - 1 |
static constexpr vtkm::IdComponent | NUM_CHANNELS = Superclass::NUM_COMPONENTS |
static constexpr vtkm::IdComponent | BYTES_PER_PIXEL = NUM_CHANNELS * NUM_BYTES |
Static Public Attributes inherited from vtkm::Vec< ComponentTypeFromSize< BitDepth >::type, Channels > | |
static constexpr vtkm::IdComponent | NUM_COMPONENTS |
Protected Member Functions | |
void | ConstructPixelFromImage (const unsigned char *imageData, const vtkm::Id index) |
Takes an input imageData pointer and an index to a location in that dataset and fills in this->Components correctly using the provided BIT_DEPTH and NUM_CHANNELS. More... | |
virtual void | print (std::ostream &os) const =0 |
Friends | |
std::ostream & | operator<< (std::ostream &os, const BaseType &basePixel) |
Implement the << operator for this class type. More... | |
Base type for more complex pixels (RGB, Greyscale, etc) that describes various values such as bit-depth, channel width, bytes per pixel, and how various data should be polled.
BasePixel
takes BitDepth and Channels as template parameters. BitDepth describes the number of bits in the pixel, while Channels describes the multiple of bits that are available. BasePixel extends vtkm::Vec. The ComponentType is pulled from the ComponentTypeFromSize SFINAE struct defined above. This helps with optimizing the pixel size for a given bit-depth. The Size is pulled from the Channels param.
BasePixel
requires BitDepths that are > 8 and powers of 2 at the moment. BitDepths of 4, 2, or 1 bit are not correctly handled at the moment.
BasePixel
describes how to populate itself from an unsigned char pointer (assuming that the data stored within the pointer matches the bit-depth and channels described by the BasePixel type), and how to fill in data for an unsigned char pointer. This is mostly useful in serialization and deserialization to various image formats.
using vtkm::io::BasePixel< BitDepth, Channels >::BaseType = BasePixel<BitDepth, Channels> |
using vtkm::io::BasePixel< BitDepth, Channels >::ComponentType = typename Superclass::ComponentType |
using vtkm::io::BasePixel< BitDepth, Channels >::Superclass = vtkm::Vec<typename ComponentTypeFromSize<BitDepth>::type, Channels> |
|
default |
|
inline |
Fills in this->Components by calling ConstructPixelFromImage.
Requires the base vec values to be zeroed out initially.
|
virtualdefault |
|
protected |
Takes an input imageData pointer and an index to a location in that dataset and fills in this->Components correctly using the provided BIT_DEPTH and NUM_CHANNELS.
Does NOT 0 out the current Components.
|
pure virtual |
Calculates this difference between two pixels as a single value.
void vtkm::io::BasePixel< BitDepth, Channels >::FillImageAtIndexWithPixel | ( | unsigned char * | imageData, |
const vtkm::Id | index | ||
) |
Takes an output imageData pointer and in index to a location in that dataset and fills in the pixel data at the location.
Utilizes BIT_DEPTH and NUM_CHANNELS to fill in multiple bytes worth of data if necessary.
|
inlinestaticconstexpr |
|
protectedpure virtual |
Implemented in vtkm::io::GreyPixel< BitDepth >, and vtkm::io::RGBPixel< BitDepth >.
|
pure virtual |
Generates a Vec4f_32 from the current data available in the pixel.
|
friend |
Implement the << operator for this class type.
Will call the overloaded print method for the subclassed type.
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |