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

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

?? pngfile.c

?? openmeetings組件之GS openmeetings組件之GS openmeetings組件之GS
?? C
字號:
//-------------------------------------//  PNGFILE.C -- Image File Functions//-------------------------------------// Copyright 2000, Willem van Schaik.  For conditions of distribution and// use, see the copyright/license/disclaimer notice in png.h#include <windows.h>#include <commdlg.h>#include <stdio.h>#include <stdlib.h>#include "png.h"#include "pngfile.h"#include "cexcept.h"define_exception_type(const char *);extern struct exception_context the_exception_context[1];struct exception_context the_exception_context[1];png_const_charp msg;static OPENFILENAME ofn;static png_structp png_ptr = NULL;static png_infop info_ptr = NULL;// cexcept interfacestatic voidpng_cexcept_error(png_structp png_ptr, png_const_charp msg){   if(png_ptr)     ;#ifndef PNG_NO_CONSOLE_IO   fprintf(stderr, "libpng error: %s\n", msg);#endif   {      Throw msg;   }}// Windows open-file functionsvoid PngFileInitialize (HWND hwnd){    static TCHAR szFilter[] = TEXT ("PNG Files (*.PNG)\0*.png\0")        TEXT ("All Files (*.*)\0*.*\0\0");    ofn.lStructSize       = sizeof (OPENFILENAME);    ofn.hwndOwner         = hwnd;    ofn.hInstance         = NULL;    ofn.lpstrFilter       = szFilter;    ofn.lpstrCustomFilter = NULL;    ofn.nMaxCustFilter    = 0;    ofn.nFilterIndex      = 0;    ofn.lpstrFile         = NULL;          // Set in Open and Close functions    ofn.nMaxFile          = MAX_PATH;    ofn.lpstrFileTitle    = NULL;          // Set in Open and Close functions    ofn.nMaxFileTitle     = MAX_PATH;    ofn.lpstrInitialDir   = NULL;    ofn.lpstrTitle        = NULL;    ofn.Flags             = 0;             // Set in Open and Close functions    ofn.nFileOffset       = 0;    ofn.nFileExtension    = 0;    ofn.lpstrDefExt       = TEXT ("png");    ofn.lCustData         = 0;    ofn.lpfnHook          = NULL;    ofn.lpTemplateName    = NULL;}BOOL PngFileOpenDlg (HWND hwnd, PTSTR pstrFileName, PTSTR pstrTitleName){    ofn.hwndOwner         = hwnd;    ofn.lpstrFile         = pstrFileName;    ofn.lpstrFileTitle    = pstrTitleName;    ofn.Flags             = OFN_HIDEREADONLY;    return GetOpenFileName (&ofn);}BOOL PngFileSaveDlg (HWND hwnd, PTSTR pstrFileName, PTSTR pstrTitleName){    ofn.hwndOwner         = hwnd;    ofn.lpstrFile         = pstrFileName;    ofn.lpstrFileTitle    = pstrTitleName;    ofn.Flags             = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;    return GetSaveFileName (&ofn);}// PNG image handler functionsBOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,                   int *piWidth, int *piHeight, int *piChannels, png_color *pBkgColor){    static FILE        *pfFile;    png_byte            pbSig[8];    int                 iBitDepth;    int                 iColorType;    double              dGamma;    png_color_16       *pBackground;    png_uint_32         ulChannels;    png_uint_32         ulRowBytes;    png_byte           *pbImageData = *ppbImageData;    static png_byte   **ppbRowPointers = NULL;    int                 i;    // open the PNG input file    if (!pstrFileName)    {        *ppbImageData = pbImageData = NULL;        return FALSE;    }    if (!(pfFile = fopen(pstrFileName, "rb")))    {        *ppbImageData = pbImageData = NULL;        return FALSE;    }    // first check the eight byte PNG signature    fread(pbSig, 1, 8, pfFile);    if (!png_check_sig(pbSig, 8))    {        *ppbImageData = pbImageData = NULL;        return FALSE;    }    // create the two png(-info) structures    png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL,      (png_error_ptr)png_cexcept_error, (png_error_ptr)NULL);    if (!png_ptr)    {        *ppbImageData = pbImageData = NULL;        return FALSE;    }    info_ptr = png_create_info_struct(png_ptr);    if (!info_ptr)    {        png_destroy_read_struct(&png_ptr, NULL, NULL);        *ppbImageData = pbImageData = NULL;        return FALSE;    }    Try    {                // initialize the png structure        #if !defined(PNG_NO_STDIO)        png_init_io(png_ptr, pfFile);#else        png_set_read_fn(png_ptr, (png_voidp)pfFile, png_read_data);#endif                png_set_sig_bytes(png_ptr, 8);                // read all PNG info up to image data                png_read_info(png_ptr, info_ptr);                // get width, height, bit-depth and color-type                png_get_IHDR(png_ptr, info_ptr, piWidth, piHeight, &iBitDepth,            &iColorType, NULL, NULL, NULL);                // expand images of all color-type and bit-depth to 3x8 bit RGB images        // let the library process things like alpha, transparency, background                if (iBitDepth == 16)            png_set_strip_16(png_ptr);        if (iColorType == PNG_COLOR_TYPE_PALETTE)            png_set_expand(png_ptr);        if (iBitDepth < 8)            png_set_expand(png_ptr);        if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))            png_set_expand(png_ptr);        if (iColorType == PNG_COLOR_TYPE_GRAY ||            iColorType == PNG_COLOR_TYPE_GRAY_ALPHA)            png_set_gray_to_rgb(png_ptr);                // set the background color to draw transparent and alpha images over.        if (png_get_bKGD(png_ptr, info_ptr, &pBackground))        {            png_set_background(png_ptr, pBackground, PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);            pBkgColor->red   = (byte) pBackground->red;            pBkgColor->green = (byte) pBackground->green;            pBkgColor->blue  = (byte) pBackground->blue;        }        else        {            pBkgColor = NULL;        }                // if required set gamma conversion        if (png_get_gAMA(png_ptr, info_ptr, &dGamma))            png_set_gamma(png_ptr, (double) 2.2, dGamma);                // after the transformations have been registered update info_ptr data                png_read_update_info(png_ptr, info_ptr);                // get again width, height and the new bit-depth and color-type                png_get_IHDR(png_ptr, info_ptr, piWidth, piHeight, &iBitDepth,            &iColorType, NULL, NULL, NULL);                        // row_bytes is the width x number of channels                ulRowBytes = png_get_rowbytes(png_ptr, info_ptr);        ulChannels = png_get_channels(png_ptr, info_ptr);                *piChannels = ulChannels;                // now we can allocate memory to store the image                if (pbImageData)        {            free (pbImageData);            pbImageData = NULL;        }        if ((pbImageData = (png_byte *) malloc(ulRowBytes * (*piHeight)                            * sizeof(png_byte))) == NULL)        {            png_error(png_ptr, "Visual PNG: out of memory");        }        *ppbImageData = pbImageData;                // and allocate memory for an array of row-pointers                if ((ppbRowPointers = (png_bytepp) malloc((*piHeight)                            * sizeof(png_bytep))) == NULL)        {            png_error(png_ptr, "Visual PNG: out of memory");        }                // set the individual row-pointers to point at the correct offsets                for (i = 0; i < (*piHeight); i++)            ppbRowPointers[i] = pbImageData + i * ulRowBytes;                // now we can go ahead and just read the whole image                png_read_image(png_ptr, ppbRowPointers);                // read the additional chunks in the PNG file (not really needed)                png_read_end(png_ptr, NULL);                // and we're done                free (ppbRowPointers);        ppbRowPointers = NULL;                // yepp, done    }    Catch (msg)    {        png_destroy_read_struct(&png_ptr, &info_ptr, NULL);        *ppbImageData = pbImageData = NULL;                if(ppbRowPointers)            free (ppbRowPointers);        fclose(pfFile);        return FALSE;    }    fclose (pfFile);    return TRUE;}BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,                   int iWidth, int iHeight, png_color bkgColor){    const int           ciBitDepth = 8;    const int           ciChannels = 3;    static FILE        *pfFile;    png_uint_32         ulRowBytes;    static png_byte   **ppbRowPointers = NULL;    int                 i;    // open the PNG output file    if (!pstrFileName)        return FALSE;    if (!(pfFile = fopen(pstrFileName, "wb")))        return FALSE;    // prepare the standard PNG structures    png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL,      (png_error_ptr)png_cexcept_error, (png_error_ptr)NULL);    if (!png_ptr)    {        fclose(pfFile);        return FALSE;    }    info_ptr = png_create_info_struct(png_ptr);    if (!info_ptr) {        fclose(pfFile);        png_destroy_write_struct(&png_ptr, (png_infopp) NULL);        return FALSE;    }    Try    {        // initialize the png structure        #if !defined(PNG_NO_STDIO)        png_init_io(png_ptr, pfFile);#else        png_set_write_fn(png_ptr, (png_voidp)pfFile, png_write_data, png_flush);#endif                // we're going to write a very simple 3x8 bit RGB image                png_set_IHDR(png_ptr, info_ptr, iWidth, iHeight, ciBitDepth,            PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE,            PNG_FILTER_TYPE_BASE);                // write the file header information                png_write_info(png_ptr, info_ptr);                // swap the BGR pixels in the DiData structure to RGB                png_set_bgr(png_ptr);                // row_bytes is the width x number of channels                ulRowBytes = iWidth * ciChannels;                // we can allocate memory for an array of row-pointers                if ((ppbRowPointers = (png_bytepp) malloc(iHeight * sizeof(png_bytep))) == NULL)            Throw "Visualpng: Out of memory";                // set the individual row-pointers to point at the correct offsets                for (i = 0; i < iHeight; i++)            ppbRowPointers[i] = pDiData + i * (((ulRowBytes + 3) >> 2) << 2);                // write out the entire image data in one call                png_write_image (png_ptr, ppbRowPointers);                // write the additional chunks to the PNG file (not really needed)                png_write_end(png_ptr, info_ptr);                // and we're done                free (ppbRowPointers);        ppbRowPointers = NULL;                // clean up after the write, and free any memory allocated                png_destroy_write_struct(&png_ptr, (png_infopp) NULL);                // yepp, done    }    Catch (msg)    {        png_destroy_write_struct(&png_ptr, (png_infopp) NULL);        if(ppbRowPointers)            free (ppbRowPointers);        fclose(pfFile);        return FALSE;    }        fclose (pfFile);        return TRUE;}#ifdef PNG_NO_STDIOstatic voidpng_read_data(png_structp png_ptr, png_bytep data, png_size_t length){   png_size_t check;   /* fread() returns 0 on error, so it is OK to store this in a png_size_t    * instead of an int, which is what fread() actually returns.    */   check = (png_size_t)fread(data, (png_size_t)1, length,      (FILE *)png_ptr->io_ptr);   if (check != length)   {      png_error(png_ptr, "Read Error");   }}static voidpng_write_data(png_structp png_ptr, png_bytep data, png_size_t length){   png_uint_32 check;   check = fwrite(data, 1, length, (FILE *)(png_ptr->io_ptr));   if (check != length)   {      png_error(png_ptr, "Write Error");   }}static voidpng_flush(png_structp png_ptr){   FILE *io_ptr;   io_ptr = (FILE *)CVT_PTR((png_ptr->io_ptr));   if (io_ptr != NULL)      fflush(io_ptr);}#endif//-----------------//  end of source//-----------------

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩国产另类一区| 久久久久久电影| 国产成人精品亚洲777人妖 | 国产乱对白刺激视频不卡| 亚洲婷婷综合色高清在线| 日韩欧美123| 欧美日韩视频在线观看一区二区三区 | 亚洲人精品午夜| 日韩视频免费直播| 色妹子一区二区| 国产成人精品三级| 老司机免费视频一区二区三区| 亚洲欧美电影院| 久久精品视频免费| 精品国产一区二区三区不卡| 欧美丰满少妇xxxbbb| 91在线观看下载| 国产福利一区二区三区视频在线| 六月丁香综合在线视频| 日韩精品欧美精品| 亚洲国产成人91porn| 亚洲九九爱视频| 1024国产精品| 亚洲视频中文字幕| 国产精品每日更新在线播放网址 | 精品福利一区二区三区| 91精品国产一区二区| 欧美日韩久久久久久| 91久久久免费一区二区| 一道本成人在线| 色综合天天综合| 色94色欧美sute亚洲线路一ni | 国产精品99久久久| 黄一区二区三区| 精品一区二区国语对白| 久久精品国产**网站演员| 麻豆精品一区二区av白丝在线| 天堂影院一区二区| 日本不卡的三区四区五区| 日韩精品免费专区| 美女一区二区在线观看| 久久99精品视频| 国产成人在线免费观看| 成人av一区二区三区| 波多野洁衣一区| 日本大香伊一区二区三区| 欧美色爱综合网| 欧美一区二区三区思思人| 日韩欧美在线123| 精品国产百合女同互慰| 国产女同性恋一区二区| 国产精品久久毛片av大全日韩| 亚洲欧美偷拍卡通变态| 亚洲.国产.中文慕字在线| 热久久久久久久| 国产精品一区二区三区乱码 | 91精品啪在线观看国产60岁| 日韩欧美中文一区| 亚洲国产高清在线观看视频| 中文字幕一区二区三区在线观看| 一区二区三区成人在线视频| 日韩精品电影在线观看| 国产在线精品不卡| 91色在线porny| 欧美日韩国产一区| 久久午夜电影网| 亚洲欧美二区三区| 蜜臀av性久久久久蜜臀aⅴ流畅 | 亚洲高清不卡在线| 人妖欧美一区二区| 成人一道本在线| 欧美男女性生活在线直播观看| 日韩视频一区在线观看| 欧美韩国日本综合| 午夜精品爽啪视频| 国产精品一区在线观看乱码| 91国产视频在线观看| 精品乱人伦小说| 亚洲精品成人少妇| 国产一区二区在线电影| 在线一区二区三区四区| 国产精品蜜臀在线观看| 成人av在线电影| 日本高清免费不卡视频| 欧美电影免费观看高清完整版在| 欧美激情综合五月色丁香小说| 亚洲国产精品尤物yw在线观看| 久久精品二区亚洲w码| 色综合欧美在线视频区| 日韩美女视频在线| 亚洲精品视频在线看| 亚洲综合色噜噜狠狠| 91污片在线观看| 亚洲女人的天堂| www.av亚洲| 国产精品乱码妇女bbbb| 成人黄色小视频在线观看| 欧美激情在线看| 国产成人av电影在线播放| 久久无码av三级| 丰满放荡岳乱妇91ww| 国产日韩成人精品| 成a人片国产精品| 亚洲三级在线播放| 91精品1区2区| 亚洲一卡二卡三卡四卡五卡| 欧美无砖专区一中文字| 一区二区三区在线看| 久久99精品久久久久| 精品国产1区二区| 国产一区二区h| 久久久久久黄色| av不卡一区二区三区| 日韩美女久久久| 欧美丝袜丝交足nylons图片| 日韩国产欧美在线播放| 日韩你懂的在线播放| 国产精品66部| 亚洲欧洲日韩综合一区二区| 色先锋aa成人| 日韩一区精品视频| 精品欧美乱码久久久久久1区2区| 国产精品一品二品| 亚洲三级视频在线观看| 欧美日韩国产综合视频在线观看| 日韩成人免费在线| 久久精品视频一区二区三区| 91丨九色丨国产丨porny| 亚洲18女电影在线观看| 亚洲精品一区二区三区精华液 | 亚洲国产精品一区二区久久 | 国产精品无码永久免费888| 色综合中文字幕国产 | 国产精品剧情在线亚洲| 欧美在线观看你懂的| 美女一区二区在线观看| 国产欧美一区二区三区在线老狼| 91丨porny丨蝌蚪视频| 天天影视涩香欲综合网| 国产区在线观看成人精品| 色综合天天性综合| 麻豆久久久久久久| 亚洲人精品午夜| 日韩免费一区二区| 91视频在线看| 久久国产福利国产秒拍| 亚洲桃色在线一区| 欧美一区在线视频| av毛片久久久久**hd| 美女免费视频一区二区| 最新国产成人在线观看| 91精品国产乱码| 91麻豆国产在线观看| 日本最新不卡在线| 亚洲久本草在线中文字幕| 久久综合丝袜日本网| 欧美午夜免费电影| 成人免费av资源| 美女高潮久久久| 亚洲国产一区视频| 国产精品高潮久久久久无| 欧美一区二区三区小说| 一本大道久久a久久综合| 黑人巨大精品欧美黑白配亚洲| 亚洲激情av在线| 欧美国产激情一区二区三区蜜月| 欧美另类一区二区三区| 99re在线视频这里只有精品| 久久99精品国产.久久久久久 | 国产乱一区二区| 日韩主播视频在线| 亚洲欧美区自拍先锋| 久久久久国产成人精品亚洲午夜| 欧美日韩国产经典色站一区二区三区| 成人黄色片在线观看| 久久国产人妖系列| 亚洲成a人片综合在线| ...xxx性欧美| 国产欧美视频一区二区| 精品日韩一区二区三区| 91麻豆精品国产91久久久使用方法| 色综合av在线| 成人午夜短视频| 国产精品一二三四| 久久精品久久综合| 丝袜诱惑亚洲看片| 亚洲r级在线视频| 尤物在线观看一区| 亚洲欧美综合色| 国产精品成人一区二区三区夜夜夜| 国产天堂亚洲国产碰碰| 亚洲精品一区二区三区精华液 | 日本午夜精品视频在线观看| 亚洲成在人线在线播放| 亚洲综合丝袜美腿| 亚洲男人的天堂在线aⅴ视频| 中文字幕成人网| 日本一区二区高清| 国产日产欧美一区二区视频| 久久久精品影视|