www.pudn.com > transparentdib.zip
To Read all the content
[file head]:
/* pngrtran.c - transforms the data in a row for PNG readers
*
* libpng 1.0.12 - June 8, 2001
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2001 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* This file contains functions optionally called by an application
* in order to tell libpng how to handle data when reading a PNG.
* Transformations that are used in both reading and writing are
* in pngtrans.c.
*/
#define PNG_INTERNAL
#include "png.h"
/* Set the action on getting a CRC error for an ancillary or critical chunk. */
void PNGAPI
png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action)
{
png_debug(1, "in png_set_crc_action\n");
/* Tell libpng how we react to CRC errors in critical chunks */
switch (crit_action)
{
case PNG_CRC_NO_CHANGE:
... ...
[file tail]:
... ...
byte)((256 + *(rp+2) + *(rp+1))&amt;0xff);
}
}
else if (row_info->bit_depth == 16)
{
png_bytep rp;
png_uint_32 i;
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
bytes_per_pixel = 6;
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
bytes_per_pixel = 8;
else
return;
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
{
png_uint_32 s0=*(rp )<<8 | *(rp+1);
png_uint_32 s1=*(rp+2)<<8 | *(rp+3);
png_uint_32 s2=*(rp+4)<<8 | *(rp+5);
png_uint_32 red=(65536+s0+s1)&amt;0xffff;
png_uint_32 blue=(65536+s2+s1)&amt;0xffff;
*(rp ) = (png_byte)((red>>8)&amt;0xff);
*(rp+1) = (png_byte)(red&amt;0xff);
*(rp+4) = (png_byte)((blue>>8)&amt;0xff);
*(rp+5) = (png_byte)(blue&amt;0xff);
}
}
}
}
#endif /* PNG_MNG_FEATURES_SUPPORTED */