From 7b7cd6da61b1fcc0f2a3ecce2cb9e6c42782c717 Mon Sep 17 00:00:00 2001 From: Henning Makholm Date: Fri, 27 Jan 2006 18:00:00 -0500 Subject: Import of release 0.7 --- (limited to 'test/source/mkbase.i') diff --git a/test/source/mkbase.i b/test/source/mkbase.i new file mode 100644 index 0000000..ec408ef --- /dev/null +++ b/test/source/mkbase.i @@ -0,0 +1,60 @@ +/* -*- C -*- + * This program is written by Henning Makholm, and is in the + * public domain. + */ + +#include +#include +#include + +static void +error(png_structp png_ptr, png_const_charp errormsg) +{ + fprintf(stderr,"PNG error: %s\n",errormsg); + exit(1); +} + + +int +main(void) +{ + png_structp libpng = NULL ; + png_infop libpng2 = NULL ; + unsigned char row[TEST_IMAGE_WIDTH*4] ; + unsigned x,y ; + int r,g,b,a ; + + libpng = png_create_write_struct(PNG_LIBPNG_VER_STRING, + png_voidp_NULL, + error, + png_error_ptr_NULL); + if( !libpng ) + error(libpng,"Couldn't initialize libpng library"); + + libpng2 = png_create_info_struct(libpng); + if( !libpng2 ) + error(libpng,"Couldn't create PNG info structure"); + + png_init_io(libpng,stdout); + + png_set_IHDR(libpng,libpng2,TEST_IMAGE_WIDTH,TEST_IMAGE_HEIGHT, + 8, PNG_COLOR_TYPE_RGB_ALPHA, + PNG_INTERLACE_NONE, + PNG_COMPRESSION_TYPE_DEFAULT, + PNG_FILTER_TYPE_DEFAULT); + + png_write_info(libpng,libpng2); + + for( y=0; y