- Win32 support for jpeg
- Win32 support for tiff
- base level error reporting code added, I still need to modify
- older code to use it
+ older code to use it
- fix translate=>'giflib' handling of single-colour images.
Previously a single colour image would cause an error in
MakeMapObject().
- minor doc fixes for transparent gifs
- make it less error-prone to write transparent gifs
- documented the options for reading raw images
- - Changes switched to use spaces for formatting
- - switch gif.c to new error reporting with related changes to
- Imager.xs, Imager.pm
+ - Changes switched to use spaces for formatting
+ - switch gif.c to new error reporting with related changes to
+ Imager.xs, Imager.pm
- each of the image formats now have their own test file,
extracted from t10formats.t, usually with som extra tests
- Added flip() and docs to Imager.pm and i_flipxy to image.c.
Added testcases too.
- - Fixed an overflow bug in png.c
- - added the colors parameter to Imager::read() which receives
- the arrayref of colours that i_readgif(_scalar) returns
- - fixed a problem in makemap_addi in quant.c where only the first
- image was compared against the palette when the palette was being
- refined. I screwed up on this originally (TC). This is the other
- half of a fix for Leolo's lmfixed problem <sigh>.
- - makemap_addi() now only puts colours into the palette that it
- found while optimizing the palette (so we don't get 256 colour
- palettes for 2 colour images :)
- - initial implementation of a row-based interface to low-level
- images (for performance)
- - changed Imager::read() for GIF so that the arrayref pointed to
- by the ref supplied in colors contains Imager::Color objects
- instead of more arrayrefs, keep this interface stable until we
- can make an informed choice about i_readgif()
- - incorporated Micksa's faxable tiff support, treating as a type
- of tiff rather than a separate format
- - t/t70newgif.t now checks for gif support
- - added the convert() method
+ - Fixed an overflow bug in png.c
+ - added the colors parameter to Imager::read() which receives
+ the arrayref of colours that i_readgif(_scalar) returns
+ - fixed a problem in makemap_addi in quant.c where only the first
+ image was compared against the palette when the palette was being
+ refined. I screwed up on this originally (TC). This is the other
+ half of a fix for Leolo's lmfixed problem <sigh>.
+ - makemap_addi() now only puts colours into the palette that it
+ found while optimizing the palette (so we don't get 256 colour
+ palettes for 2 colour images :)
+ - initial implementation of a row-based interface to low-level
+ images (for performance)
+ - changed Imager::read() for GIF so that the arrayref pointed to
+ by the ref supplied in colors contains Imager::Color objects
+ instead of more arrayrefs, keep this interface stable until we
+ can make an informed choice about i_readgif()
+ - incorporated Micksa's faxable tiff support, treating as a type
+ of tiff rather than a separate format
+ - t/t70newgif.t now checks for gif support
+ - added the convert() method
+ - Added support for transparent to alpha conversion during loading
+ of png files.
~~~~~~~~~~~~~^ ^ ^~~~~~~~~~~~~~
/*
-png_set_read_fn(png_structp read_ptr, voidp read_io_ptr, png_rw_ptr read_data_fn)
-png_set_write_fn(png_structp write_ptr, voidp write_io_ptr, png_rw_ptr write_data_fn,
-png_flush_ptr output_flush_fn);
-voidp read_io_ptr = png_get_io_ptr(read_ptr);
-voidp write_io_ptr = png_get_io_ptr(write_ptr);
+ png_set_read_fn(png_structp read_ptr, voidp read_io_ptr, png_rw_ptr read_data_fn)
+ png_set_write_fn(png_structp write_ptr, voidp write_io_ptr, png_rw_ptr write_data_fn,
+ png_flush_ptr output_flush_fn);
+ voidp read_io_ptr = png_get_io_ptr(read_ptr);
+ voidp write_io_ptr = png_get_io_ptr(write_ptr);
*/
struct png_scalar_info {
/*
static void
user_write_data(png_structp png_ptr, png_bytep data, png_uint_32 length) {
- FIXME: implement these
+FIXME: implement these
}
static void
CC2C[PNG_COLOR_TYPE_GRAY_ALPHA]=2;
channels=CC2C[color_type];
-
mm_log((1,"channels %d\n", channels));
- im = i_img_empty_ch(NULL, width, height, channels);
-
/**** Set up the data transformations you want. Note that these are all
**** optional. Only call them if you want/need them. Many of the
**** transformations only work on specific types of images, and many
/* Expand paletted or RGB images with transparency to full alpha channels
* so the data will be available as RGBA quartets.
- *
- * if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) png_set_expand(png_ptr);
- *
*/
+
+ if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
+ channels++;
+ mm_log((1, "image has transparency, adding alpha: channels = %d\n", channels));
+ png_set_expand(png_ptr);
+ }
/* Strip alpha bytes from the input data without combining with the
* background (not recommended).
*/
- if ( (color_type != PNG_COLOR_TYPE_RGB_ALPHA) && (color_type != PNG_COLOR_TYPE_GRAY_ALPHA) )
+ /*
+ if ( (color_type != PNG_COLOR_TYPE_RGB_ALPHA) && (color_type != PNG_COLOR_TYPE_GRAY_ALPHA) )
png_set_strip_alpha(png_ptr);
-
+ */
number_passes = png_set_interlace_handling(png_ptr);
mm_log((1,"number of passes=%d\n",number_passes));
png_read_update_info(png_ptr, info_ptr);
+ im = i_img_empty_ch(NULL, width, height, channels);
for (pass = 0; pass < number_passes; pass++)
for (y = 0; y < height; y++) {
png_read_row(png_ptr,(png_bytep) &(im->data[channels*width*y]), NULL);
}
/* read rest of file, and get additional chunks in info_ptr - REQUIRED */
-
+
png_read_end(png_ptr, info_ptr);
/* clean up after the read, and free any memory allocated - REQUIRED */
png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp)NULL);
png_set_packing(png_ptr);
if (color_type == PNG_COLOR_TYPE_PALETTE) png_set_expand(png_ptr);
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) png_set_expand(png_ptr);
- if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) png_set_expand(png_ptr);
+
+ if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) {
+ channels++;
+ mm_log((1, "image has transparency, adding alpha: channels = %d\n", channels));
+ png_set_expand(png_ptr);
+ }
+
number_passes = png_set_interlace_handling(png_ptr);
mm_log((1,"number of passes=%d\n",number_passes));
png_read_update_info(png_ptr, info_ptr);