亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? pngwutil.c

?? 一款最完整的工業組態軟源代碼
?? C
?? 第 1 頁 / 共 5 頁
字號:

/* pngwutil.c - utilities to write a PNG file
 *
 * libpng version 1.2.7 - September 12, 2004
 * For conditions of distribution and use, see copyright notice in png.h
 * Copyright (c) 1998-2004 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.)
 */

#define PNG_INTERNAL
#include "png.h"
#ifdef PNG_WRITE_SUPPORTED

/* Place a 32-bit number into a buffer in PNG byte order.  We work
 * with unsigned numbers for convenience, although one supported
 * ancillary chunk uses signed (two's complement) numbers.
 */
void /* PRIVATE */
png_save_uint_32(png_bytep buf, png_uint_32 i)
{
   buf[0] = (png_byte)((i >> 24) & 0xff);
   buf[1] = (png_byte)((i >> 16) & 0xff);
   buf[2] = (png_byte)((i >> 8) & 0xff);
   buf[3] = (png_byte)(i & 0xff);
}

#if defined(PNG_WRITE_pCAL_SUPPORTED) || defined(PNG_WRITE_oFFs_SUPPORTED)
/* The png_save_int_32 function assumes integers are stored in two's
 * complement format.  If this isn't the case, then this routine needs to
 * be modified to write data in two's complement format.
 */
void /* PRIVATE */
png_save_int_32(png_bytep buf, png_int_32 i)
{
   buf[0] = (png_byte)((i >> 24) & 0xff);
   buf[1] = (png_byte)((i >> 16) & 0xff);
   buf[2] = (png_byte)((i >> 8) & 0xff);
   buf[3] = (png_byte)(i & 0xff);
}
#endif

/* Place a 16-bit number into a buffer in PNG byte order.
 * The parameter is declared unsigned int, not png_uint_16,
 * just to avoid potential problems on pre-ANSI C compilers.
 */
void /* PRIVATE */
png_save_uint_16(png_bytep buf, unsigned int i)
{
   buf[0] = (png_byte)((i >> 8) & 0xff);
   buf[1] = (png_byte)(i & 0xff);
}

/* Write a PNG chunk all at once.  The type is an array of ASCII characters
 * representing the chunk name.  The array must be at least 4 bytes in
 * length, and does not need to be null terminated.  To be safe, pass the
 * pre-defined chunk names here, and if you need a new one, define it
 * where the others are defined.  The length is the length of the data.
 * All the data must be present.  If that is not possible, use the
 * png_write_chunk_start(), png_write_chunk_data(), and png_write_chunk_end()
 * functions instead.
 */
void PNGAPI
png_write_chunk(png_structp png_ptr, png_bytep chunk_name,
   png_bytep data, png_size_t length)
{
   png_write_chunk_start(png_ptr, chunk_name, (png_uint_32)length);
   png_write_chunk_data(png_ptr, data, length);
   png_write_chunk_end(png_ptr);
}

/* Write the start of a PNG chunk.  The type is the chunk type.
 * The total_length is the sum of the lengths of all the data you will be
 * passing in png_write_chunk_data().
 */
void PNGAPI
png_write_chunk_start(png_structp png_ptr, png_bytep chunk_name,
   png_uint_32 length)
{
   png_byte buf[4];
   png_debug2(0, "Writing %s chunk (%lu bytes)\n", chunk_name, length);

   /* write the length */
   png_save_uint_32(buf, length);
   png_write_data(png_ptr, buf, (png_size_t)4);

   /* write the chunk name */
   png_write_data(png_ptr, chunk_name, (png_size_t)4);
   /* reset the crc and run it over the chunk name */
   png_reset_crc(png_ptr);
   png_calculate_crc(png_ptr, chunk_name, (png_size_t)4);
}

/* Write the data of a PNG chunk started with png_write_chunk_start().
 * Note that multiple calls to this function are allowed, and that the
 * sum of the lengths from these calls *must* add up to the total_length
 * given to png_write_chunk_start().
 */
void PNGAPI
png_write_chunk_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
   /* write the data, and run the CRC over it */
   if (data != NULL && length > 0)
   {
      png_calculate_crc(png_ptr, data, length);
      png_write_data(png_ptr, data, length);
   }
}

/* Finish a chunk started with png_write_chunk_start(). */
void PNGAPI
png_write_chunk_end(png_structp png_ptr)
{
   png_byte buf[4];

   /* write the crc */
   png_save_uint_32(buf, png_ptr->crc);

   png_write_data(png_ptr, buf, (png_size_t)4);
}

/* Simple function to write the signature.  If we have already written
 * the magic bytes of the signature, or more likely, the PNG stream is
 * being embedded into another stream and doesn't need its own signature,
 * we should call png_set_sig_bytes() to tell libpng how many of the
 * bytes have already been written.
 */
void /* PRIVATE */
png_write_sig(png_structp png_ptr)
{
   png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
   /* write the rest of the 8 byte signature */
   png_write_data(png_ptr, &png_signature[png_ptr->sig_bytes],
      (png_size_t)8 - png_ptr->sig_bytes);
   if(png_ptr->sig_bytes < 3)
      png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE;
}

#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_iCCP_SUPPORTED)
/*
 * This pair of functions encapsulates the operation of (a) compressing a
 * text string, and (b) issuing it later as a series of chunk data writes.
 * The compression_state structure is shared context for these functions
 * set up by the caller in order to make the whole mess thread-safe.
 */

typedef struct
{
    char *input;   /* the uncompressed input data */
    int input_len;   /* its length */
    int num_output_ptr; /* number of output pointers used */
    int max_output_ptr; /* size of output_ptr */
    png_charpp output_ptr; /* array of pointers to output */
} compression_state;

/* compress given text into storage in the png_ptr structure */
static int /* PRIVATE */
png_text_compress(png_structp png_ptr,
        png_charp text, png_size_t text_len, int compression,
        compression_state *comp)
{
   int ret;

   comp->num_output_ptr = comp->max_output_ptr = 0;
   comp->output_ptr = NULL;
   comp->input = NULL;

   /* we may just want to pass the text right through */
   if (compression == PNG_TEXT_COMPRESSION_NONE)
   {
       comp->input = text;
       comp->input_len = text_len;
       return((int)text_len);
   }

   if (compression >= PNG_TEXT_COMPRESSION_LAST)
   {
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
      char msg[50];
      sprintf(msg, "Unknown compression type %d", compression);
      png_warning(png_ptr, msg);
#else
      png_warning(png_ptr, "Unknown compression type");
#endif
   }

   /* We can't write the chunk until we find out how much data we have,
    * which means we need to run the compressor first and save the
    * output.  This shouldn't be a problem, as the vast majority of
    * comments should be reasonable, but we will set up an array of
    * malloc'd pointers to be sure.
    *
    * If we knew the application was well behaved, we could simplify this
    * greatly by assuming we can always malloc an output buffer large
    * enough to hold the compressed text ((1001 * text_len / 1000) + 12)
    * and malloc this directly.  The only time this would be a bad idea is
    * if we can't malloc more than 64K and we have 64K of random input
    * data, or if the input string is incredibly large (although this
    * wouldn't cause a failure, just a slowdown due to swapping).
    */

   /* set up the compression buffers */
   png_ptr->zstream.avail_in = (uInt)text_len;
   png_ptr->zstream.next_in = (Bytef *)text;
   png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
   png_ptr->zstream.next_out = (Bytef *)png_ptr->zbuf;

   /* this is the same compression loop as in png_write_row() */
   do
   {
      /* compress the data */
      ret = deflate(&png_ptr->zstream, Z_NO_FLUSH);
      if (ret != Z_OK)
      {
         /* error */
         if (png_ptr->zstream.msg != NULL)
            png_error(png_ptr, png_ptr->zstream.msg);
         else
            png_error(png_ptr, "zlib error");
      }
      /* check to see if we need more room */
      if (!png_ptr->zstream.avail_out && png_ptr->zstream.avail_in)
      {
         /* make sure the output array has room */
         if (comp->num_output_ptr >= comp->max_output_ptr)
         {
            int old_max;

            old_max = comp->max_output_ptr;
            comp->max_output_ptr = comp->num_output_ptr + 4;
            if (comp->output_ptr != NULL)
            {
               png_charpp old_ptr;

               old_ptr = comp->output_ptr;
               comp->output_ptr = (png_charpp)png_malloc(png_ptr,
                  (png_uint_32)(comp->max_output_ptr *
                  png_sizeof (png_charpp)));
               png_memcpy(comp->output_ptr, old_ptr, old_max
                  * png_sizeof (png_charp));
               png_free(png_ptr, old_ptr);
            }
            else
               comp->output_ptr = (png_charpp)png_malloc(png_ptr,
                  (png_uint_32)(comp->max_output_ptr *
                  png_sizeof (png_charp)));
         }

         /* save the data */
         comp->output_ptr[comp->num_output_ptr] = (png_charp)png_malloc(png_ptr,
            (png_uint_32)png_ptr->zbuf_size);
         png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf,
            png_ptr->zbuf_size);
         comp->num_output_ptr++;

         /* and reset the buffer */
         png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
         png_ptr->zstream.next_out = png_ptr->zbuf;
      }
   /* continue until we don't have any more to compress */
   } while (png_ptr->zstream.avail_in);

   /* finish the compression */
   do
   {
      /* tell zlib we are finished */
      ret = deflate(&png_ptr->zstream, Z_FINISH);

      if (ret == Z_OK)
      {
         /* check to see if we need more room */
         if (!(png_ptr->zstream.avail_out))
         {
            /* check to make sure our output array has room */
            if (comp->num_output_ptr >= comp->max_output_ptr)
            {
               int old_max;

               old_max = comp->max_output_ptr;
               comp->max_output_ptr = comp->num_output_ptr + 4;
               if (comp->output_ptr != NULL)
               {
                  png_charpp old_ptr;

                  old_ptr = comp->output_ptr;
                  /* This could be optimized to realloc() */
                  comp->output_ptr = (png_charpp)png_malloc(png_ptr,
                     (png_uint_32)(comp->max_output_ptr *
                     png_sizeof (png_charpp)));
                  png_memcpy(comp->output_ptr, old_ptr,
                     old_max * png_sizeof (png_charp));
                  png_free(png_ptr, old_ptr);
               }
               else
                  comp->output_ptr = (png_charpp)png_malloc(png_ptr,
                     (png_uint_32)(comp->max_output_ptr *
                     png_sizeof (png_charp)));
            }

            /* save off the data */
            comp->output_ptr[comp->num_output_ptr] =
               (png_charp)png_malloc(png_ptr, (png_uint_32)png_ptr->zbuf_size);
            png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf,
               png_ptr->zbuf_size);
            comp->num_output_ptr++;

            /* and reset the buffer pointers */
            png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
            png_ptr->zstream.next_out = png_ptr->zbuf;
         }
      }
      else if (ret != Z_STREAM_END)
      {
         /* we got an error */
         if (png_ptr->zstream.msg != NULL)
            png_error(png_ptr, png_ptr->zstream.msg);
         else
            png_error(png_ptr, "zlib error");
      }
   } while (ret != Z_STREAM_END);

   /* text length is number of buffers plus last buffer */
   text_len = png_ptr->zbuf_size * comp->num_output_ptr;
   if (png_ptr->zstream.avail_out < png_ptr->zbuf_size)
      text_len += png_ptr->zbuf_size - (png_size_t)png_ptr->zstream.avail_out;

   return((int)text_len);
}

/* ship the compressed text out via chunk writes */
static void /* PRIVATE */
png_write_compressed_data_out(png_structp png_ptr, compression_state *comp)
{
   int i;

   /* handle the no-compression case */
   if (comp->input)
   {
       png_write_chunk_data(png_ptr, (png_bytep)comp->input,
                            (png_size_t)comp->input_len);
       return;
   }

   /* write saved output buffers, if any */
   for (i = 0; i < comp->num_output_ptr; i++)
   {
      png_write_chunk_data(png_ptr,(png_bytep)comp->output_ptr[i],
         png_ptr->zbuf_size);
      png_free(png_ptr, comp->output_ptr[i]);
      comp->output_ptr[i]=NULL;
   }
   if (comp->max_output_ptr != 0)
      png_free(png_ptr, comp->output_ptr);
      comp->output_ptr=NULL;
   /* write anything left in zbuf */
   if (png_ptr->zstream.avail_out < (png_uint_32)png_ptr->zbuf_size)
      png_write_chunk_data(png_ptr, png_ptr->zbuf,
         png_ptr->zbuf_size - png_ptr->zstream.avail_out);

   /* reset zlib for another zTXt/iTXt or the image data */
   deflateReset(&png_ptr->zstream);

}
#endif

/* Write the IHDR chunk, and update the png_struct with the necessary
 * information.  Note that the rest of this code depends upon this
 * information being correct.
 */
void /* PRIVATE */
png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
   int bit_depth, int color_type, int compression_type, int filter_type,
   int interlace_type)
{
#ifdef PNG_USE_LOCAL_ARRAYS
   PNG_IHDR;
#endif
   png_byte buf[13]; /* buffer to store the IHDR info */

   png_debug(1, "in png_write_IHDR\n");
   /* Check that we have valid input data from the application info */
   switch (color_type)
   {
      case PNG_COLOR_TYPE_GRAY:
         switch (bit_depth)
         {
            case 1:
            case 2:
            case 4:
            case 8:
            case 16: png_ptr->channels = 1; break;
            default: png_error(png_ptr,"Invalid bit depth for grayscale image");
         }
         break;
      case PNG_COLOR_TYPE_RGB:
         if (bit_depth != 8 && bit_depth != 16)
            png_error(png_ptr, "Invalid bit depth for RGB image");
         png_ptr->channels = 3;
         break;
      case PNG_COLOR_TYPE_PALETTE:
         switch (bit_depth)
         {
            case 1:
            case 2:
            case 4:
            case 8: png_ptr->channels = 1; break;
            default: png_error(png_ptr, "Invalid bit depth for paletted image");
         }
         break;
      case PNG_COLOR_TYPE_GRAY_ALPHA:
         if (bit_depth != 8 && bit_depth != 16)

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品在线观看入口| 国产成人日日夜夜| 亚洲美女免费在线| 亚洲欧美另类图片小说| 亚洲日本护士毛茸茸| 亚洲同性gay激情无套| 成人免费在线播放视频| 亚洲欧美综合另类在线卡通| 成人免费在线视频观看| 亚洲男人的天堂av| 久久久久久电影| 久久久久久久久久久久久久久99 | 国产精品久久影院| 国产精品久久久久婷婷二区次| 国产精品动漫网站| 精品久久久久99| 精品成人a区在线观看| 久久久久久久久久久99999| 欧美精品v日韩精品v韩国精品v| 91精品国产欧美一区二区| 91在线视频网址| 激情六月婷婷综合| 成人激情免费网站| 在线看日本不卡| 日韩视频免费观看高清在线视频| 日韩精品专区在线影院重磅| 国产亚洲成aⅴ人片在线观看| 国产精品久久三区| 亚洲狠狠丁香婷婷综合久久久| 香蕉久久一区二区不卡无毒影院 | 欧美日本在线一区| 欧美电视剧免费全集观看| 国产精品水嫩水嫩| 亚洲18色成人| 一区二区三区在线免费观看| 日韩电影在线观看一区| 亚洲第一福利视频在线| 热久久免费视频| 日韩精品乱码免费| 国内外成人在线视频| 97se亚洲国产综合自在线| 欧美精品久久99| 欧美日韩精品一区二区三区蜜桃| 7777精品久久久大香线蕉| 久久久久青草大香线综合精品| 一区二区三区四区在线| 美女mm1313爽爽久久久蜜臀| 日本亚洲免费观看| 青娱乐精品视频| 日本不卡123| 丁香五精品蜜臀久久久久99网站| 欧美在线观看视频一区二区 | 日本伊人色综合网| 99久久婷婷国产| 精品久久人人做人人爽| 亚洲精品国产精品乱码不99| 狠狠色综合色综合网络| 狠狠色丁香久久婷婷综合丁香| 一本色道综合亚洲| 91官网在线免费观看| 91黄色在线观看| 欧美又粗又大又爽| 国产午夜亚洲精品羞羞网站| 亚洲欧美怡红院| 国产又粗又猛又爽又黄91精品| 欧美视频一区在线| 亚洲欧洲99久久| 国产成人午夜精品影院观看视频 | 国产一区二区免费视频| 在线观看三级视频欧美| 欧美日韩国产高清一区二区 | 日韩主播视频在线| 91成人看片片| 亚洲欧洲成人精品av97| 午夜精品免费在线| 美腿丝袜亚洲综合| 欧美三级韩国三级日本三斤| 国产精品你懂的在线欣赏| 亚洲一区二区av在线| youjizz久久| 国产偷国产偷亚洲高清人白洁| 亚洲人快播电影网| 日韩经典一区二区| 欧美视频一二三区| 一区二区三区蜜桃网| 丁香婷婷综合激情五月色| 欧洲色大大久久| 91日韩一区二区三区| 在线一区二区三区四区五区| 在线精品视频一区二区三四| 国产精品久久久久久久久久免费看 | 久久精品欧美一区二区三区不卡 | 久久se这里有精品| 伊人色综合久久天天人手人婷| 一级女性全黄久久生活片免费| 视频一区免费在线观看| 精品午夜久久福利影院| 欧美一级二级三级蜜桃| 香蕉影视欧美成人| 欧美绝品在线观看成人午夜影视| 亚洲成人一区二区在线观看| 国内精品久久久久影院一蜜桃| 91一区一区三区| 精品久久久久99| 一区二区三区精密机械公司| 99久久婷婷国产精品综合| 成人免费在线播放视频| 99久久精品国产精品久久| 日韩精品一区二区三区视频| 亚洲欧美日韩成人高清在线一区| 91丨porny丨国产| 亚洲精品五月天| 欧美综合亚洲图片综合区| 欧美国产乱子伦| 久久疯狂做爰流白浆xx| 色香蕉成人二区免费| 亚洲综合在线第一页| 成人看片黄a免费看在线| 国产精品卡一卡二| av毛片久久久久**hd| 日韩欧美亚洲另类制服综合在线| 亚洲裸体在线观看| 欧美色图天堂网| 日韩成人午夜精品| 欧美午夜视频网站| 一区二区三区久久| 97久久精品人人爽人人爽蜜臀| 亚洲乱码国产乱码精品精98午夜| 韩国精品一区二区| 国产精品美女久久久久aⅴ国产馆 国产精品美女久久久久av爽李琼 国产精品美女久久久久高潮 | 成人三级伦理片| 一区二区三区成人| 国产成人综合在线观看| 欧美成人综合网站| 国产伦精一区二区三区| 日韩精品一区二| 成人性色生活片免费看爆迷你毛片| 日韩欧美久久久| 成人美女视频在线看| 亚洲成人你懂的| 国产婷婷色一区二区三区| 欧美中文字幕一区| 亚洲一级在线观看| 久久尤物电影视频在线观看| 99精品国产一区二区三区不卡| 亚洲123区在线观看| 欧美亚洲日本一区| 国内精品久久久久影院色| 日韩毛片视频在线看| 欧美一区二区在线免费观看| 日韩黄色免费网站| 91精品国产91久久久久久最新毛片 | 欧美一区二区啪啪| 日日噜噜夜夜狠狠视频欧美人| 久久久久久久久久电影| 欧美系列日韩一区| 天天射综合影视| 欧美片在线播放| 日韩在线一二三区| 欧美大白屁股肥臀xxxxxx| 秋霞电影网一区二区| 综合久久给合久久狠狠狠97色 | 天天综合天天综合色| 中文字幕av在线一区二区三区| 91麻豆精品国产91久久久使用方法 | 久久综合色婷婷| 欧美三级视频在线| 99久久伊人网影院| 国产美女久久久久| 国产精品每日更新在线播放网址| 在线不卡中文字幕| 91丝袜呻吟高潮美腿白嫩在线观看| 亚洲免费在线观看| 欧美视频一区二| 美女视频网站久久| 一区二区高清在线| 国产亚洲人成网站| 欧美一区二区三区四区高清| 欧洲一区二区三区免费视频| 国产91高潮流白浆在线麻豆| 亚洲图片欧美激情| 国产欧美一二三区| 欧洲一区在线观看| 色综合色综合色综合| 亚洲成va人在线观看| 中文字幕日韩一区| 国产精品天干天干在线综合| 在线观看免费亚洲| 人妖欧美一区二区| 亚洲mv在线观看| 亚洲国产日韩在线一区模特| 欧美精品日韩一本| 色嗨嗨av一区二区三区| 青青草精品视频| 天堂av在线一区| 首页国产欧美久久| 香蕉加勒比综合久久| 亚洲mv在线观看| 亚洲国产aⅴ成人精品无吗| 久久久天堂av|