Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions
pngtrans.c File Reference
#include "png.h"

Go to the source code of this file.

Defines

#define PNG_INTERNAL

Functions

void PNGAPI png_set_bgr (png_structp png_ptr)
void PNGAPI png_set_swap (png_structp png_ptr)
int PNGAPI png_set_interlace_handling (png_structp png_ptr)
void png_do_swap (png_row_infop row_info, png_bytep row)
void png_do_bgr (png_row_infop row_info, png_bytep row)
png_voidp PNGAPI png_get_user_transform_ptr (png_structp png_ptr)

Define Documentation

Definition at line 11 of file pngtrans.c.


Function Documentation

void png_do_bgr ( png_row_infop  row_info,
png_bytep  row 
)

Definition at line 535 of file pngtrans.c.

{
   png_debug(1, "in png_do_bgr\n");
   if (
#if defined(PNG_USELESS_TESTS_SUPPORTED)
       row != NULL && row_info != NULL &&
#endif
       (row_info->color_type & PNG_COLOR_MASK_COLOR))
   {
      png_uint_32 row_width = row_info->width;
      if (row_info->bit_depth == 8)
      {
         if (row_info->color_type == PNG_COLOR_TYPE_RGB)
         {
            png_bytep rp;
            png_uint_32 i;

            for (i = 0, rp = row; i < row_width; i++, rp += 3)
            {
               png_byte save = *rp;
               *rp = *(rp + 2);
               *(rp + 2) = save;
            }
         }
         else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
         {
            png_bytep rp;
            png_uint_32 i;

            for (i = 0, rp = row; i < row_width; i++, rp += 4)
            {
               png_byte save = *rp;
               *rp = *(rp + 2);
               *(rp + 2) = save;
            }
         }
      }
      else if (row_info->bit_depth == 16)
      {
         if (row_info->color_type == PNG_COLOR_TYPE_RGB)
         {
            png_bytep rp;
            png_uint_32 i;

            for (i = 0, rp = row; i < row_width; i++, rp += 6)
            {
               png_byte save = *rp;
               *rp = *(rp + 4);
               *(rp + 4) = save;
               save = *(rp + 1);
               *(rp + 1) = *(rp + 5);
               *(rp + 5) = save;
            }
         }
         else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
         {
            png_bytep rp;
            png_uint_32 i;

            for (i = 0, rp = row; i < row_width; i++, rp += 8)
            {
               png_byte save = *rp;
               *rp = *(rp + 4);
               *(rp + 4) = save;
               save = *(rp + 1);
               *(rp + 1) = *(rp + 5);
               *(rp + 5) = save;
            }
         }
      }
   }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void png_do_swap ( png_row_infop  row_info,
png_bytep  row 
)

Definition at line 220 of file pngtrans.c.

{
   png_debug(1, "in png_do_swap\n");
   if (
#if defined(PNG_USELESS_TESTS_SUPPORTED)
       row != NULL && row_info != NULL &&
#endif
       row_info->bit_depth == 16)
   {
      png_bytep rp = row;
      png_uint_32 i;
      png_uint_32 istop= row_info->width * row_info->channels;

      for (i = 0; i < istop; i++, rp += 2)
      {
         png_byte t = *rp;
         *rp = *(rp + 1);
         *(rp + 1) = t;
      }
   }
}

Here is the caller graph for this function:

Definition at line 635 of file pngtrans.c.

{
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
   return ((png_voidp)png_ptr->user_transform_ptr);
#else
   if(png_ptr)
     return (NULL);
   return (NULL);
#endif
}

Definition at line 17 of file pngtrans.c.

{
   png_debug(1, "in png_set_bgr\n");
   png_ptr->transformations |= PNG_BGR;
}

Here is the caller graph for this function:

Definition at line 73 of file pngtrans.c.

{
   png_debug(1, "in png_set_interlace handling\n");
   if (png_ptr->interlaced)
   {
      png_ptr->transformations |= PNG_INTERLACE;
      return (7);
   }

   return (1);
}

Here is the caller graph for this function:

Definition at line 27 of file pngtrans.c.

{
   png_debug(1, "in png_set_swap\n");
   if (png_ptr->bit_depth == 16)
      png_ptr->transformations |= PNG_SWAP_BYTES;
}