blob: c45da15437ecfb9562492b35d8e34ab9786c133e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#include "../../include/mglpp/graphics/Image.hpp"
#include <string.h>
namespace mgl {
Image::Image() {
memset(&image, 0, sizeof(image));
}
Image::~Image() {
mgl_image_unload(&image);
}
bool Image::load_from_file(const std::string &filepath) {
if(image.data)
return false;
return mgl_image_load_from_file(&image, filepath.c_str()) == 0;
}
unsigned char* Image::data() {
return image.data;
}
size_t Image::get_byte_size() {
return mgl_image_get_size(&image);
}
vec2i Image::get_size() const {
return { image.width, image.height };
}
mgl_image* Image::internal_image() {
return ℑ
}
}
|