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

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

?? rpng-win.c

?? game engine, which is useful for everyone who is interested in it. I hope you can enjoy it.
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*---------------------------------------------------------------------------

   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:
    - handle quoted command-line args (especially filenames with spaces)
    - have minimum window width:  oh well
    - use %.1023s to simplify truncation of title-bar string?

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

   Changelog:
    - 1.00:  initial public release
    - 1.01:  modified to allow abbreviated options; fixed long/ulong mis-
              match; switched to png_jmpbuf() macro
    - 1.02:  added extra set of parentheses to png_jmpbuf() macro; fixed
              command-line parsing bug
    - 1.10:  enabled "message window"/console (thanks to David Geldreich)

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

      Copyright (c) 1998-2001 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.20 of 28 May 2001"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <windows.h>
#include <conio.h>      /* only for _getch() */

/* #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 reenable console output, which normally goes to the bit bucket
     * for windowed apps.  Closing the console window will terminate the
     * app.  Thanks to David.Geldreich@realviz.com for supplying the magical
     * incantation. */

    AllocConsole();
    freopen("CONOUT$", "a", stderr);
    freopen("CONOUT$", "a", stdout);


    /* Next 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 (!strncmp(*argv, "-gamma", 2)) {
            if (!*++argv)
                ++error;
            else {
                display_exponent = atof(*argv);
                if (display_exponent <= 0.0)
                    ++error;
            }
        } else if (!strncmp(*argv, "-bgcolor", 2)) {
            if (!*++argv)
                ++error;
            else {
                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);
    }


    /* usage screen */

    if (error) {
        int ch;

        fprintf(stderr, "\n%s %s:  %s\n\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., ``#ff7700'' 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"
          "Press Q or Esc to quit this usage screen.\n"
          "\n", PROGNAME, default_display_exponent);
        do
            ch = _getch();
        while (ch != 'q' && ch != 'Q' && ch != 0x1B);
        exit(1);
    } else {
        fprintf(stderr, "\n%s %s:  %s\n", PROGNAME, VERSION, appname);
        fprintf(stderr,
          "\n   [console window:  closing this window will terminate %s]\n\n",
          PROGNAME);
    }


    /* 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);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日日欢夜夜爽一区| 欧美日韩一本到| 欧美精品自拍偷拍| 日本一区二区三区视频视频| 视频一区视频二区在线观看| bt欧美亚洲午夜电影天堂| 日韩美女主播在线视频一区二区三区| 18欧美亚洲精品| 国产成人精品亚洲日本在线桃色| 在线成人免费视频| 一区二区三区欧美日韩| www.亚洲色图.com| 国产欧美精品一区二区色综合 | 日韩精品成人一区二区在线| 成人一级片网址| 欧美va亚洲va香蕉在线| 午夜久久久久久久久久一区二区| 91香蕉视频污在线| 中文成人av在线| 国产成人亚洲综合a∨婷婷 | 国产一区在线观看视频| 欧美日韩国产小视频在线观看| 18欧美亚洲精品| 91免费版在线| 亚洲免费在线播放| 色综合激情久久| 伊人一区二区三区| 91视频国产观看| 亚洲另类春色国产| 欧美性三三影院| 亚洲香肠在线观看| 欧美日韩日日夜夜| 亚洲国产精品一区二区久久恐怖片| 91视视频在线观看入口直接观看www | 日本一区二区三区高清不卡| 国产精品一级片| 久久久精品2019中文字幕之3| 国产一区高清在线| 国产精品素人一区二区| 99久久精品情趣| 亚洲日本va午夜在线影院| 91麻豆免费观看| 亚洲综合在线免费观看| 欧美日韩一区二区三区在线看| 亚洲成av人片在www色猫咪| 欧美精品一卡两卡| 久久精品二区亚洲w码| 久久色在线视频| av影院午夜一区| 亚洲国产一区视频| 日韩精品一区二区在线| 丁香桃色午夜亚洲一区二区三区| ...xxx性欧美| 91精品午夜视频| 国产精品18久久久久久久网站| 国产精品久久久久久久久久久免费看 | 亚洲老司机在线| 欧美日韩一区二区在线观看| 国产在线播精品第三| 国产精品电影一区二区| 欧美日本在线一区| 国产精品中文有码| 一区二区欧美精品| 精品国产乱码久久久久久免费| 成人网男人的天堂| 午夜成人免费视频| 亚洲国产精品黑人久久久| 日本道免费精品一区二区三区| 麻豆久久久久久久| 亚洲欧美视频在线观看视频| 日韩精品一区二区三区视频播放 | 在线观看国产日韩| 老司机一区二区| 亚洲女女做受ⅹxx高潮| 精品欧美乱码久久久久久1区2区| 99久久精品国产毛片| 麻豆精品在线观看| 亚洲综合清纯丝袜自拍| 国产欧美综合在线| 欧美一区二区视频免费观看| 91亚洲男人天堂| 国产一区二区精品在线观看| 三级在线观看一区二区| 亚洲伦理在线免费看| 国产亚洲一区二区三区四区| 欧美一区二区三区人| 在线看日韩精品电影| 国产69精品一区二区亚洲孕妇| 亚洲r级在线视频| 亚洲欧洲国产日韩| 国产亚洲欧美中文| 日韩你懂的在线播放| 7878成人国产在线观看| 欧洲精品在线观看| 成人污污视频在线观看| 国产精品一区二区你懂的| 美女视频黄频大全不卡视频在线播放| 亚洲视频在线一区| 中文字幕不卡三区| 国产亚洲制服色| 久久亚洲一区二区三区四区| 欧美高清www午色夜在线视频| 色综合久久天天| 99久久99久久精品免费看蜜桃| 国产河南妇女毛片精品久久久| 美女精品自拍一二三四| 奇米影视一区二区三区小说| 亚洲小说春色综合另类电影| 亚洲黄色尤物视频| 亚洲欧美偷拍卡通变态| 亚洲色欲色欲www| 中文字幕综合网| 亚洲精品中文在线观看| 亚洲精品乱码久久久久| 亚洲精品国产精品乱码不99| 伊人夜夜躁av伊人久久| 亚洲一卡二卡三卡四卡五卡| 怡红院av一区二区三区| 夜夜精品视频一区二区| 亚洲国产你懂的| 免费在线一区观看| 国产美女精品在线| 国产大陆a不卡| 波多野结衣一区二区三区| 91在线小视频| 91久久香蕉国产日韩欧美9色| 91福利在线免费观看| 777亚洲妇女| 久久久精品一品道一区| 国产精品成人免费在线| 亚洲美女视频一区| 日精品一区二区三区| 麻豆一区二区三| 国产成人欧美日韩在线电影| 成人精品免费网站| 欧美色涩在线第一页| 欧美精品在线视频| 久久久精品蜜桃| 亚洲曰韩产成在线| 秋霞av亚洲一区二区三| 狠狠色丁香久久婷婷综| 不卡一区二区中文字幕| 欧美区一区二区三区| 久久综合色婷婷| 樱桃视频在线观看一区| 老鸭窝一区二区久久精品| 成人午夜伦理影院| 欧美精三区欧美精三区| 久久久久99精品国产片| 亚洲午夜久久久久久久久电影院| 久久成人综合网| 97se亚洲国产综合自在线| 日韩一区二区在线播放| 国产精品色哟哟网站| 视频一区在线播放| av电影在线观看不卡| 欧美一区二区二区| 亚洲日本护士毛茸茸| 国产一区二区不卡在线| 成人免费高清在线| 欧美人与性动xxxx| 综合久久国产九一剧情麻豆| 欧美a级理论片| 色综合一个色综合| 国产亚洲一区二区三区在线观看 | 欧美一区二区三区成人| 国产精品丝袜91| 精品一区二区三区免费观看 | 午夜精品久久久久久久久久 | 欧美伊人久久久久久久久影院| 久久综合色鬼综合色| 亚洲va韩国va欧美va精品| 99国产精品久久久久| 欧美精品一区二区三区一线天视频| 亚洲黄色免费电影| 99精品1区2区| 亚洲国产精品成人综合| 久久精品噜噜噜成人88aⅴ| 日本韩国欧美国产| 国产精品网曝门| 国产麻豆91精品| 欧美成人精品二区三区99精品| 一区二区三区在线视频免费观看| youjizz国产精品| 国产欧美日韩精品在线| 国产一区二区三区最好精华液| 欧美男男青年gay1069videost| 一区二区三区四区高清精品免费观看| 国产成人av影院| 国产视频一区不卡| 久久se精品一区二区| 欧美成人国产一区二区| 免费高清在线一区| 日韩免费观看高清完整版| 日本欧美一区二区| 日韩一级在线观看| 久久av资源网| 久久久亚洲精品一区二区三区 | 欧美日韩免费一区二区三区| 一区二区三区在线播放|