33 lines
469 B
C++
33 lines
469 B
C++
#include "../inc/lodepng/lodepng.h"
|
|
#include "PNG.h"
|
|
|
|
PNG::PNG(const char* png_file_path) {
|
|
|
|
mWidth = 0;
|
|
mHeight = 0;
|
|
|
|
unsigned error = lodepng::decode(mImage, mWidth, mHeight, png_file_path);
|
|
|
|
if (error)
|
|
lodepng_error_text(error);
|
|
}
|
|
|
|
PNG::~PNG() {
|
|
mImage.clear();
|
|
}
|
|
|
|
bool PNG::Initialized() {
|
|
return mWidth > 0 && mHeight > 0;
|
|
}
|
|
|
|
unsigned char* PNG::Data() {
|
|
return &mImage[0];
|
|
}
|
|
|
|
unsigned PNG::W() {
|
|
return mWidth;
|
|
}
|
|
|
|
unsigned PNG::H() {
|
|
return mHeight;
|
|
} |