亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
欧美亚洲自拍偷拍| 国产v综合v亚洲欧| 久久九九久久九九| 日韩一区二区三区在线观看| 亚洲sss视频在线视频| 欧美精品自拍偷拍| 美女脱光内衣内裤视频久久网站| 精品国精品自拍自在线| 国产裸体歌舞团一区二区| 国产免费观看久久| 91黄色激情网站| 欧美aa在线视频| 亚洲国产高清在线| 欧美日韩视频在线一区二区| 九色porny丨国产精品| 国产精品免费av| 欧美日韩你懂得| 国产另类ts人妖一区二区| 国产精品天干天干在观线| 欧美午夜精品理论片a级按摩| 麻豆精品视频在线观看| 中文字幕亚洲不卡| 欧美一卡二卡三卡| 92国产精品观看| 欧美亚洲综合久久| 免费看精品久久片| 国产精品久久精品日日| 在线观看91av| 成人高清免费观看| 麻豆精品一二三| 一区二区在线免费观看| 久久亚洲综合色一区二区三区| 91久久精品一区二区| 国内精品国产成人| 五月婷婷综合网| 国产精品情趣视频| 精品久久久久久久久久久院品网| 色婷婷亚洲一区二区三区| 免费高清视频精品| 亚洲综合免费观看高清在线观看| 精品国产乱码久久久久久老虎| 91看片淫黄大片一级| 国产在线看一区| 亚洲v精品v日韩v欧美v专区| 国产精品国产三级国产aⅴ原创| 日韩你懂的在线播放| 欧美伊人精品成人久久综合97| 国产成人aaaa| 国产资源在线一区| 麻豆国产一区二区| 日本女人一区二区三区| 中文字幕一区在线观看| 久久免费看少妇高潮| 91麻豆精品国产91久久久资源速度| 91亚洲男人天堂| 成人黄色av电影| 丁香一区二区三区| 国产一区二区视频在线| 青娱乐精品视频| 亚洲成av人综合在线观看| 亚洲欧美一区二区在线观看| 国产欧美一区二区三区沐欲| 久久综合九色综合欧美亚洲| 日韩欧美亚洲一区二区| 777色狠狠一区二区三区| 欧美日韩精品欧美日韩精品 | 国产精品中文有码| 奇米影视7777精品一区二区| 五月综合激情日本mⅴ| 五月开心婷婷久久| 午夜伦理一区二区| 日韩不卡免费视频| 日韩av中文在线观看| 日本特黄久久久高潮| 人人超碰91尤物精品国产| 免费在线视频一区| 久久精品国产精品亚洲精品| 久久精品国产免费| 国产麻豆精品在线| 成人综合婷婷国产精品久久蜜臀| 国产a精品视频| www.亚洲色图.com| 在线亚洲高清视频| 8x8x8国产精品| 欧美大片在线观看| 国产欧美久久久精品影院| 国产精品福利一区二区三区| 综合激情网...| 亚洲午夜三级在线| 秋霞影院一区二区| 国产精品综合av一区二区国产馆| 国产sm精品调教视频网站| av网站一区二区三区| 色婷婷综合久久久中文一区二区 | 欧美mv日韩mv| 国产欧美日韩综合精品一区二区 | 欧美体内she精高潮| 欧美亚洲一区二区在线观看| 欧美日韩你懂的| 欧美v国产在线一区二区三区| 久久九九久久九九| 日韩毛片在线免费观看| 亚洲国产美国国产综合一区二区| 麻豆精品一区二区综合av| 粉嫩绯色av一区二区在线观看 | 欧美日韩国产高清一区二区| 欧美大白屁股肥臀xxxxxx| 国产日本欧洲亚洲| 亚洲午夜激情网页| 国产高清在线观看免费不卡| 色综合久久六月婷婷中文字幕| 91.com视频| 亚洲日本一区二区| 麻豆久久久久久久| 91福利视频网站| 久久久91精品国产一区二区精品| 亚洲主播在线观看| 国产乱码精品一区二区三| 欧美视频一区在线观看| 久久亚洲影视婷婷| 丝袜亚洲精品中文字幕一区| 成人性生交大合| 欧美一区二区三区性视频| 《视频一区视频二区| 国产在线精品一区二区三区不卡| 日本大香伊一区二区三区| 精品免费视频.| 亚洲成av人综合在线观看| 不卡影院免费观看| 337p日本欧洲亚洲大胆精品 | 欧洲精品中文字幕| 国产亚洲欧美日韩日本| 欧美精品欧美精品系列| 国产日韩欧美不卡| 日韩精品电影在线| 欧美在线free| 国产精品动漫网站| 国产一区二区三区四| 欧美一区二区大片| 亚洲午夜精品在线| 91在线一区二区| 国产精品久线在线观看| 久久电影网电视剧免费观看| 欧美日韩一区二区三区高清| 国产精品女主播av| 国产一区二区三区电影在线观看| 91精品国产一区二区| 亚洲国产日韩一级| 日本韩国欧美一区| 综合激情网...| 99国产一区二区三精品乱码| 中文字幕欧美三区| 成人久久视频在线观看| 久久人人97超碰com| 国产一区在线观看视频| 日韩三区在线观看| 青青国产91久久久久久 | 国产在线视视频有精品| 精品久久99ma| 福利电影一区二区三区| 亚洲日本在线观看| 国产成人亚洲综合a∨婷婷| 日韩视频一区二区在线观看| 午夜伦理一区二区| 欧美男人的天堂一二区| 午夜精品久久久久久久久久| 色av成人天堂桃色av| 亚洲一区二区在线免费看| 91福利国产成人精品照片| 一个色综合网站| 欧美猛男男办公室激情| 免费视频最近日韩| 26uuu亚洲综合色欧美| 国产精品综合在线视频| 欧美激情在线观看视频免费| 成人av在线影院| 一区二区欧美国产| 欧美精品1区2区| 老司机精品视频线观看86| www久久久久| 波多野结衣精品在线| 亚洲另类在线一区| 欧美高清www午色夜在线视频| 老司机一区二区| 2023国产一二三区日本精品2022| 日韩成人伦理电影在线观看| 日韩欧美色综合网站| 国产精品69毛片高清亚洲| 综合久久给合久久狠狠狠97色| 91福利社在线观看| 美美哒免费高清在线观看视频一区二区| 日韩你懂的电影在线观看| 成人免费毛片片v| 亚洲成人三级小说| 久久人人爽爽爽人久久久| 91色九色蝌蚪| 久久er99精品| 亚洲日本青草视频在线怡红院| 欧美揉bbbbb揉bbbbb| 国产成都精品91一区二区三|