renamed png functions
authorMatthias Kramm <kramm@quiss.org>
Tue, 15 Jun 2010 01:05:43 +0000 (18:05 -0700)
committerMatthias Kramm <kramm@quiss.org>
Tue, 15 Jun 2010 01:05:43 +0000 (18:05 -0700)
15 files changed:
lib/devices/render.c
lib/gfximage.c
lib/gfxpoly/renderpoly.c
lib/h.263/swfvideo.c
lib/pdf/BitmapOutputDev.cc
lib/pdf/GFXOutputDev.cc
lib/png.c
lib/png.h
lib/python/tags.c
lib/readers/image.c
lib/readers/swf.c
src/png2swf.c
src/swfc.c
src/swfextract.c
src/swfrender.c

index 8586cfa..c1c803c 100644 (file)
@@ -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;
index 661f9cd..c1e694e 100644 (file)
@@ -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 {
index 989dfc8..0edf5b1 100644 (file)
@@ -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);
 }
index 2ca6bde..d9e1803 100644 (file)
@@ -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));
index 6b16993..52aa798 100644 (file)
@@ -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);
 }
 
index ef2dde3..05c1b48 100644 (file)
@@ -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);
index 4aa4ddb..2a31537 100644 (file)
--- 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);
 }
index b97a85b..d0b3851 100644 (file)
--- 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
 }
index 2cd47c9..ca49a25 100644 (file)
@@ -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;
 }
index b8f9a35..a9f96e8 100644 (file)
@@ -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("<error> Couldn't load image %s", filename);
            return 0;
index 598177e..bf95022 100644 (file)
@@ -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;
index 83cc31d..c24d227 100644 (file)
@@ -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);
index 03a923a..e34f9fc 100644 (file)
@@ -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);
index c341f5f..ac0fe5a 100644 (file)
@@ -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 {
index e9df12d..87a8b32 100644 (file)
@@ -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;