/* pngwtran.c - transforms the data in a row for PNG writers * * Copyright (c) 2018 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer * and license in png.h */ #include "pngpriv.h" #ifdef PNG_WRITE_SUPPORTED #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED #ifdef PNG_WRITE_PACK_SUPPORTED /* Pack pixels into bytes. Pass the true bit depth in bit_depth. The * row_info bit depth should be 8 (one pixel per byte). The channels * should be 1 (this only happens on grayscale and paletted images). */ static void png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth) { … } #endif #ifdef PNG_WRITE_SHIFT_SUPPORTED /* Shift pixel values to take advantage of whole range. Pass the * true number of bits in bit_depth. The row should be packed * according to row_info->bit_depth. Thus, if you had a row of * bit depth 4, but the pixels only had values from 0 to 7, you * would pass 3 as bit_depth, and this routine would translate the * data to 0 to 15. */ 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) { … } #endif /* Transform the data according to the user's wishes. The order of * transformations is significant. */ void /* PRIVATE */ png_do_write_transformations(png_structrp png_ptr, png_row_infop row_info) { … } #endif /* WRITE_TRANSFORMS */ #endif /* WRITE */