Lines 53-58
const char NameLine[] = "wartool V" VERS
Link Here
|
53 |
#include <stdint.h> |
53 |
#include <stdint.h> |
54 |
#include <ctype.h> |
54 |
#include <ctype.h> |
55 |
#include <png.h> |
55 |
#include <png.h> |
|
|
56 |
#include <zlib.h> |
56 |
|
57 |
|
57 |
#if defined(_MSC_VER) || defined(WIN32) |
58 |
#if defined(_MSC_VER) || defined(WIN32) |
58 |
#include <windows.h> |
59 |
#include <windows.h> |
Lines 1849-1855
int SavePNG(const char* name, unsigned c
Link Here
|
1849 |
return 1; |
1850 |
return 1; |
1850 |
} |
1851 |
} |
1851 |
|
1852 |
|
1852 |
if (setjmp(png_ptr->jmpbuf)) { |
1853 |
if (setjmp(png_jmpbuf(png_ptr))) { |
1853 |
// FIXME: must free buffers!! |
1854 |
// FIXME: must free buffers!! |
1854 |
png_destroy_write_struct(&png_ptr, &info_ptr); |
1855 |
png_destroy_write_struct(&png_ptr, &info_ptr); |
1855 |
fclose(fp); |
1856 |
fclose(fp); |
Lines 1861-1874
int SavePNG(const char* name, unsigned c
Link Here
|
1861 |
png_set_compression_level(png_ptr, Z_BEST_COMPRESSION); |
1862 |
png_set_compression_level(png_ptr, Z_BEST_COMPRESSION); |
1862 |
|
1863 |
|
1863 |
// prepare the file information |
1864 |
// prepare the file information |
1864 |
info_ptr->width = w; |
1865 |
png_set_IHDR(png_ptr, info_ptr, w, h, 8, |
1865 |
info_ptr->height = h; |
1866 |
PNG_COLOR_TYPE_PALETTE, |
1866 |
info_ptr->bit_depth = 8; |
1867 |
PNG_INTERLACE_NONE, |
1867 |
info_ptr->color_type = PNG_COLOR_TYPE_PALETTE; |
1868 |
PNG_COMPRESSION_TYPE_BASE, |
1868 |
info_ptr->interlace_type = 0; |
1869 |
PNG_FILTER_TYPE_BASE); |
1869 |
info_ptr->valid |= PNG_INFO_PLTE; |
1870 |
png_set_PLTE(png_ptr, info_ptr, (png_colorp)pal, 256); |
1870 |
info_ptr->palette = (png_colorp)pal; |
|
|
1871 |
info_ptr->num_palette = 256; |
1872 |
|
1871 |
|
1873 |
if (transparent) { |
1872 |
if (transparent) { |
1874 |
unsigned char* p; |
1873 |
unsigned char* p; |