pngdump: image quantization, first attempt at shademap generation
[gbajam21] / tools / pngdump / image.h
index 7a42fba..d5aaccf 100644 (file)
@@ -9,7 +9,8 @@ struct image {
        int width, height;
        int bpp;
        int nchan;
-       int scansz, pitch;
+       int scansz;     /* scanline size in bytes */
+       int pitch;      /* bytes from one scanline to the next */
        int cmap_ncolors;
        struct cmapent cmap[256];
        unsigned char *pixels;
@@ -24,4 +25,12 @@ int cmp_image(struct image *a, struct image *b);
 void blit(struct image *src, int sx, int sy, int w, int h, struct image *dst, int dx, int dy);
 void overlay_key(struct image *src, unsigned int key, struct image *dst);
 
+unsigned int get_pixel(struct image *img, int x, int y);
+unsigned int get_pixel_rgb(struct image *img, int x, int y, unsigned int *rgb);
+void put_pixel(struct image *img, int x, int y, unsigned int pix);
+
+void quantize_image(struct image *img, int maxcol);
+int gen_shade_lut(struct image *img, int levels, int maxcol, struct cmapent *shade_cmap,
+               int *shade_lut);
+
 #endif /* IMAGE_H_ */