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

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

?? readpng.c

?? openmeetings組件之GS openmeetings組件之GS openmeetings組件之GS
?? C
字號:
/*---------------------------------------------------------------------------   rpng - simple PNG display program                              readpng.c  ---------------------------------------------------------------------------      Copyright (c) 1998-2007 Greg Roelofs.  All rights reserved.      This software is provided "as is," without warranty of any kind,      express or implied.  In no event shall the author or contributors      be held liable for any damages arising in any way from the use of      this software.      The contents of this file are DUAL-LICENSED.  You may modify and/or      redistribute this software according to the terms of one of the      following two licenses (at your option):      LICENSE 1 ("BSD-like with advertising clause"):      Permission is granted to anyone to use this software for any purpose,      including commercial applications, and to alter it and redistribute      it freely, subject to the following restrictions:      1. Redistributions of source code must retain the above copyright         notice, disclaimer, and this list of conditions.      2. Redistributions in binary form must reproduce the above copyright         notice, disclaimer, and this list of conditions in the documenta-         tion and/or other materials provided with the distribution.      3. All advertising materials mentioning features or use of this         software must display the following acknowledgment:            This product includes software developed by Greg Roelofs            and contributors for the book, "PNG: The Definitive Guide,"            published by O'Reilly and Associates.      LICENSE 2 (GNU GPL v2 or later):      This program is free software; you can redistribute it and/or modify      it under the terms of the GNU General Public License as published by      the Free Software Foundation; either version 2 of the License, or      (at your option) any later version.      This program is distributed in the hope that it will be useful,      but WITHOUT ANY WARRANTY; without even the implied warranty of      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      GNU General Public License for more details.      You should have received a copy of the GNU General Public License      along with this program; if not, write to the Free Software Foundation,      Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA  ---------------------------------------------------------------------------*/#include <stdio.h>#include <stdlib.h>#include "png.h"        /* libpng header; includes zlib.h */#include "readpng.h"    /* typedefs, common macros, public prototypes *//* future versions of libpng will provide this macro: */#ifndef png_jmpbuf#  define png_jmpbuf(png_ptr)   ((png_ptr)->jmpbuf)#endifstatic png_structp png_ptr = NULL;static png_infop info_ptr = NULL;png_uint_32  width, height;int  bit_depth, color_type;uch  *image_data = NULL;void readpng_version_info(void){    fprintf(stderr, "   Compiled with libpng %s; using libpng %s.\n",      PNG_LIBPNG_VER_STRING, png_libpng_ver);    fprintf(stderr, "   Compiled with zlib %s; using zlib %s.\n",      ZLIB_VERSION, zlib_version);}/* return value = 0 for success, 1 for bad sig, 2 for bad IHDR, 4 for no mem */int readpng_init(FILE *infile, ulg *pWidth, ulg *pHeight){    uch sig[8];    /* first do a quick check that the file really is a PNG image; could     * have used slightly more general png_sig_cmp() function instead */    fread(sig, 1, 8, infile);    if (!png_check_sig(sig, 8))        return 1;   /* bad signature */    /* could pass pointers to user-defined error handlers instead of NULLs: */    png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);    if (!png_ptr)        return 4;   /* out of memory */    info_ptr = png_create_info_struct(png_ptr);    if (!info_ptr) {        png_destroy_read_struct(&png_ptr, NULL, NULL);        return 4;   /* out of memory */    }    /* we could create a second info struct here (end_info), but it's only     * useful if we want to keep pre- and post-IDAT chunk info separated     * (mainly for PNG-aware image editors and converters) */    /* setjmp() must be called in every function that calls a PNG-reading     * libpng function */    if (setjmp(png_jmpbuf(png_ptr))) {        png_destroy_read_struct(&png_ptr, &info_ptr, NULL);        return 2;    }    png_init_io(png_ptr, infile);    png_set_sig_bytes(png_ptr, 8);  /* we already read the 8 signature bytes */    png_read_info(png_ptr, info_ptr);  /* read all PNG info up to image data */    /* alternatively, could make separate calls to png_get_image_width(),     * etc., but want bit_depth and color_type for later [don't care about     * compression_type and filter_type => NULLs] */    png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,      NULL, NULL, NULL);    *pWidth = width;    *pHeight = height;    /* OK, that's all we need for now; return happy */    return 0;}/* returns 0 if succeeds, 1 if fails due to no bKGD chunk, 2 if libpng error; * scales values to 8-bit if necessary */int readpng_get_bgcolor(uch *red, uch *green, uch *blue){    png_color_16p pBackground;    /* setjmp() must be called in every function that calls a PNG-reading     * libpng function */    if (setjmp(png_jmpbuf(png_ptr))) {        png_destroy_read_struct(&png_ptr, &info_ptr, NULL);        return 2;    }    if (!png_get_valid(png_ptr, info_ptr, PNG_INFO_bKGD))        return 1;    /* it is not obvious from the libpng documentation, but this function     * takes a pointer to a pointer, and it always returns valid red, green     * and blue values, regardless of color_type: */    png_get_bKGD(png_ptr, info_ptr, &pBackground);    /* however, it always returns the raw bKGD data, regardless of any     * bit-depth transformations, so check depth and adjust if necessary */    if (bit_depth == 16) {        *red   = pBackground->red   >> 8;        *green = pBackground->green >> 8;        *blue  = pBackground->blue  >> 8;    } else if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) {        if (bit_depth == 1)            *red = *green = *blue = pBackground->gray? 255 : 0;        else if (bit_depth == 2)            *red = *green = *blue = (255/3) * pBackground->gray;        else /* bit_depth == 4 */            *red = *green = *blue = (255/15) * pBackground->gray;    } else {        *red   = (uch)pBackground->red;        *green = (uch)pBackground->green;        *blue  = (uch)pBackground->blue;    }    return 0;}/* display_exponent == LUT_exponent * CRT_exponent */uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes){    double  gamma;    png_uint_32  i, rowbytes;    png_bytepp  row_pointers = NULL;    /* setjmp() must be called in every function that calls a PNG-reading     * libpng function */    if (setjmp(png_jmpbuf(png_ptr))) {        png_destroy_read_struct(&png_ptr, &info_ptr, NULL);        return NULL;    }    /* expand palette images to RGB, low-bit-depth grayscale images to 8 bits,     * transparency chunks to full alpha channel; strip 16-bit-per-sample     * images to 8 bits per sample; and convert grayscale to RGB[A] */    if (color_type == PNG_COLOR_TYPE_PALETTE)        png_set_expand(png_ptr);    if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)        png_set_expand(png_ptr);    if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))        png_set_expand(png_ptr);    if (bit_depth == 16)        png_set_strip_16(png_ptr);    if (color_type == PNG_COLOR_TYPE_GRAY ||        color_type == PNG_COLOR_TYPE_GRAY_ALPHA)        png_set_gray_to_rgb(png_ptr);    /* unlike the example in the libpng documentation, we have *no* idea where     * this file may have come from--so if it doesn't have a file gamma, don't     * do any correction ("do no harm") */    if (png_get_gAMA(png_ptr, info_ptr, &gamma))        png_set_gamma(png_ptr, display_exponent, gamma);    /* all transformations have been registered; now update info_ptr data,     * get rowbytes and channels, and allocate image memory */    png_read_update_info(png_ptr, info_ptr);    *pRowbytes = rowbytes = png_get_rowbytes(png_ptr, info_ptr);    *pChannels = (int)png_get_channels(png_ptr, info_ptr);    if ((image_data = (uch *)malloc(rowbytes*height)) == NULL) {        png_destroy_read_struct(&png_ptr, &info_ptr, NULL);        return NULL;    }    if ((row_pointers = (png_bytepp)malloc(height*sizeof(png_bytep))) == NULL) {        png_destroy_read_struct(&png_ptr, &info_ptr, NULL);        free(image_data);        image_data = NULL;        return NULL;    }    Trace((stderr, "readpng_get_image:  channels = %d, rowbytes = %ld, height = %ld\n", *pChannels, rowbytes, height));    /* set the individual row_pointers to point at the correct offsets */    for (i = 0;  i < height;  ++i)        row_pointers[i] = image_data + i*rowbytes;    /* now we can go ahead and just read the whole image */    png_read_image(png_ptr, row_pointers);    /* and we're done!  (png_read_end() can be omitted if no processing of     * post-IDAT text/time/etc. is desired) */    free(row_pointers);    row_pointers = NULL;    png_read_end(png_ptr, NULL);    return image_data;}void readpng_cleanup(int free_image_data){    if (free_image_data && image_data) {        free(image_data);        image_data = NULL;    }    if (png_ptr && info_ptr) {        png_destroy_read_struct(&png_ptr, &info_ptr, NULL);        png_ptr = NULL;        info_ptr = NULL;    }}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品伦一区| 中文字幕+乱码+中文字幕一区| 国产91色综合久久免费分享| 美女网站一区二区| 蜜臀a∨国产成人精品| 丝瓜av网站精品一区二区| 午夜视频在线观看一区二区三区 | 日本不卡一区二区| 亚洲sss视频在线视频| 性做久久久久久| 日本亚洲电影天堂| 国产一区欧美一区| av激情综合网| 欧美三级电影一区| www一区二区| 中文字幕视频一区| 亚洲v中文字幕| 国产一区二区三区国产| 波多野结衣中文一区| www.亚洲免费av| 欧美日韩亚州综合| 久久伊人蜜桃av一区二区| 日韩一区中文字幕| 日本在线播放一区二区三区| 国产乱对白刺激视频不卡| 成人黄色av网站在线| 欧美精品色综合| 日本一区二区三区高清不卡| 亚洲一区在线视频观看| 蜜臀av性久久久久蜜臀aⅴ| 粉嫩av一区二区三区| 欧美日韩精品一区二区三区四区 | 国产成人免费xxxxxxxx| 99久久久久免费精品国产| 51精品视频一区二区三区| 久久久久免费观看| 一区二区三区在线观看国产| 麻豆91在线观看| 色哟哟一区二区三区| 久久久久久一二三区| 亚洲一区二区三区影院| 国产激情一区二区三区| 欧美狂野另类xxxxoooo| 国产精品免费aⅴ片在线观看| 午夜欧美在线一二页| 成人一级视频在线观看| 日韩一级二级三级| 亚洲午夜免费电影| av在线这里只有精品| 精品国产伦一区二区三区观看体验 | 日韩一级片网站| 亚洲国产精品麻豆| 99麻豆久久久国产精品免费 | 亚洲高清视频在线| 从欧美一区二区三区| 日韩久久久精品| 亚洲国产精品一区二区www在线| 国产99久久久国产精品免费看| 欧美一区二区黄| 亚洲777理论| 欧美亚洲国产怡红院影院| 中文字幕一区免费在线观看| 国模少妇一区二区三区| 日韩女优电影在线观看| 免费高清视频精品| 欧美日韩精品综合在线| 亚洲成av人片观看| 欧美人体做爰大胆视频| 亚洲影院在线观看| 欧美日韩一区二区三区四区| 一区二区在线观看视频| 91网站在线播放| 亚洲激情第一区| 欧美综合久久久| 日日摸夜夜添夜夜添国产精品| 欧美性受极品xxxx喷水| 亚洲一级在线观看| 精品视频在线视频| 无码av中文一区二区三区桃花岛| 欧美日韩国产精品自在自线| 日韩黄色片在线观看| 日韩一区二区三区电影| 麻豆国产一区二区| 久久中文字幕电影| 国产在线精品一区二区三区不卡| 欧美精品一区二区三区视频| 国产美女精品在线| 中文字幕的久久| 91福利社在线观看| 免费成人av资源网| 日本一二三不卡| 91久久线看在观草草青青| 五月婷婷另类国产| 久久久午夜电影| 欧美艳星brazzers| 久草在线在线精品观看| 亚洲国产经典视频| 欧美主播一区二区三区美女| 美腿丝袜在线亚洲一区| 亚洲国产精品二十页| 欧美亚洲一区二区三区四区| 男人操女人的视频在线观看欧美| 久久久蜜臀国产一区二区| 91片黄在线观看| 久久精品国产免费看久久精品| 中文字幕不卡一区| 欧美女孩性生活视频| 成人永久免费视频| 强制捆绑调教一区二区| 国产精品久久久久四虎| 日韩一区二区不卡| 91在线国产观看| 国产一区二区三区四| 亚洲午夜精品17c| 国产午夜亚洲精品羞羞网站| 欧美揉bbbbb揉bbbbb| 丰满少妇在线播放bd日韩电影| 亚洲小说春色综合另类电影| 久久精品亚洲乱码伦伦中文| 欧美日韩国产系列| av高清久久久| 国产福利91精品一区二区三区| 亚洲国产中文字幕| 国产精品久久三| 久久久电影一区二区三区| 欧美伊人久久久久久久久影院| 国产成人免费av在线| 美国毛片一区二区| 亚洲国产成人av网| 一区二区三区欧美日韩| 欧美激情在线观看视频免费| 日韩你懂的电影在线观看| 欧美综合在线视频| 91久久精品日日躁夜夜躁欧美| 国产剧情一区在线| 久久99久久99小草精品免视看| 亚洲成av人片在线观看无码| 亚洲女与黑人做爰| 中文一区在线播放| 国产精品网站导航| 国产精品天干天干在线综合| 久久你懂得1024| 久久久久久久性| 久久久久亚洲综合| 久久久久久久久久久久久女国产乱| 欧美一级xxx| 欧美大片顶级少妇| 欧美大片拔萝卜| 欧美一卡2卡3卡4卡| 欧美精品三级日韩久久| 欧美一级在线视频| 欧美一级免费大片| 3d成人动漫网站| 日韩欧美卡一卡二| 精品国产百合女同互慰| 精品国产三级电影在线观看| 精品免费国产一区二区三区四区| 日韩美一区二区三区| 欧美刺激午夜性久久久久久久| 日韩欧美一区二区在线视频| 日韩免费高清av| 久久久久久一二三区| 国产精品污www在线观看| 中文字幕一区二区三区四区| 国产精品天天摸av网| 亚洲免费观看高清完整版在线观看| 亚洲人成影院在线观看| 亚洲一区二区三区四区中文字幕| 怡红院av一区二区三区| 日精品一区二区三区| 久草热8精品视频在线观看| 国产成人免费xxxxxxxx| 色综合天天综合狠狠| 欧美日韩国产乱码电影| 精品福利在线导航| 亚洲欧洲日产国码二区| 午夜视黄欧洲亚洲| 韩国v欧美v亚洲v日本v| 成人性色生活片免费看爆迷你毛片| av一本久道久久综合久久鬼色| 欧美性色黄大片手机版| 精品免费99久久| 亚洲免费在线看| 日本三级亚洲精品| 成人午夜电影网站| 制服丝袜中文字幕亚洲| 久久久久国产精品麻豆| 亚洲最大成人网4388xx| 久久国产日韩欧美精品| 日本精品一级二级| 国产色产综合色产在线视频| 一区二区三区视频在线观看| 国产一区二区0| 欧美性生交片4| 国产午夜精品久久久久久久| 首页欧美精品中文字幕| 91网址在线看| 国产丝袜欧美中文另类| 免费人成在线不卡| 一本久道中文字幕精品亚洲嫩 |