API Documentation
ImageBase.h
1 // ImageBase.h
3 //
5 
6 namespace nkImages
7 {
18  class ImageBase
19  {
20  public :
21 
25  ImageBase () noexcept ;
37  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 ;
51  ImageBase (unsigned int width, unsigned int height, unsigned int depth, unsigned int arraySize, unsigned int mips, PIXEL_FORMAT format, unsigned int pixelOrBlockByteSize = 0) noexcept ;
61  ImageBase (nkMemory::BufferCast<ImageDescriptor>&& images, PIXEL_FORMAT format, unsigned int pixelOrBlockByteSize, bool alphaPremultiplied = false, bool cubeMap = false) noexcept ;
67  ImageBase (const ImageBase& other) noexcept ;
73  ImageBase (ImageBase&& other) noexcept ;
77  virtual ~ImageBase () ;
78 
79  // Getters
84  unsigned int getWidth (unsigned int mip = 0u) const ;
89  unsigned int getHeight (unsigned int mip = 0u) const ;
96  unsigned int getDepthOrArraySize (unsigned int mip = 0u) const ;
100  unsigned int getMipCount () const ;
108  unsigned int getPixelByteSize () const ;
113  unsigned int getRowByteSize (unsigned int mip = 0u) const ;
118  unsigned int getSliceByteSize (unsigned int mip = 0u) const ;
122  bool getAlphaPremultiplied () const ;
126  bool getCubeMap () const ;
132  bool isArray () const ;
133 
134  // Setters
140  void setFormat (PIXEL_FORMAT value) ;
146  void setPixelOrBlockByteSize (unsigned int value) ;
152  void setAlphaPremultiplied (bool value) ;
158  void setCubeMap (bool value) ;
159 
160  // Utils
174  nkMaths::Vector getPixel (unsigned int x, unsigned int y, unsigned int z = 0u, unsigned int mip = 0u) const ;
187  void setPixel (nkMaths::Vector v, unsigned int x, unsigned int y, unsigned int z = 0u, unsigned int mip = 0u) ;
196  Image decompress (const AlignmentDescriptor& alignmentDescriptor = AlignmentDescriptor()) const ;
197 
198  // Data accessors
202  virtual unsigned char* getDataPtr () const = 0 ;
206  virtual unsigned long long getDataByteSize () const = 0 ;
210  virtual nkMemory::BufferView<> getDataBuffer () const = 0 ;
214  virtual bool isView () const = 0 ;
215 
216  // Operators
222  ImageBase& operator= (const ImageBase& other) noexcept ;
228  ImageBase& operator= (ImageBase&& other) noexcept ;
229  } ;
230 }
nkImages::ImageBase::getMipCount
unsigned int getMipCount() const
nkImages::ImageBase::getCubeMap
bool getCubeMap() const
nkImages::ImageBase::setCubeMap
void setCubeMap(bool value)
nkImages::ImageBase::getDataBuffer
virtual nkMemory::BufferView getDataBuffer() const =0
nkImages::ImageBase::setAlphaPremultiplied
void setAlphaPremultiplied(bool value)
nkMaths
Encompasses all API of component NilkinsMaths.
Definition: IntVector.h:7
nkImages::ImageBase::getWidth
unsigned int getWidth(unsigned int mip=0u) const
nkImages::ImageBase::getRowByteSize
unsigned int getRowByteSize(unsigned int mip=0u) const
nkImages::ImageBase::getDataPtr
virtual unsigned char * getDataPtr() const =0
nkImages::ImageBase::setPixel
void setPixel(nkMaths::Vector v, unsigned int x, unsigned int y, unsigned int z=0u, unsigned int mip=0u)
nkImages::ImageBase::getDepthOrArraySize
unsigned int getDepthOrArraySize(unsigned int mip=0u) const
nkImages::ImageBase::getPixelByteSize
unsigned int getPixelByteSize() const
nkImages::ImageBase::getSliceByteSize
unsigned int getSliceByteSize(unsigned int mip=0u) const
nkImages::ImageBase
Base for all image data classes.
Definition: ImageBase.h:19
nkImages::ImageBase::setFormat
void setFormat(PIXEL_FORMAT value)
nkImages::AlignmentDescriptor
Holds information about alignment constraints.
Definition: AlignmentDescriptor.h:12
nkImages
Encompasses all API of component NilkinsImages.
Definition: BmpEncoder.h:7
nkImages::ImageBase::setPixelOrBlockByteSize
void setPixelOrBlockByteSize(unsigned int value)
nkImages::ImageBase::decompress
Image decompress(const AlignmentDescriptor &alignmentDescriptor=AlignmentDescriptor()) const
nkImages::ImageBase::isArray
bool isArray() const
nkImages::PIXEL_FORMAT
PIXEL_FORMAT
Lists formats for pixels.
Definition: PixelFormat.h:16
nkImages::ImageDescriptor
Describes an image within an array. Used internally.
Definition: ImageDescriptor.h:12
nkImages::ImageBase::getFormat
PIXEL_FORMAT getFormat() const
nkImages::ImageBase::getHeight
unsigned int getHeight(unsigned int mip=0u) const
nkImages::ImageBase::getDataByteSize
virtual unsigned long long getDataByteSize() const =0
nkImages::ImageBase::getAlphaPremultiplied
bool getAlphaPremultiplied() const
nkImages::ImageBase::ImageBase
ImageBase() noexcept
nkImages::ImageBase::getPixel
nkMaths::Vector getPixel(unsigned int x, unsigned int y, unsigned int z=0u, unsigned int mip=0u) const
nkImages::ImageBase::isView
virtual bool isView() const =0
nkImages::Image
Holds all information required for an image, with ownership over the data.
Definition: Image.h:14
nkMemory
Encompasses all API of component NilkinsMemory.
Definition: Allocator.h:7