You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

32 lines
788 B

#ifndef PNMPARSER_H
#define PNMPARSER_H
#include <string>
#include "../../../platform/tlsf.h"
// this structure expects RGBA
struct RGBAPNMObject {
std::string magicNum;
unsigned int width, height, maxColVal;
unsigned char * m_Ptr;
// fast allocation!
static void* operator new(size_t n){
void *mem = tlsf_malloc(n);
if (mem){
return mem;
}
throw std::bad_alloc {};
}
static void operator delete(void *p){
tlsf_free(p);
}
};
RGBAPNMObject * readPPM(const char* fileName);
void writePBM4(const char *filename, const RGBAPNMObject &data);
void writePGM5(const char *filename, const RGBAPNMObject &data);
void writePPM6(const char *filename, const RGBAPNMObject &data);
void writePPM8(const char *filename, const RGBAPNMObject &data);
#endif