亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
视频在线观看91| 精品女同一区二区| 国产精品久久久久久久久快鸭| 日韩av二区在线播放| 欧美美女黄视频| 五月开心婷婷久久| 91精品在线麻豆| 日本成人在线电影网| 正在播放一区二区| 日韩黄色一级片| 日韩一级片在线播放| 美女免费视频一区| 69堂成人精品免费视频| 日韩和欧美一区二区| 欧美日韩成人在线一区| 日韩在线a电影| 日韩午夜电影av| 日韩一区欧美二区| 日韩一区二区在线观看| 蜜臀av在线播放一区二区三区| 日韩午夜在线影院| 国产一区福利在线| 国产亚洲精品福利| youjizz国产精品| 亚洲精品第1页| 欧美日韩精品二区第二页| 五月天精品一区二区三区| 欧美久久一二区| 久久福利视频一区二区| 国产欧美精品一区二区色综合| www.日韩在线| 天天操天天色综合| 欧美不卡一区二区| 国产不卡视频一区二区三区| 成人欧美一区二区三区小说| 欧美女孩性生活视频| 蓝色福利精品导航| 国产精品视频一二| 欧美日韩亚洲高清一区二区| 男人的天堂久久精品| 国产欧美日韩不卡免费| 欧美亚一区二区| 精品一区二区av| 亚洲欧美日韩一区二区| 日韩欧美美女一区二区三区| 国产精品一区一区| 亚洲综合在线五月| 亚洲精品一区二区三区四区高清| 99久久伊人精品| 日韩va欧美va亚洲va久久| 欧美一级一区二区| av一二三不卡影片| 蜜臀av亚洲一区中文字幕| 中文字幕精品一区二区三区精品| 色婷婷久久99综合精品jk白丝| 人人精品人人爱| 国产精品卡一卡二| 日韩欧美久久久| 日本韩国欧美三级| 麻豆精品在线看| 日韩一区欧美小说| 国产亚洲精品aa| 欧美一区二区黄| 成人禁用看黄a在线| 奇米色777欧美一区二区| 亚洲精选在线视频| 欧美精彩视频一区二区三区| 91精品婷婷国产综合久久性色 | 久久精品国产99国产精品| 亚洲欧洲一区二区在线播放| 日韩一区二区视频| 在线观看视频一区二区| 成人免费观看视频| 韩国女主播成人在线| 免费看欧美女人艹b| 亚洲激情图片一区| 国产婷婷色一区二区三区| 精品欧美一区二区久久| 91精品久久久久久久99蜜桃| 色婷婷久久久综合中文字幕| 成人中文字幕合集| 国产揄拍国内精品对白| 奇米色一区二区| 午夜成人免费视频| 亚洲一区二区三区在线看| 亚洲日本在线看| 综合电影一区二区三区| 国产欧美一区二区三区在线老狼| 精品久久一区二区| 欧美成人精品1314www| 欧美一卡二卡三卡| 91精品国产91久久久久久最新毛片| 欧美午夜片在线看| 欧美在线制服丝袜| 日韩午夜在线播放| 中文字幕乱码一区二区免费| 一区二区三区在线免费观看| 天堂一区二区在线| 久久国产视频网| 不卡视频一二三| 欧美久久久影院| 精品999久久久| 亚洲日本va午夜在线影院| 亚洲图片欧美视频| 国产在线国偷精品产拍免费yy| 成人精品免费看| 欧美日韩精品欧美日韩精品一 | 丝袜诱惑制服诱惑色一区在线观看 | 日韩一区二区三区视频| 久久久久久亚洲综合影院红桃| 国产精品美女久久福利网站| 亚洲午夜精品在线| 激情综合亚洲精品| 日本精品视频一区二区| 日韩精品一区二区三区视频 | 欧美日韩视频专区在线播放| 欧美α欧美αv大片| 国产精品毛片大码女人| 五月婷婷另类国产| 国产iv一区二区三区| 欧美日韩国产综合一区二区 | 色一区在线观看| 亚洲精品一区二区三区四区高清 | 欧美日韩激情一区二区三区| 国产亚洲制服色| 成人在线综合网| 欧美日韩国产在线观看| 亚洲国产精品99久久久久久久久| 亚洲第一av色| 成人短视频下载| 8x8x8国产精品| 亚洲天堂网中文字| 国产一区二区三区电影在线观看| 欧美日韩一卡二卡| 亚洲色图一区二区三区| 国产一区二区精品久久| 这里只有精品免费| 亚洲曰韩产成在线| 成人av午夜电影| 久久男人中文字幕资源站| 日本一不卡视频| 欧美性色综合网| 亚洲精品视频在线看| 国产91丝袜在线播放九色| 日韩欧美电影一二三| 亚洲国产另类av| 91久久国产综合久久| 日韩一区在线看| av不卡在线观看| 国产精品欧美经典| 国产不卡在线一区| 久久久高清一区二区三区| 久久国产日韩欧美精品| 欧美一区二区视频在线观看2022 | 综合欧美亚洲日本| 成人免费的视频| 国产日韩一级二级三级| 韩国午夜理伦三级不卡影院| 精品欧美黑人一区二区三区| 青青草国产成人av片免费| 在线不卡中文字幕| 天天影视涩香欲综合网| 欧美猛男男办公室激情| 亚洲福中文字幕伊人影院| 欧美在线免费视屏| 一区二区三区av电影| 欧洲一区二区三区在线| 亚洲欧美日韩一区二区| 日本福利一区二区| 亚洲一区精品在线| 欧美另类高清zo欧美| 日韩精品五月天| 日韩欧美在线不卡| 久久精品99国产精品| 欧美v国产在线一区二区三区| 蜜臀精品一区二区三区在线观看 | 亚洲乱码中文字幕| 欧美在线看片a免费观看| 亚洲一卡二卡三卡四卡无卡久久| 欧美性猛交xxxx黑人交| 男女性色大片免费观看一区二区| 欧美一级高清片| 国产在线精品不卡| 亚洲欧洲色图综合| 欧美性大战久久久久久久| 水野朝阳av一区二区三区| 日韩女优电影在线观看| 国产成人精品影视| 亚洲免费av高清| 91精品综合久久久久久| 国产精一区二区三区| 亚洲视频 欧洲视频| 欧美片在线播放| 国产一区亚洲一区| 亚洲精品ww久久久久久p站 | 欧美视频中文一区二区三区在线观看| 天堂av在线一区| 欧美国产亚洲另类动漫| 在线亚洲高清视频| 狠狠色狠狠色合久久伊人|