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

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

?? rpng-win.c

?? Borland C++BuilderT 6 Developer s Guide
?? 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:
    - 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?

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

   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

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

      Copyright (c) 1998-2000 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.02 of 19 March 2000"

#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 (!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) {
        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., ``#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"
         "\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");

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美亚洲一区二区三区四区| 国产成人av电影在线观看| 欧美电影免费观看高清完整版 | 亚洲国产精品激情在线观看| 色婷婷精品大在线视频| 欧美aⅴ一区二区三区视频| 国产精品理论片在线观看| 欧美日韩国产大片| 国产老肥熟一区二区三区| 亚洲欧洲日韩av| 日韩视频一区二区三区| 91日韩在线专区| 蓝色福利精品导航| 亚洲尤物视频在线| 欧美国产禁国产网站cc| 欧美一区国产二区| 91在线视频观看| 国产一区二区在线观看免费| 一区二区欧美国产| 国产亚洲成aⅴ人片在线观看 | www久久久久| 欧美婷婷六月丁香综合色| 成人激情综合网站| 欧美96一区二区免费视频| 亚洲福利视频一区二区| 中文字幕亚洲电影| 久久综合精品国产一区二区三区| 在线精品视频免费播放| www.久久久久久久久| 国产在线精品国自产拍免费| 水野朝阳av一区二区三区| 夜夜精品视频一区二区| 怡红院av一区二区三区| 国产精品乱人伦中文| 久久久久久一二三区| 91黄视频在线| 欧美曰成人黄网| 99国产精品久久久久| 丰满少妇在线播放bd日韩电影| 一区二区三区欧美亚洲| 亚洲综合在线五月| 综合激情成人伊人| 国产精品视频yy9299一区| 久久久久久9999| 国产欧美日韩卡一| 欧美国产精品一区二区三区| 久久久久久久久97黄色工厂| 精品日产卡一卡二卡麻豆| 精品国产乱码久久久久久浪潮| 91麻豆精品国产自产在线| 欧美高清视频www夜色资源网| 欧美午夜影院一区| 欧美一区二区三区小说| 日韩亚洲欧美在线观看| 日韩女优制服丝袜电影| 欧美大片日本大片免费观看| 精品黑人一区二区三区久久| 精品久久99ma| 久久网站热最新地址| 久久影院午夜片一区| 国产午夜精品理论片a级大结局| 欧美一卡二卡三卡| 日韩精品在线网站| 久久精品一区二区三区不卡| 久久久99精品久久| 中文天堂在线一区| 亚洲激情av在线| 亚瑟在线精品视频| 久久国产夜色精品鲁鲁99| 韩国欧美国产一区| 精品一区二区精品| 91视频免费播放| 欧美日韩一区二区三区四区| 制服.丝袜.亚洲.中文.综合| 337p亚洲精品色噜噜狠狠| 亚洲国产电影在线观看| 亚洲免费观看高清完整版在线 | 成人激情免费电影网址| 国产99久久久国产精品潘金 | 国产一区二区在线影院| 国产精品一区二区免费不卡| 亚洲免费在线播放| 天天影视网天天综合色在线播放 | 国产精华液一区二区三区| 成人性色生活片| 懂色一区二区三区免费观看| 欧美日韩国产区一| 久久午夜色播影院免费高清 | 欧美三级电影一区| 亚洲国产精品一区二区久久| 日韩国产欧美一区二区三区| 国产成人综合亚洲网站| 51久久夜色精品国产麻豆| 精品少妇一区二区三区免费观看| 亚洲成人7777| 奇米色777欧美一区二区| 国产一区 二区| av在线不卡电影| 久久综合狠狠综合久久激情| 亚洲另类在线视频| 精品一区二区三区在线观看国产 | 久久精品视频免费| 国产精品免费av| 九九精品一区二区| 91精品国产黑色紧身裤美女| 亚洲免费在线视频一区 二区| 国产精品资源在线| 日韩丝袜情趣美女图片| 性久久久久久久| 色婷婷综合五月| 亚洲免费伊人电影| av成人动漫在线观看| 欧美精彩视频一区二区三区| 狠狠色狠狠色综合日日91app| 91久久精品日日躁夜夜躁欧美| 亚洲丝袜美腿综合| 91色在线porny| 亚洲精品伦理在线| 91在线观看成人| 一区二区三区欧美日韩| 欧美男男青年gay1069videost| 亚洲线精品一区二区三区八戒| 色综合久久88色综合天天免费| 久久9热精品视频| 国产精品午夜春色av| 美脚の诱脚舐め脚责91| 丁香激情综合国产| 国产精品视频观看| 欧美性大战久久久久久久蜜臀| 一区二区三区av电影| 欧美三级乱人伦电影| 丝袜诱惑制服诱惑色一区在线观看| 欧美女孩性生活视频| 国产suv精品一区二区883| 91麻豆精品国产91久久久更新时间 | 日韩亚洲欧美在线观看| 91黄色激情网站| 精品视频一区二区三区免费| 91麻豆精品国产91久久久| 日韩一区二区三区视频在线观看 | 日韩精品午夜视频| 欧美经典一区二区三区| 欧美日韩综合在线免费观看| 国产一区二区三区日韩 | 欧美综合在线视频| 色香色香欲天天天影视综合网| 三级不卡在线观看| 欧美性色黄大片手机版| 天天操天天干天天综合网| 91精品国产综合久久久久久| 日韩成人dvd| 亚洲欧美一区二区三区孕妇| 99久久精品99国产精品| 一区二区三区免费观看| 欧美二区三区91| 国内精品伊人久久久久av影院| 26uuu色噜噜精品一区| 成人小视频免费观看| 亚洲欧美国产高清| 91麻豆精品国产综合久久久久久| 久久精品99久久久| 国产精品网曝门| 精品视频在线免费| 九色综合国产一区二区三区| 国产精品欧美一级免费| 在线欧美小视频| 蜜乳av一区二区三区| 国产精品妹子av| 欧美日韩免费视频| 国产麻豆精品久久一二三| 亚洲美女淫视频| 欧美成人一区二区| 91视频你懂的| 久久99久久精品欧美| 亚洲猫色日本管| 欧美成人精精品一区二区频| 成人av网址在线观看| 日韩电影免费在线| 国产精品蜜臀在线观看| 欧美一区二区三区在线电影| av电影天堂一区二区在线观看| 日韩激情一区二区| **欧美大码日韩| 日韩免费看的电影| 91网站最新地址| 久草在线在线精品观看| 一区二区三区鲁丝不卡| 久久蜜桃av一区二区天堂 | 国产精品18久久久久久久久久久久| 综合av第一页| 精品国产一区a| 欧美亚洲日本一区| 国产91精品入口| 毛片av一区二区三区| 一区二区三区自拍| 国产欧美日韩一区二区三区在线观看| 欧美日韩大陆在线| jlzzjlzz亚洲日本少妇| 国产一区在线精品| 日本aⅴ免费视频一区二区三区 |