CMSC23700 Common Code Library
Support code for CS23700 programming projects
cs237::image1d Class Reference

#include <cs237-image.hxx>

Inherits cs237::__detail::image_base.

Public Member Functions

 image1d (uint32_t wid, GLenum fmt, GLenum ty)
 
 image1d (std::string const &file)
 
GLsizei width () const
 return the width of the image More...
 
void texImage (GLuint texId)
 
bool write (const char *file)
 
- Public Member Functions inherited from cs237::__detail::image_base
unsigned int nDims () const
 the number of dimensions (1, 2, or 3) More...
 
unsigned int format () const
 
unsigned int type () const
 
void * data () const
 the data pointer More...
 
size_t nBytes () const
 the total number of bytes of image data More...
 
unsigned int nChannels () const
 the number of channels (1, 2, 3, or 4) More...
 

Additional Inherited Members

- Protected Member Functions inherited from cs237::__detail::image_base
 image_base ()
 
 image_base (uint32_t nd)
 
 image_base (uint32_t nd, GLenum fmt, GLenum ty, size_t nPixels)
 
virtual ~image_base ()
 
- Protected Attributes inherited from cs237::__detail::image_base
uint32_t _nDims
 the number of dimensions (1 or 2) More...
 
GLenum _format
 
GLenum _type
 
size_t _nBytes
 size in bytes of image data More...
 
void * _data
 the raw image data More...
 

Constructor & Destructor Documentation

cs237::image1d::image1d ( uint32_t  wid,
GLenum  fmt,
GLenum  ty 
)

create and allocate space for an uninitialized image

Parameters
widthe width of the image
fmtthe image format, which should be one of GL_RED, GL_RG, GL_RGB, GL_BGR GL_RGBA, or GL_BGRA.
tythe type of the elements, which should be one of GL_UNSIGNED_BYTE GL_UNSIGNED_BYTE, GL_BYTE, GL_UNSIGNED_SHORT, GL_SHORT, GL_UNSIGNED_INT, GL_INT, GL_FLOAT, GL_UNSIGNED_BYTE_3_3_2, GL_UNSIGNED_BYTE_2_3_3_REV, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_SHORT_5_6_5_REV, GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_SHORT_4_4_4_4_REV, GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_SHORT_1_5_5_5_REV, GL_UNSIGNED_INT_8_8_8_8, GL_UNSIGNED_INT_8_8_8_8_REV, GL_UNSIGNED_INT_10_10_10_2, or GL_UNSIGNED_INT_2_10_10_10_REV
cs237::image1d::image1d ( std::string const &  file)

create and initialize an image from a PNG file.

Parameters
filethe name of the PNG file

Member Function Documentation

void cs237::image1d::texImage ( GLuint  texId)

Load the image into a 1D GL texture; this function also binds the current texture to texId

Parameters
[in]texIdthe GL texture ID for this image
GLsizei cs237::image1d::width ( ) const
inline

return the width of the image

bool cs237::image1d::write ( const char *  file)

write the texture to a file in PNG format

Parameters
filethe name of the PNG file
Returns
true if successful, false otherwise

The documentation for this class was generated from the following file: