tahoma2d/toonz/sources/image/compatibility/tnz4_cpp.cpp

40 lines
565 B
C++
Raw Normal View History

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
void free_img(IMAGE *img)
{
if (!img)
return;
delete[] img->buffer;
delete img;
}
IMAGE *new_img()
{
IMAGE *img = new IMAGE;
memset(img, 0, sizeof(IMAGE));
return img;
}
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;
}
}