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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? rpng-win.c

?? 教你如何簡(jiǎn)單顯示一章TIFF位圖,分析的很透徹,很適合出學(xué)者.希望能給你帶來幫助!
?? C
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
/*---------------------------------------------------------------------------

   rpng - simple PNG display program                             rpng-win.c

   This program decodes and displays PNG images, with gamma correction and
   optionally with a user-specified background color (in case the image has
   transparency).  It is very nearly the most basic PNG viewer possible.
   This version is for 32-bit Windows; it may compile under 16-bit Windows
   with a little tweaking (or maybe not).

   to do:
    - stdout/stderr don't work!  need message window (maybe scrollable?)
    - handle quoted command-line args (especially filenames with spaces)
    - have minimum window width:  oh well
    - use %.1023s to simplify truncation of title-bar string?

  ---------------------------------------------------------------------------

      Copyright (c) 1998-1999 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.

      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.

  ---------------------------------------------------------------------------*/

#define PROGNAME  "rpng-win"
#define LONGNAME  "Simple PNG Viewer for Windows"
#define VERSION   "1.0 of 20 February 1999"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <windows.h>

/* #define DEBUG  :  this enables the Trace() macros */

#include "readpng.h"	/* typedefs, common macros, readpng prototypes */


/* could just include png.h, but this macro is the only thing we need
 * (name and typedefs changed to local versions); note that side effects
 * only happen with alpha (which could easily be avoided with
 * "ush acopy = (alpha);") */

#define alpha_composite(composite, fg, alpha, bg) {			\
    ush temp = ((ush)(fg)*(ush)(alpha) +				\
                (ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128);	\
    (composite) = (uch)((temp + (temp >> 8)) >> 8);			\
}


/* local prototypes */
static int        rpng_win_create_window(HINSTANCE hInst, int showmode);
static int        rpng_win_display_image(void);
static void       rpng_win_cleanup(void);
LRESULT CALLBACK  rpng_win_wndproc(HWND, UINT, WPARAM, LPARAM);


static char titlebar[1024], *window_name = titlebar;
static char *progname = PROGNAME;
static char *appname = LONGNAME;
static char *icon_name = PROGNAME;	/* GRR:  not (yet) used */
static char *filename;
static FILE *infile;

static char *bgstr;
static uch bg_red=0, bg_green=0, bg_blue=0;

static double display_exponent;

static ulg image_width, image_height, image_rowbytes;
static int image_channels;
static uch *image_data;

/* Windows-specific variables */
static ulg wimage_rowbytes;
static uch *dib;
static uch *wimage_data;
static BITMAPINFOHEADER *bmih;

static HWND global_hwnd;




int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
{
    char *args[1024];		/* arbitrary limit, but should suffice */
    char *p, *q, **argv = args;
    int argc = 0;
    int rc, alen, flen;
    int error = 0;
    int have_bg = FALSE;
    double LUT_exponent;		/* just the lookup table */
    double CRT_exponent = 2.2;		/* just the monitor */
    double default_display_exponent;	/* whole display system */
    MSG msg;


    filename = (char *)NULL;


    /* First set the default value for our display-system exponent, i.e.,
     * the product of the CRT exponent and the exponent corresponding to
     * the frame-buffer's lookup table (LUT), if any.  This is not an
     * exhaustive list of LUT values (e.g., OpenStep has a lot of weird
     * ones), but it should cover 99% of the current possibilities.  And
     * yes, these ifdefs are completely wasted in a Windows program... */

#if defined(NeXT)
    LUT_exponent = 1.0 / 2.2;
    /*
    if (some_next_function_that_returns_gamma(&next_gamma))
        LUT_exponent = 1.0 / next_gamma;
     */
#elif defined(sgi)
    LUT_exponent = 1.0 / 1.7;
    /* there doesn't seem to be any documented function to get the
     * "gamma" value, so we do it the hard way */
    infile = fopen("/etc/config/system.glGammaVal", "r");
    if (infile) {
        double sgi_gamma;

        fgets(tmpline, 80, infile);
        fclose(infile);
        sgi_gamma = atof(tmpline);
        if (sgi_gamma > 0.0)
            LUT_exponent = 1.0 / sgi_gamma;
    }
#elif defined(Macintosh)
    LUT_exponent = 1.8 / 2.61;
    /*
    if (some_mac_function_that_returns_gamma(&mac_gamma))
        LUT_exponent = mac_gamma / 2.61;                 
     */
#else
    LUT_exponent = 1.0;   /* assume no LUT:  most PCs */
#endif

    /* the defaults above give 1.0, 1.3, 1.5 and 2.2, respectively: */
    default_display_exponent = LUT_exponent * CRT_exponent;


    /* If the user has set the SCREEN_GAMMA environment variable as suggested
     * (somewhat imprecisely) in the libpng documentation, use that; otherwise
     * use the default value we just calculated.  Either way, the user may
     * override this via a command-line option. */

    if ((p = getenv("SCREEN_GAMMA")) != NULL)
        display_exponent = atof(p);
    else
        display_exponent = default_display_exponent;


    /* Windows really hates command lines, so we have to set up our own argv.
     * Note that we do NOT bother with quoted arguments here, so don't use
     * filenames with spaces in 'em! */

    argv[argc++] = PROGNAME;
    p = cmd;
    for (;;) {
        if (*p == ' ')
            while (*++p == ' ')
                ;
        /* now p points at the first non-space after some spaces */
        if (*p == '\0')
            break;    /* nothing after the spaces:  done */
        argv[argc++] = q = p;
        while (*q && *q != ' ')
            ++q;
        /* now q points at a space or the end of the string */
        if (*q == '\0')
            break;    /* last argv already terminated; quit */
        *q = '\0';    /* change space to terminator */
        p = q + 1;
    }
    argv[argc] = NULL;   /* terminate the argv array itself */


    /* Now parse the command line for options and the PNG filename. */

    while (*++argv && !error) {
        if (!strcmp(*argv, "-gamma")) {
            if (!*++argv)
                ++error;
            display_exponent = atof(*argv);
            if (display_exponent <= 0.0)
                ++error;
        } else if (!strcmp(*argv, "-bgcolor")) {
            if (!*++argv)
                ++error;
            bgstr = *argv;
            if (strlen(bgstr) != 7 || bgstr[0] != '#')
                ++error;
            else
                have_bg = TRUE;
        } else {
            if (**argv != '-') {
                filename = *argv;
                if (argv[1])   /* shouldn't be any more args after filename */
                    ++error;
            } else
                ++error;   /* not expecting any other options */
        }
    }

    if (!filename) {
        ++error;
    } else if (!(infile = fopen(filename, "rb"))) {
        fprintf(stderr, PROGNAME ":  can't open PNG file [%s]\n", filename);
        ++error;
    } else {
        if ((rc = readpng_init(infile, &image_width, &image_height)) != 0) {
            switch (rc) {
                case 1:
                    fprintf(stderr, PROGNAME
                      ":  [%s] is not a PNG file: incorrect signature\n",
                      filename);
                    break;
                case 2:
                    fprintf(stderr, PROGNAME
                      ":  [%s] has bad IHDR (libpng longjmp)\n",
                      filename);
                    break;
                case 4:
                    fprintf(stderr, PROGNAME ":  insufficient memory\n");
                    break;
                default:
                    fprintf(stderr, PROGNAME
                      ":  unknown readpng_init() error\n");
                    break;
            }
            ++error;
        }
        if (error)
            fclose(infile);
    }

    if (error) {
        fprintf(stderr, "\n%s %s:  %s\n", PROGNAME, VERSION, appname);
        readpng_version_info();
        fprintf(stderr, "\n"
         "Usage:  %s [-gamma exp] [-bgcolor bg] file.png\n"
         "    exp \ttransfer-function exponent (``gamma'') of the display\n"
         "\t\t  system in floating-point format (e.g., ``%.1f''); equal\n"
         "\t\t  to the product of the lookup-table exponent (varies)\n"
         "\t\t  and the CRT exponent (usually 2.2); must be positive\n"
         "    bg  \tdesired background color in 7-character hex RGB format\n"
         "\t\t  (e.g., ``#ff7f00'' for orange:  same as HTML colors);\n"
         "\t\t  used with transparent images\n"
         "\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
         "\n", PROGNAME, default_display_exponent);
        exit(1);
    }


    /* set the title-bar string, but make sure buffer doesn't overflow */

    alen = strlen(appname);
    flen = strlen(filename);
    if (alen + flen + 3 > 1023)
        sprintf(titlebar, "%s:  ...%s", appname, filename+(alen+flen+6-1023));
    else
        sprintf(titlebar, "%s:  %s", appname, filename);


    /* if the user didn't specify a background color on the command line,
     * check for one in the PNG file--if not, the initialized values of 0
     * (black) will be used */

    if (have_bg)
        sscanf(bgstr+1, "%2x%2x%2x", &bg_red, &bg_green, &bg_blue);
    else if (readpng_get_bgcolor(&bg_red, &bg_green, &bg_blue) > 1) {
        readpng_cleanup(TRUE);
        fprintf(stderr, PROGNAME
          ":  libpng error while checking for background color\n");
        exit(2);
    }


    /* do the basic Windows initialization stuff, make the window and fill it
     * with the background color */

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国内精品伊人久久久久av影院| 久久精品久久精品| 欧美一区二区三区四区高清| 国产精品一级黄| 亚洲主播在线播放| 中文字幕第一区| 91精品国产全国免费观看| 成人av网址在线观看| 麻豆专区一区二区三区四区五区| 中文字幕日韩av资源站| 久久综合九色综合欧美亚洲| 欧美性极品少妇| 99免费精品在线| 国产乱码精品一区二区三区av| 性感美女久久精品| 一区二区三区在线免费播放| 国产欧美日韩在线看| 日韩一区二区电影在线| 欧美亚洲日本一区| 成人动漫在线一区| 国产一区二区三区免费看 | 久久久久国产精品麻豆| 欧美日本一区二区三区| 91在线观看污| 成人免费毛片a| 国产黄色成人av| 一本大道av一区二区在线播放| 精品制服美女丁香| 日韩高清一区二区| 亚洲午夜三级在线| 尤物av一区二区| 亚洲同性gay激情无套| 欧美国产国产综合| 国产日韩欧美电影| 国产嫩草影院久久久久| 久久欧美中文字幕| 亚洲精品一区二区三区99| 91精品国产黑色紧身裤美女| 欧美一卡2卡3卡4卡| 91麻豆精品国产91| 欧美一区二区成人| 日韩欧美国产一区在线观看| 欧美一卡二卡三卡四卡| 欧美成人欧美edvon| 久久综合久久久久88| 久久精品视频免费| 国产精品免费久久| 亚洲日本电影在线| 亚洲综合图片区| 亚洲v日本v欧美v久久精品| 亚洲一卡二卡三卡四卡 | 国产精品青草综合久久久久99| 亚洲精品一区在线观看| 久久久精品国产免费观看同学| 国产色91在线| 亚洲欧美在线视频观看| 1区2区3区精品视频| 亚洲最大成人综合| 日韩精品欧美精品| 精品午夜一区二区三区在线观看| 国产精品夜夜爽| aaa欧美色吧激情视频| 欧日韩精品视频| 日韩精品中午字幕| 久久免费看少妇高潮| 国产精品免费免费| 亚洲一区电影777| 精品一区二区在线免费观看| 国产不卡在线一区| 91视频91自| 91精品福利在线一区二区三区| 久久天天做天天爱综合色| 国产精品国产三级国产aⅴ原创| 亚洲宅男天堂在线观看无病毒| 日本免费在线视频不卡一不卡二| 国产自产视频一区二区三区| 成人精品一区二区三区四区| 在线亚洲高清视频| 久久综合99re88久久爱| 亚洲卡通欧美制服中文| 日本不卡高清视频| jlzzjlzz亚洲女人18| 在线播放欧美女士性生活| 国产亚洲成aⅴ人片在线观看 | 欧美日韩在线综合| 久久久久国产精品麻豆| 樱桃国产成人精品视频| 精品一二线国产| 色94色欧美sute亚洲线路二| 精品少妇一区二区三区视频免付费 | 中文字幕日本不卡| 免费看日韩a级影片| 不卡在线视频中文字幕| 欧美电影免费观看高清完整版在线观看 | 99re在线精品| 欧美一级黄色大片| 一区二区三区四区av| 韩国一区二区在线观看| 欧美午夜寂寞影院| 日本一区二区三区视频视频| 五月婷婷久久丁香| 91亚洲国产成人精品一区二区三| 精品1区2区在线观看| 亚洲午夜电影在线观看| 成人aaaa免费全部观看| 精品对白一区国产伦| 亚洲午夜国产一区99re久久| 成人avav影音| 久久久久国产精品麻豆ai换脸 | 青青草成人在线观看| 99久久99久久综合| 久久精品无码一区二区三区| 日韩成人一级大片| 欧美午夜理伦三级在线观看| 最新不卡av在线| 国产成人免费9x9x人网站视频| 欧美一区二区三区喷汁尤物| 一区二区三区在线高清| jlzzjlzz国产精品久久| 中文字幕av资源一区| 国内精品不卡在线| 精品电影一区二区| 另类小说图片综合网| 5566中文字幕一区二区电影| 一区二区三区精品| 91黄色免费网站| 一二三区精品福利视频| 色综合av在线| 一区二区三区中文在线观看| 91蜜桃网址入口| 综合亚洲深深色噜噜狠狠网站| 丁香六月久久综合狠狠色| 国产日产欧美一区| 成人午夜在线视频| 国产精品久久看| 99在线视频精品| 国产精品视频第一区| 99久久99久久精品国产片果冻| 国产精品色哟哟| 91在线观看免费视频| 亚洲色图欧美激情| 在线观看91视频| 日韩精品乱码av一区二区| 在线播放欧美女士性生活| 美女一区二区视频| 亚洲精品一区二区三区香蕉 | 成人a区在线观看| 亚洲人成在线播放网站岛国| 一本色道亚洲精品aⅴ| 亚洲欧美日韩国产成人精品影院| 色婷婷亚洲精品| 午夜av区久久| 精品国精品国产| 丁香桃色午夜亚洲一区二区三区| 国产精品欧美一级免费| 91在线一区二区| 天天影视网天天综合色在线播放 | 666欧美在线视频| 极品少妇xxxx偷拍精品少妇| 国产日韩三级在线| 91在线小视频| 日日噜噜夜夜狠狠视频欧美人| 日韩三级高清在线| 国产成人一区在线| 自拍偷拍欧美激情| 欧美群妇大交群中文字幕| 久久精品国产精品青草| 国产精品网站一区| 欧美亚洲综合色| 国产一区二区三区高清播放| 中文字幕在线免费不卡| 欧美日韩免费一区二区三区视频| 奇米影视一区二区三区小说| 国产日韩精品一区| 欧美日韩大陆一区二区| 国产精品资源在线| 亚洲电影一区二区三区| 久久精品视频免费| 欧美日韩黄色影视| 国产成人午夜片在线观看高清观看| 亚洲人快播电影网| 亚洲精品一线二线三线| 在线视频一区二区三| 国产一区二区三区观看| 亚洲午夜久久久久久久久电影网| 久久亚洲二区三区| 欧美日本国产视频| 99免费精品在线| 久久91精品国产91久久小草| 亚洲激情一二三区| 国产亚洲成年网址在线观看| 欧美久久久久久蜜桃| 99精品偷自拍| 国产一区二区在线观看免费| 午夜精品一区二区三区三上悠亚| 亚洲国产精品二十页| 91精品国产日韩91久久久久久| 91麻豆国产精品久久| 国产一区二区精品在线观看| 日韩国产欧美视频|