diff -ur ruby-libpng-0.3.4a.orig/libpng.h ruby-libpng-0.3.4-q1/libpng.h --- ruby-libpng-0.3.4a.orig/libpng.h Mon Nov 13 15:58:50 2000 +++ ruby-libpng-0.3.4-q1/libpng.h Sat Dec 1 14:54:58 2001 @@ -74,3 +74,21 @@ extern VALUE libpng_sPLT_entry_new2(png_sPLT_entryp); extern VALUE libpng_text_new2(png_textp); extern VALUE libpng_unknown_chunk_new2(png_unknown_chunkp); + +void Init_color(); +void Init_sPLT(); +void Init_text(); +void Init_unknown_chunk(); +void Init_row_info(); +void Init_get_info(); +void Init_set_info(); +void Init_accessor(); +void Init_reader(); +void Init_writer(); +void libpng_color_check_type(VALUE obj); +void libpng_color_8_check_type(VALUE obj); +void libpng_color_16_check_type(VALUE obj); +void libpng_text_check_type(VALUE obj); +void libpng_unknown_chunk_check_type(VALUE obj); +void libpng_sPLT_entry_check_type(VALUE obj); +void time_check_type(VALUE x); diff -ur ruby-libpng-0.3.4a.orig/sample/pngcat.rb ruby-libpng-0.3.4-q1/sample/pngcat.rb --- ruby-libpng-0.3.4a.orig/sample/pngcat.rb Mon Nov 13 15:58:50 2000 +++ ruby-libpng-0.3.4-q1/sample/pngcat.rb Sat Nov 18 22:10:28 2000 @@ -11,21 +11,21 @@ STDERR.print "PNG image writer created (write to STDOUT).\n" if $run_self - for i in 0..3 - in_name[i] = number[i].chr + ".png" + i = 0 + number.to_s.each_byte {|d| + in_name[i] = d.chr + ".png" f = File.open(in_name[i]) f.binmode rpng[i] = Reader.new f STDERR.print "PNG image reader created (for #{in_name[i]}).\n" if $run_self - end - + i += 1 + } width, height, bit_depth, color_type, interlace_type, compression_type, filter_type = rpng[0].get_IHDR STDERR.print "Original width: #{width}\n" if $run_self - width *= number.to_s.size STDERR.print "Catenated width: #{width}\n" if $run_self @@ -51,9 +51,11 @@ in_images = [] - for i in 0..3 + i = 0 + while i < number.to_s.length in_images[i] = rpng[i].read_image STDERR.print "Reading image data from #{in_name[i]}\n" if $run_self + i += 1 end @@ -62,8 +64,12 @@ STDERR.print "Horizontal catenate: #{in_name[0]}+#{in_name[1]}+#{in_name[2]}+#{in_name[3]}\n" if $run_self for i in 0..in_images[0].size-1 - out_image[i] = in_images[0][i] + in_images[1][i] + - in_images[2][i] + in_images[3][i] + out_image[i] = in_images[0][i] + j = 1 + while j < in_images.length + out_image[i] += in_images[j][i] + j += 1 + end end STDERR.print "Catenated done.\n" if $run_self Only in ruby-libpng-0.3.4-q1/sample: pngcat.rb.1~ diff -ur ruby-libpng-0.3.4a.orig/writer.c ruby-libpng-0.3.4-q1/writer.c --- ruby-libpng-0.3.4a.orig/writer.c Mon Nov 13 15:58:50 2000 +++ ruby-libpng-0.3.4-q1/writer.c Sat Dec 1 14:35:46 2001 @@ -462,9 +462,9 @@ height = RARRAY(image)->len; for (row=0; rowptr[row])->len); - png_memcpy(image_data[row], STR2CSTR(RARRAY(image)->ptr[row]), - RSTRING(RARRAY(image)->ptr[row])->len); + struct RString* str = RSTRING(RARRAY(image)->ptr[row]); + image_data[row] = ALLOC_N(png_byte, str->len); + png_memcpy(image_data[row], str->ptr, str->len); } png_write_image(png_obj->obj, image_data);