while(i->next) {
sprintf(filenamebuf, "%s.%d.png", origname, nr);
if(!i->palette) {
- writePNG(filename, (unsigned char*)i->img.data, i->img.width, i->img.height);
+ png_write(filename, (unsigned char*)i->img.data, i->img.width, i->img.height);
} else {
- writePalettePNG(filename, (unsigned char*)i->img.data, i->img.width, i->img.height);
+ png_write_palette_based_2(filename, (unsigned char*)i->img.data, i->img.width, i->img.height);
}
nr++;
}
free(origname);
} else {
if(!i->palette) {
- writePNG(filename, (unsigned char*)i->img.data, i->img.width, i->img.height);
+ png_write(filename, (unsigned char*)i->img.data, i->img.width, i->img.height);
} else {
- writePalettePNG(filename, (unsigned char*)i->img.data, i->img.width, i->img.height);
+ png_write_palette_based_2(filename, (unsigned char*)i->img.data, i->img.width, i->img.height);
}
}
return 1;
void gfximage_save_png(gfximage_t*image, const char*filename)
{
- writePNG(filename, (void*)image->data, image->width, image->height);
+ png_write(filename, (void*)image->data, image->width, image->height);
}
typedef struct scale_lookup {
}
b1 += width8;
}
- writePNG(filename, data, b->width*2, b->height*2);
+ png_write(filename, data, b->width*2, b->height*2);
free(data);
}
memset(&stream, 0, sizeof(stream));
- getPNG(fname, &width, &height, &data);
+ png_load(fname, &width, &height, &data);
pic = (RGBA*)rfx_alloc(width*height*sizeof(RGBA));
pic2 = (RGBA*)rfx_alloc(width*height*sizeof(RGBA));
memcpy(pic, data, width*height*sizeof(RGBA));
}
}
}
- writePNG(filename, (unsigned char*)b, width, height);
+ png_write(filename, (unsigned char*)b, width, height);
free(b);
}
line[x].a = bitmap->getAlpha(x,y);
}
}
- writePNG(filename, (unsigned char*)data, width, height);
+ png_write(filename, (unsigned char*)data, width, height);
free(data);
}
line[x].a = a;
}
}
- writePNG(filename, (unsigned char*)data, width, height);
+ png_write(filename, (unsigned char*)data, width, height);
free(data);
}
belowrender.endpage(&belowrender);
gfxresult_t* belowresult = belowrender.finish(&belowrender);
gfximage_t* belowimg = (gfximage_t*)belowresult->get(belowresult,"page0");
- //writePNG("below.png", (unsigned char*)belowimg->data, belowimg->width, belowimg->height);
+ //png_write("below.png", (unsigned char*)belowimg->data, belowimg->width, belowimg->height);
gfxdevice_t maskrender;
gfxdevice_render_init(&maskrender);
}
}
-EXPORT int getPNGdimensions(const char*sname, unsigned*destwidth, unsigned*destheight)
+EXPORT int png_getdimensions(const char*sname, unsigned*destwidth, unsigned*destheight)
{
FILE*fi;
struct png_header header;
return 1;
}
-EXPORT int getPNG(const char*sname, unsigned*destwidth, unsigned*destheight, unsigned char**destdata)
+EXPORT int png_load(const char*sname, unsigned*destwidth, unsigned*destheight, unsigned char**destdata)
{
char tagid[4];
int len;
return png_apply_filter(dest, src, width, y, 32);
}
-EXPORT void savePNG(const char*filename, unsigned char*data, unsigned width, unsigned height, int numcolors)
+EXPORT void png_write_palette_based(const char*filename, unsigned char*data, unsigned width, unsigned height, int numcolors)
{
FILE*fi;
int crc;
fclose(fi);
}
-EXPORT void writePNG(const char*filename, unsigned char*data, unsigned width, unsigned height)
+EXPORT void png_write(const char*filename, unsigned char*data, unsigned width, unsigned height)
{
- savePNG(filename, data, width, height, 0);
+ png_write_palette_based(filename, data, width, height, 0);
}
-EXPORT void writePalettePNG(const char*filename, unsigned char*data, unsigned width, unsigned height)
+EXPORT void png_write_palette_based_2(const char*filename, unsigned char*data, unsigned width, unsigned height)
{
- savePNG(filename, data, width, height, 256);
+ png_write_palette_based(filename, data, width, height, 256);
}
int png_apply_filter_32(unsigned char*dest, unsigned char*src, unsigned width, int y);
void png_inverse_filter_32(int mode, unsigned char*src, unsigned char*old, unsigned char*dest, unsigned width);
-int getPNG(const char*sname, unsigned*destwidth, unsigned*destheight, unsigned char**destdata);
-int getPNGdimensions(const char*sname, unsigned*destwidth, unsigned*destheight);
+int png_load(const char*sname, unsigned*destwidth, unsigned*destheight, unsigned char**destdata);
+int png_getdimensions(const char*sname, unsigned*destwidth, unsigned*destheight);
-void savePNG(const char*filename, unsigned char*data, unsigned width, unsigned height, int numcolors);
+void png_write_palette_based(const char*filename, unsigned char*data, unsigned width, unsigned height, int numcolors);
-void writePNG(const char*filename, unsigned char*data, unsigned width, unsigned height);
-void writePalettePNG(const char*filename, unsigned char*data, unsigned width, unsigned height);
+void png_write(const char*filename, unsigned char*data, unsigned width, unsigned height);
+void png_write_palette_based_2(const char*filename, unsigned char*data, unsigned width, unsigned height);
#ifdef __cplusplus
}
if(!PyArg_ParseTuple(args, "s", &filename))
return NULL;
- writePNG(filename, (unsigned char*)fi->rgba ,fi->width, fi->height);
+ png_write(filename, (unsigned char*)fi->rgba ,fi->width, fi->height);
return PY_NONE;
}
unsigned width = 0;
unsigned height = 0;
- if(!getPNG(filename, &width, &height, (unsigned char**)&data)) {
+ if(!png_load(filename, &width, &height, (unsigned char**)&data)) {
if(!jpeg_load(filename, (unsigned char**)&data, &width, &height)) {
msg("<error> Couldn't load image %s", filename);
return 0;
/*char filename[80];
sprintf(filename, "bitmap%d.png", id);
- writePNG(filename, (unsigned char*)img->data, img->width, img->height);
+ png_write(filename, (unsigned char*)img->data, img->width, img->height);
printf("saving bitmap %d to %s\n", id, filename);*/
return c->data;
if(global.mkjpeg) {
#ifdef HAVE_JPEGLIB
RGBA*data = 0;
- getPNG(sname, &width, &height, (unsigned char**)&data);
+ png_load(sname, &width, &height, (unsigned char**)&data);
if(!data)
exit(1);
if(swf_ImageHasAlpha(data, width, height)) {
#endif
} else if(1) {
RGBA*data = 0;
- getPNG(sname, &width, &height, (unsigned char**)&data);
+ png_load(sname, &width, &height, (unsigned char**)&data);
if(!data)
exit(1);
t = swf_InsertTag(t, ST_DEFINEBITSLOSSLESS);
RGBA*data = 0;
swf_SetU16(tag, imageID);
- getPNG(filename, &width, &height, (unsigned char**)&data);
+ png_load(filename, &width, &height, (unsigned char**)&data);
if(!data) {
syntaxerror("Image \"%s\" not found, or contains errors", filename);
image[t*4+0] = data[t];
}
free(data);
- writePNG(filename, image, width, height);
+ png_write(filename, image, width, height);
free(image);
}
else {
swf_RenderSWF(&buf, &swf);
RGBA* img = swf_Render(&buf);
if(quantize)
- writePalettePNG(outputname, (unsigned char*)img, buf.width, buf.height);
+ png_write_palette_based_2(outputname, (unsigned char*)img, buf.width, buf.height);
else
- writePNG(outputname, (unsigned char*)img, buf.width, buf.height);
+ png_write(outputname, (unsigned char*)img, buf.width, buf.height);
swf_Render_Delete(&buf);
} else {
parameter_t*p;