A class for manipulating imges.
More...
#include <Image.hpp>
|
MYGL_EXPORT | Image ()=default |
| Default constructor This constructor does not produce a valid Image.
|
|
MYGL_EXPORT | Image (const std::string &filename, bool flip=false, int desiredChannels=0) |
| Creates an Image from a file.
|
|
MYGL_EXPORT | Image (const uint8_t *data, size_t width, size_t height, int numberOfChannels, bool flip=false) |
| Loads an image from an array of pixels.
|
|
MYGL_EXPORT bool | load (const std::string &filename, bool flip=false, int desiredChannels=0) |
| Loads an image stored in a file.
|
|
MYGL_EXPORT bool | load (const uint8_t *data, size_t width, size_t height, int numberOfChannels, bool flip=false) |
| Loads an image from an array of pixels.
|
|
MYGL_EXPORT bool | isUsable () const noexcept |
| Tells whether the image is usable.
|
|
MYGL_EXPORT uint8_t * | data () const noexcept |
| Returns a pointer to the pixel array.
|
|
MYGL_EXPORT size_t | getWidth () const noexcept |
| Indicates the image's width.
|
|
MYGL_EXPORT size_t | getHeight () const noexcept |
| Indicates the image's height.
|
|
MYGL_EXPORT int | getChannels () const noexcept |
| Indicates the number of channels in the image.
|
|
A class for manipulating imges.
Definition at line 14 of file Image.hpp.
◆ Image() [1/2]
MYGL_EXPORT Image |
( |
const std::string & | filename, |
|
|
bool | flip = false, |
|
|
int | desiredChannels = 0 ) |
Creates an Image from a file.
- Parameters
-
filename | The image's filename |
flip | Indicates if the image should be vertically flipped (useful for OpenGL textures) |
desiredChannels | The number of channels the loaded image should have |
◆ Image() [2/2]
MYGL_EXPORT Image |
( |
const uint8_t * | data, |
|
|
size_t | width, |
|
|
size_t | height, |
|
|
int | numberOfChannels, |
|
|
bool | flip = false ) |
Loads an image from an array of pixels.
- Parameters
-
data | A pointer to the array of bytes |
width | The image's width |
height | The image's heigth |
numberOfChannels | The number of channels in the image |
flip | Indicates if the image should be vertically flipped |
◆ getChannels()
MYGL_EXPORT int getChannels |
( |
| ) |
const |
|
noexcept |
Indicates the number of channels in the image.
- Returns
- The number of channels
◆ getHeight()
MYGL_EXPORT size_t getHeight |
( |
| ) |
const |
|
noexcept |
Indicates the image's height.
- Returns
- The image's height
◆ getWidth()
MYGL_EXPORT size_t getWidth |
( |
| ) |
const |
|
noexcept |
Indicates the image's width.
- Returns
- The image's width
◆ isUsable()
MYGL_EXPORT bool isUsable |
( |
| ) |
const |
|
noexcept |
Tells whether the image is usable.
- Returns
- true if the image can be used
◆ load() [1/2]
MYGL_EXPORT bool load |
( |
const std::string & | filename, |
|
|
bool | flip = false, |
|
|
int | desiredChannels = 0 ) |
Loads an image stored in a file.
- Parameters
-
filename | The image's filename |
flip | Indicates if the image should be vertically flipped (useful for OpenGL textures) |
desiredChannels | The number of channels the loaded image should have |
- Returns
- true if the image was successfully loaded, false otherwise
◆ load() [2/2]
MYGL_EXPORT bool load |
( |
const uint8_t * | data, |
|
|
size_t | width, |
|
|
size_t | height, |
|
|
int | numberOfChannels, |
|
|
bool | flip = false ) |
Loads an image from an array of pixels.
- Parameters
-
data | A pointer to the array of bytes |
width | The image's width |
height | The image's heigth |
numberOfChannels | The number of channels in the image |
flip | Indicates if the image should be vertically flipped |
- Returns
- true if the image was successfully loaded, false otherwise
The documentation for this class was generated from the following file: