Initial commit: Final state of the master project
This commit is contained in:
33
Research/scene/PNG.cpp
Normal file
33
Research/scene/PNG.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user