2016-03-19 06:57:51 +13:00
|
|
|
|
|
|
|
|
|
|
|
extern "C" {
|
|
|
|
|
|
|
|
#include "tnz4.h"
|
|
|
|
#include <memory.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
2016-04-15 17:11:23 +12:00
|
|
|
#ifndef _WIN32
|
2016-03-19 06:57:51 +13:00
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
void free_img(IMAGE *img) {
|
|
|
|
if (!img) return;
|
|
|
|
delete[] img->buffer;
|
|
|
|
delete img;
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
IMAGE *new_img() {
|
|
|
|
IMAGE *img = new IMAGE;
|
|
|
|
memset(img, 0, sizeof(IMAGE));
|
|
|
|
return img;
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
|
2016-06-15 18:43:10 +12:00
|
|
|
int allocate_pixmap(IMAGE *img, int w, int h) {
|
|
|
|
UCHAR *buf;
|
|
|
|
assert(img->type == TOONZRGB);
|
|
|
|
buf = new UCHAR[w * h * 4];
|
|
|
|
img->buffer = buf;
|
|
|
|
img->xSBsize = img->xsize = w;
|
|
|
|
img->ySBsize = img->ysize = h;
|
|
|
|
return TRUE;
|
2016-03-19 06:57:51 +13:00
|
|
|
}
|
|
|
|
}
|