Base for all image data classes. More...
Public Member Functions | |
ImageBase () noexcept | |
ImageBase (unsigned int width, unsigned int height, unsigned int depth, PIXEL_FORMAT format, unsigned int pixelOrBlockByteSize=0, unsigned int rowByteSize=0, unsigned int sliceByteSize=0) noexcept | |
ImageBase (unsigned int width, unsigned int height, unsigned int depth, unsigned int arraySize, unsigned int mips, PIXEL_FORMAT format, unsigned int pixelOrBlockByteSize=0) noexcept | |
ImageBase (nkMemory::BufferCast< ImageDescriptor > &&images, PIXEL_FORMAT format, unsigned int pixelOrBlockByteSize, bool alphaPremultiplied=false, bool cubeMap=false) noexcept | |
ImageBase (const ImageBase &other) noexcept | |
ImageBase (ImageBase &&other) noexcept | |
virtual | ~ImageBase () |
unsigned int | getWidth (unsigned int mip=0u) const |
unsigned int | getHeight (unsigned int mip=0u) const |
unsigned int | getDepthOrArraySize (unsigned int mip=0u) const |
unsigned int | getMipCount () const |
PIXEL_FORMAT | getFormat () const |
unsigned int | getPixelByteSize () const |
unsigned int | getRowByteSize (unsigned int mip=0u) const |
unsigned int | getSliceByteSize (unsigned int mip=0u) const |
bool | getAlphaPremultiplied () const |
bool | getCubeMap () const |
bool | isArray () const |
void | setFormat (PIXEL_FORMAT value) |
void | setPixelOrBlockByteSize (unsigned int value) |
void | setAlphaPremultiplied (bool value) |
void | setCubeMap (bool value) |
nkMaths::Vector | getPixel (unsigned int x, unsigned int y, unsigned int z=0u, unsigned int mip=0u) const |
void | setPixel (nkMaths::Vector v, unsigned int x, unsigned int y, unsigned int z=0u, unsigned int mip=0u) |
Image | decompress (const AlignmentDescriptor &alignmentDescriptor=AlignmentDescriptor()) const |
virtual unsigned char * | getDataPtr () const =0 |
virtual unsigned long long | getDataByteSize () const =0 |
virtual nkMemory::BufferView | getDataBuffer () const =0 |
virtual bool | isView () const =0 |
ImageBase & | operator= (const ImageBase &other) noexcept |
ImageBase & | operator= (ImageBase &&other) noexcept |
Base for all image data classes.
An image holds informations such as the data of the image, its size, alignment in memory... It also offers utilities to access a particular pixel data.
This class family is also the basis for all exchanges in the component. Where data ownership is in play, Image is used. Where no data ownership is needed, ImageView is used.
|
noexcept |
Default constructor.
|
noexcept |
2D image without mips constructor.
width | The width of the image, in pixels. |
height | The height of the image, in pixels. |
depth | The depth of the image, in number of slices of width * height images. |
format | The pixel format of the image. |
pixelOrBlockByteSize | The size of a pixel or block, in bytes. Defaults to 0 to be automatically derived from the format. |
rowByteSize | The size of a row, in bytes. Defaults to 0 to be automatically derived from the pixel byte size and width. |
sliceByteSize | The size of a slice, in bytes. Defaults to 0 to be automatically derived from the row size size and height. |
|
noexcept |
Tightly packed full constructor. Will derive all information for slices and mips based on width, height, depth and format given / pixelOrBlockSize given. Memory will be assumed as being tightly packed (no padding inside).
width | The width of the image, in pixels. |
height | The height of the image, in pixels. |
depth | The depth of the image, in number of slices of width * height images. |
arraySize | The number of slice in the image array. |
mips | The number of mips for each image slice. |
format | The pixel format of the image. |
pixelOrBlockByteSize | The size of a pixel or block, in bytes. Defaults to 0 to be automatically derived from the format. |
|
noexcept |
Full constructor.
images | The sub-images constituting the full image. One entry corresponds to an entry within a 2D image array. |
format | The pixel format of the image. |
pixelOrBlockByteSize | The size of a pixel or block, in bytes. |
alphaPremultiplied | Whether the alpha is premultiplied (true) or not (false). |
cubeMap | Whether the image is a cube map (true) or not (false). |
|
noexcept |
Copy constructor.
other | The base to copy over. |
|
noexcept |
Move constructor.
other | The base to move over. |
|
virtual |
Destructor.
unsigned int nkImages::ImageBase::getWidth | ( | unsigned int | mip = 0u | ) | const |
mip | The mip which dimension should be retrieved. |
unsigned int nkImages::ImageBase::getHeight | ( | unsigned int | mip = 0u | ) | const |
mip | The mip which dimension should be retrieved. |
unsigned int nkImages::ImageBase::getDepthOrArraySize | ( | unsigned int | mip = 0u | ) | const |
mip | The mip which dimension should be retrieved. |
unsigned int nkImages::ImageBase::getMipCount | ( | ) | const |
PIXEL_FORMAT nkImages::ImageBase::getFormat | ( | ) | const |
unsigned int nkImages::ImageBase::getPixelByteSize | ( | ) | const |
unsigned int nkImages::ImageBase::getRowByteSize | ( | unsigned int | mip = 0u | ) | const |
mip | The mip which size should be retrieved. |
unsigned int nkImages::ImageBase::getSliceByteSize | ( | unsigned int | mip = 0u | ) | const |
mip | The mip which size should be retrieved. |
bool nkImages::ImageBase::getAlphaPremultiplied | ( | ) | const |
bool nkImages::ImageBase::getCubeMap | ( | ) | const |
bool nkImages::ImageBase::isArray | ( | ) | const |
void nkImages::ImageBase::setFormat | ( | PIXEL_FORMAT | value | ) |
Sets the pixel format.
value | The pixel format image is using. |
void nkImages::ImageBase::setPixelOrBlockByteSize | ( | unsigned int | value | ) |
Sets the size of a pixel or block.
value | The size to assign, in bytes. |
void nkImages::ImageBase::setAlphaPremultiplied | ( | bool | value | ) |
Sets whether the image's colors are alpha premultiplied or not.
value | The value to assign, true (premultiplied) or false (not premultiplied). |
void nkImages::ImageBase::setCubeMap | ( | bool | value | ) |
Sets whether the image is a cube map.
value | The value to assign, true (cube map) or false (not a cube map). |
nkMaths::Vector nkImages::ImageBase::getPixel | ( | unsigned int | x, |
unsigned int | y, | ||
unsigned int | z = 0u , |
||
unsigned int | mip = 0u |
||
) | const |
Allows to retrieve a pixel at given coordinates. This function abstracts the memory access required to reach given pixel (alignment, sizes...).
x | The x coordinate of the pixel. |
y | The y coordinate of the pixel. |
z | The z coordinate of the pixel, if the image has a depth. The array index, if the image is an array. |
mip | The mip level to retrieve to pixel from. |
void nkImages::ImageBase::setPixel | ( | nkMaths::Vector | v, |
unsigned int | x, | ||
unsigned int | y, | ||
unsigned int | z = 0u , |
||
unsigned int | mip = 0u |
||
) |
Allows to set a pixel at given coordinates. This function abstracts the memory access required to reach given pixel (alignment, sizes...).
v | The value to assign to the pixel, in the image's format. |
x | The x coordinate of the pixel. |
y | The y coordinate of the pixel. |
z | The z coordinate of the pixel, if the image has a depth. The array index, if the image is an array. |
mip | The mip level to alter to pixel from. |
Image nkImages::ImageBase::decompress | ( | const AlignmentDescriptor & | alignmentDescriptor = AlignmentDescriptor() | ) | const |
Decompresses an image using a compressed format into a non-compressed format.
alignmentDescriptor | Describes if any alignment constraint is required. |
|
pure virtual |
Implemented in nkImages::ImageView, and nkImages::Image.
|
pure virtual |
Implemented in nkImages::ImageView, and nkImages::Image.
|
pure virtual |
Implemented in nkImages::ImageView, and nkImages::Image.
|
pure virtual |
Implemented in nkImages::ImageView, and nkImages::Image.
Copy assignment operator.
other | The base to copy and assign. |
Move assignment operator.
other | The base to move and assign. |