13 #ifndef _CS237_IMAGE_HXX_
14 #define _CS237_IMAGE_HXX_
17 #error "c237-image.hxx should not be included directly"
64 : _nDims(0), _format(0), _type(0), _nBytes(0), _data(nullptr)
67 : _nDims(nd), _format(0), _type(0), _nBytes(0), _data(nullptr)
69 explicit image_base (uint32_t nd, GLenum fmt, GLenum ty,
size_t nPixels);
92 image1d (uint32_t wid, GLenum fmt, GLenum ty);
96 image1d (std::string
const &file);
99 GLsizei
width ()
const {
return this->_wid; }
108 bool write (
const char *file);
130 image2d (uint32_t wid, uint32_t ht, GLenum fmt, GLenum ty);
136 image2d (std::string
const &file,
bool flip =
true);
142 image2d (std::ifstream &inS,
bool flip =
true);
145 GLsizei
width ()
const {
return this->_wid; }
148 GLsizei
height ()
const {
return this->_ht; }
153 void texImage (GLenum target, GLuint texId);
163 bool write (
const char *file,
bool flip =
true);
173 bool write (std::ofstream &outS,
bool flip =
true);
uint32_t _nDims
the number of dimensions (1 or 2)
Definition: cs237-image.hxx:53
image1d(uint32_t wid, GLenum fmt, GLenum ty)
bool write(const char *file, bool flip=true)
unsigned int nChannels() const
the number of channels (1, 2, 3, or 4)
size_t _nBytes
size in bytes of image data
Definition: cs237-image.hxx:60
image2d(uint32_t wid, uint32_t ht, GLenum fmt, GLenum ty)
unsigned int format() const
Definition: cs237-image.hxx:33
GLenum _format
Definition: cs237-image.hxx:54
Definition: cs237-image.hxx:26
void texImage(GLenum target, GLuint texId)
GLenum _type
Definition: cs237-image.hxx:57
size_t nBytes() const
the total number of bytes of image data
Definition: cs237-image.hxx:47
Definition: cs237-image.hxx:78
image_base(uint32_t nd)
Definition: cs237-image.hxx:66
unsigned int nDims() const
the number of dimensions (1, 2, or 3)
Definition: cs237-image.hxx:29
void texImage(GLuint texId)
GLsizei height() const
return the height of the image
Definition: cs237-image.hxx:148
GLsizei width() const
return the width of the image
Definition: cs237-image.hxx:145
Definition: cs237-aabb.hxx:18
void * _data
the raw image data
Definition: cs237-image.hxx:61
GLsizei width() const
return the width of the image
Definition: cs237-image.hxx:99
image_base()
Definition: cs237-image.hxx:63
void * data() const
the data pointer
Definition: cs237-image.hxx:45
bool write(const char *file)
unsigned int type() const
Definition: cs237-image.hxx:43
Definition: cs237-image.hxx:115