#include "pngpriv.h"
#ifdef PNG_WRITE_SUPPORTED
#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
#ifdef PNG_WRITE_PACK_SUPPORTED
static void
png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
{ … }
#endif
#ifdef PNG_WRITE_SHIFT_SUPPORTED
static void
png_do_shift(png_row_infop row_info, png_bytep row,
png_const_color_8p bit_depth)
{ … }
#endif
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
static void
png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
{ … }
#endif
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
static void
png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_write_invert_alpha");
{
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
{
if (row_info->bit_depth == 8)
{
png_bytep sp, dp;
png_uint_32 i;
png_uint_32 row_width = row_info->width;
for (i = 0, sp = dp = row; i < row_width; i++)
{
sp+=3; dp = sp;
*dp = (png_byte)(255 - *(sp++));
}
}
#ifdef PNG_WRITE_16BIT_SUPPORTED
else
{
png_bytep sp, dp;
png_uint_32 i;
png_uint_32 row_width = row_info->width;
for (i = 0, sp = dp = row; i < row_width; i++)
{
sp+=6; dp = sp;
*(dp++) = (png_byte)(255 - *(sp++));
*dp = (png_byte)(255 - *(sp++));
}
}
#endif
}
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
{
if (row_info->bit_depth == 8)
{
png_bytep sp, dp;
png_uint_32 i;
png_uint_32 row_width = row_info->width;
for (i = 0, sp = dp = row; i < row_width; i++)
{
*(dp++) = *(sp++);
*(dp++) = (png_byte)(255 - *(sp++));
}
}
#ifdef PNG_WRITE_16BIT_SUPPORTED
else
{
png_bytep sp, dp;
png_uint_32 i;
png_uint_32 row_width = row_info->width;
for (i = 0, sp = dp = row; i < row_width; i++)
{
sp+=2; dp = sp;
*(dp++) = (png_byte)(255 - *(sp++));
*dp = (png_byte)(255 - *(sp++));
}
}
#endif
}
}
}
#endif
void
png_do_write_transformations(png_structrp png_ptr, png_row_infop row_info)
{ … }
#endif
#endif