#include <cs237-image.hxx>
Inherits cs237::__detail::image_base.
|
| image2d (uint32_t wid, uint32_t ht, GLenum fmt, GLenum ty) |
|
| image2d (std::string const &file, bool flip=true) |
|
| image2d (std::ifstream &inS, bool flip=true) |
|
GLsizei | width () const |
| return the width of the image More...
|
|
GLsizei | height () const |
| return the height of the image More...
|
|
void | texImage (GLenum target, GLuint texId) |
|
bool | write (const char *file, bool flip=true) |
|
bool | write (std::ofstream &outS, bool flip=true) |
|
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...
|
|
cs237::image2d::image2d |
( |
uint32_t |
wid, |
|
|
uint32_t |
ht, |
|
|
GLenum |
fmt, |
|
|
GLenum |
ty |
|
) |
| |
create and allocate space for an uninitialized image
- Parameters
-
wid | the width of the image |
ht | the height of the image |
fmt | the image format, which should be one of GL_RED, GL_RG, GL_RGB, GL_BGR GL_RGBA, or GL_BGRA. |
ty | the 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::image2d::image2d |
( |
std::string const & |
file, |
|
|
bool |
flip = true |
|
) |
| |
create and initialize an image from a PNG file.
- Parameters
-
file | the name of the PNG file |
flip | set to true if the image should be flipped vertically to match OpenGL texture coordinates (default true) |
cs237::image2d::image2d |
( |
std::ifstream & |
inS, |
|
|
bool |
flip = true |
|
) |
| |
create and initialize an image from a PNG-format input stream
- Parameters
-
inS | the input stream |
flip | set to true if the image should be flipped vertically to match OpenGL texture coordinates (default true) |
GLsizei cs237::image2d::height |
( |
| ) |
const |
|
inline |
return the height of the image
void cs237::image2d::texImage |
( |
GLenum |
target, |
|
|
GLuint |
texId |
|
) |
| |
Load the image into a 2D GL texture; this function also binds the current texture to texId
- Parameters
-
[in] | target | specifies the target texture. Must be GL_TEXTURE_2D or GL_TEXTURE_RECTANGLE |
[in] | texId | the GL texture ID for this image |
GLsizei cs237::image2d::width |
( |
| ) |
const |
|
inline |
return the width of the image
bool cs237::image2d::write |
( |
const char * |
file, |
|
|
bool |
flip = true |
|
) |
| |
write the texture to a file in PNG format
- Parameters
-
file | the name of the PNG file |
flip | set to true if the image should be flipped vertically to match standard image-file coordinates (default true) |
- Returns
- true if successful, false otherwise
Note that the type of the image must be either GL_UNSIGNED_BYTE, or GL_UNSIGNED_SHORT to write it as a PNG file.
bool cs237::image2d::write |
( |
std::ofstream & |
outS, |
|
|
bool |
flip = true |
|
) |
| |
write the texture to an output stream in PNG format
- Parameters
-
outS | the output stream to write the PNG image to |
flip | set to true if the image should be flipped vertically to match standard image-file coordinates (default true) |
- Returns
- true if successful, false otherwise
Note that the type of the image must be either GL_UNSIGNED_BYTE, or GL_UNSIGNED_SHORT to write it to an output stream.
The documentation for this class was generated from the following file: