From: Matthias Kramm Date: Tue, 15 Jun 2010 01:05:43 +0000 (-0700) Subject: renamed png functions X-Git-Url: http://git.asbjorn.it/?a=commitdiff_plain;ds=sidebyside;h=6f78b0ef3998e959ce09c5ef11d46149756b682b;p=swftools.git renamed png functions --- diff --git a/lib/devices/render.c b/lib/devices/render.c index 8586cfa..c1c803c 100644 --- a/lib/devices/render.c +++ b/lib/devices/render.c @@ -800,18 +800,18 @@ int render_result_save(gfxresult_t*r, const char*filename) 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; diff --git a/lib/gfximage.c b/lib/gfximage.c index 661f9cd..c1e694e 100644 --- a/lib/gfximage.c +++ b/lib/gfximage.c @@ -33,7 +33,7 @@ void gfximage_save_jpeg(gfximage_t*img, const char*filename, int quality) 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 { diff --git a/lib/gfxpoly/renderpoly.c b/lib/gfxpoly/renderpoly.c index 989dfc8..0edf5b1 100644 --- a/lib/gfxpoly/renderpoly.c +++ b/lib/gfxpoly/renderpoly.c @@ -395,6 +395,6 @@ void save_two_bitmaps(intbbox_t*b, unsigned char*data1, unsigned char*data2, cha } b1 += width8; } - writePNG(filename, data, b->width*2, b->height*2); + png_write(filename, data, b->width*2, b->height*2); free(data); } diff --git a/lib/h.263/swfvideo.c b/lib/h.263/swfvideo.c index 2ca6bde..d9e1803 100644 --- a/lib/h.263/swfvideo.c +++ b/lib/h.263/swfvideo.c @@ -1532,7 +1532,7 @@ int main(int argn, char*argv[]) 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)); diff --git a/lib/pdf/BitmapOutputDev.cc b/lib/pdf/BitmapOutputDev.cc index 6b16993..52aa798 100644 --- a/lib/pdf/BitmapOutputDev.cc +++ b/lib/pdf/BitmapOutputDev.cc @@ -350,7 +350,7 @@ void writeMonoBitmap(SplashBitmap*btm, char*filename) } } } - writePNG(filename, (unsigned char*)b, width, height); + png_write(filename, (unsigned char*)b, width, height); free(b); } @@ -379,7 +379,7 @@ void writeBitmap(SplashBitmap*bitmap, char*filename) line[x].a = bitmap->getAlpha(x,y); } } - writePNG(filename, (unsigned char*)data, width, height); + png_write(filename, (unsigned char*)data, width, height); free(data); } @@ -407,7 +407,7 @@ void writeAlpha(SplashBitmap*bitmap, char*filename) line[x].a = a; } } - writePNG(filename, (unsigned char*)data, width, height); + png_write(filename, (unsigned char*)data, width, height); free(data); } diff --git a/lib/pdf/GFXOutputDev.cc b/lib/pdf/GFXOutputDev.cc index ef2dde3..05c1b48 100644 --- a/lib/pdf/GFXOutputDev.cc +++ b/lib/pdf/GFXOutputDev.cc @@ -2854,7 +2854,7 @@ void GFXOutputDev::clearSoftMask(GfxState *state) 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); diff --git a/lib/png.c b/lib/png.c index 4aa4ddb..2a31537 100644 --- a/lib/png.c +++ b/lib/png.c @@ -441,7 +441,7 @@ void png_inverse_filter_32(int mode, unsigned char*src, unsigned char*old, unsig } } -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; @@ -459,7 +459,7 @@ EXPORT int getPNGdimensions(const char*sname, unsigned*destwidth, unsigned*desth 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; @@ -1523,7 +1523,7 @@ int png_apply_filter_32(unsigned char*dest, unsigned char*src, unsigned width, i 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; @@ -1689,11 +1689,11 @@ EXPORT void savePNG(const char*filename, unsigned char*data, unsigned width, uns 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); } diff --git a/lib/png.h b/lib/png.h index b97a85b..d0b3851 100644 --- a/lib/png.h +++ b/lib/png.h @@ -26,13 +26,13 @@ extern "C" { 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 } diff --git a/lib/python/tags.c b/lib/python/tags.c index 2cd47c9..ca49a25 100644 --- a/lib/python/tags.c +++ b/lib/python/tags.c @@ -637,7 +637,7 @@ static PyObject* image_save(PyObject*self, PyObject*args) 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; } diff --git a/lib/readers/image.c b/lib/readers/image.c index b8f9a35..a9f96e8 100644 --- a/lib/readers/image.c +++ b/lib/readers/image.c @@ -129,7 +129,7 @@ static gfxdocument_t*image_open(gfxsource_t*src, const char*filename) 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(" Couldn't load image %s", filename); return 0; diff --git a/lib/readers/swf.c b/lib/readers/swf.c index 598177e..bf95022 100644 --- a/lib/readers/swf.c +++ b/lib/readers/swf.c @@ -200,7 +200,7 @@ static gfximage_t* findimage(render_t*r, U16 id) /*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; diff --git a/src/png2swf.c b/src/png2swf.c index 83cc31d..c24d227 100644 --- a/src/png2swf.c +++ b/src/png2swf.c @@ -760,7 +760,7 @@ TAG *MovieAddFrame(SWF * swf, TAG * t, char *sname, int id) 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)) { @@ -775,7 +775,7 @@ TAG *MovieAddFrame(SWF * swf, TAG * t, char *sname, int id) #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); diff --git a/src/swfc.c b/src/swfc.c index 03a923a..e34f9fc 100644 --- a/src/swfc.c +++ b/src/swfc.c @@ -1493,7 +1493,7 @@ void s_image(const char*name, const char*type, const char*filename, int quality) 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); diff --git a/src/swfextract.c b/src/swfextract.c index c341f5f..ac0fe5a 100644 --- a/src/swfextract.c +++ b/src/swfextract.c @@ -757,7 +757,7 @@ int handlejpeg(TAG*tag) image[t*4+0] = data[t]; } free(data); - writePNG(filename, image, width, height); + png_write(filename, image, width, height); free(image); } else { diff --git a/src/swfrender.c b/src/swfrender.c index e9df12d..87a8b32 100644 --- a/src/swfrender.c +++ b/src/swfrender.c @@ -142,9 +142,9 @@ int main(int argn, char*argv[]) 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;