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

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

?? rpng2-x.c

?? Borland C++BuilderT 6 Developer s Guide
?? C
?? 第 1 頁 / 共 4 頁
字號:
/*---------------------------------------------------------------------------

   rpng2 - progressive-model PNG display program                  rpng2-x.c

   This program decodes and displays PNG files progressively, as if it were
   a web browser (though the front end is only set up to read from files).
   It supports gamma correction, user-specified background colors, and user-
   specified background patterns (for transparent images).  This version is
   for the X Window System (tested by the author under Unix and by Martin
   Zinser under OpenVMS; may work under OS/2 with a little tweaking).

   Thanks to Adam Costello and Pieter S. van der Meulen for the "diamond"
   and "radial waves" patterns, respectively.

   to do:
    - 8-bit support
    - finish resizable checkerboard-gradient (sizes 4-128?)
    - use %.1023s to simplify truncation of title-bar string?

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

   Changelog:
    - 1.01:  initial public release
    - 1.02:  modified to allow abbreviated options; fixed char/uchar mismatch
    - 1.10:  added support for non-default visuals; fixed X pixel-conversion
    - 1.11:  added -usleep option for demos; fixed command-line parsing bug
    - 1.12:  added -pause option for demos and testing

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

      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  "rpng2-x"
#define LONGNAME  "Progressive PNG Viewer for X"
#define VERSION   "1.12 of 19 March 2000"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <setjmp.h>       /* for jmpbuf declaration in readpng2.h */
#include <time.h>
#include <math.h>         /* only for PvdM background code */
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <X11/keysym.h>   /* defines XK_* macros */

#ifdef VMS
#  include <unistd.h>
#endif

/* all for PvdM background code: */
#ifndef PI
#  define PI             3.141592653589793238
#endif
#define PI_2             (PI*0.5)
#define INV_PI_360       (360.0 / PI)
#define MAX(a,b)         (a>b?a:b)
#define MIN(a,b)         (a<b?a:b)
#define CLIP(a,min,max)  MAX(min,MIN((a),max))
#define ABS(a)           ((a)<0?-(a):(a))
#define CLIP8P(c)        MAX(0,(MIN((c),255)))   /* 8-bit pos. integer (uch) */
#define ROUNDF(f)        ((int)(f + 0.5))

#define rgb1_max   bg_freq
#define rgb1_min   bg_gray
#define rgb2_max   bg_bsat
#define rgb2_min   bg_brot

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

#include "readpng2.h"   /* typedefs, common macros, readpng2 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);               \
}


#define INBUFSIZE 4096   /* with pseudo-timing on (1 sec delay/block), this
                          *  block size corresponds roughly to a download
                          *  speed 10% faster than theoretical 33.6K maximum
                          *  (assuming 8 data bits, 1 stop bit and no other
                          *  overhead) */

/* local prototypes */
static void rpng2_x_init(void);
static int  rpng2_x_create_window(void);
static int  rpng2_x_load_bg_image(void);
static void rpng2_x_display_row(ulg row);
static void rpng2_x_finish_display(void);
static void rpng2_x_cleanup(void);
static int  rpng2_x_msb(ulg u32val);


static char titlebar[1024], *window_name = titlebar;
static char *appname = LONGNAME;
static char *icon_name = PROGNAME;
static char *filename;
static FILE *infile;

static mainprog_info rpng2_info;

static uch inbuf[INBUFSIZE];
static int incount;

static int pat = 6;        /* must be less than num_bgpat */
static int bg_image = 0;
static int bgscale = 16;
static ulg bg_rowbytes;
static uch *bg_data;

int pause_after_pass = FALSE;
int demo_timing = FALSE;
ulg usleep_duration = 0L;

static struct rgb_color {
    uch r, g, b;
} rgb[] = {
    {  0,   0,   0},    /*  0:  black */
    {255, 255, 255},    /*  1:  white */
    {173, 132,  57},    /*  2:  tan */
    { 64, 132,   0},    /*  3:  medium green */
    {189, 117,   1},    /*  4:  gold */
    {253, 249,   1},    /*  5:  yellow */
    {  0,   0, 255},    /*  6:  blue */
    {  0,   0, 120},    /*  7:  medium blue */
    {255,   0, 255},    /*  8:  magenta */
    { 64,   0,  64},    /*  9:  dark magenta */
    {255,   0,   0},    /* 10:  red */
    { 64,   0,   0},    /* 11:  dark red */
    {255, 127,   0},    /* 12:  orange */
    {192,  96,   0},    /* 13:  darker orange */
    { 24,  60,   0},    /* 14:  dark green-yellow */
    { 85, 125, 200}     /* 15:  ice blue */
};
/* not used for now, but should be for error-checking:
static int num_rgb = sizeof(rgb) / sizeof(struct rgb_color);
 */

/*
    This whole struct is a fairly cheesy way to keep the number of
    command-line options to a minimum.  The radial-waves background
    type is a particularly poor fit to the integer elements of the
    struct...but a few macros and a little fixed-point math will do
    wonders for ya.

    type bits:
       F E D C B A 9 8 7 6 5 4 3 2 1 0
                             | | | | |
                             | | +-+-+-- 0 = sharp-edged checkerboard
                             | |         1 = soft diamonds
                             | |         2 = radial waves
                             | |       3-7 = undefined
                             | +-- gradient #2 inverted?
                             +-- alternating columns inverted?
 */
static struct background_pattern {
    ush type;
    int rgb1_max, rgb1_min;     /* or bg_freq, bg_gray */
    int rgb2_max, rgb2_min;     /* or bg_bsat, bg_brot (both scaled by 10)*/
} bg[] = {
    {0+8,   2,0,  1,15},        /* checkered:  tan/black vs. white/ice blue */
    {0+24,  2,0,  1,0},         /* checkered:  tan/black vs. white/black */
    {0+8,   4,5,  0,2},         /* checkered:  gold/yellow vs. black/tan */
    {0+8,   4,5,  0,6},         /* checkered:  gold/yellow vs. black/blue */
    {0,     7,0,  8,9},         /* checkered:  deep blue/black vs. magenta */
    {0+8,  13,0,  5,14},        /* checkered:  orange/black vs. yellow */
    {0+8,  12,0, 10,11},        /* checkered:  orange/black vs. red */
    {1,     7,0,  8,0},         /* diamonds:  deep blue/black vs. magenta */
    {1,    12,0, 11,0},         /* diamonds:  orange vs. dark red */
    {1,    10,0,  7,0},         /* diamonds:  red vs. medium blue */
    {1,     4,0,  5,0},         /* diamonds:  gold vs. yellow */
    {1,     3,0,  0,0},         /* diamonds:  medium green vs. black */
    {2,    16, 100,  20,   0},  /* radial:  ~hard radial color-beams */
    {2,    18, 100,  10,   2},  /* radial:  soft, curved radial color-beams */
    {2,    16, 256, 100, 250},  /* radial:  very tight spiral */
    {2, 10000, 256,  11,   0}   /* radial:  dipole-moire' (almost fractal) */
};
static int num_bgpat = sizeof(bg) / sizeof(struct background_pattern);


/* X-specific variables */
static char *displayname;
static XImage *ximage;
static Display *display;
static int depth;
static Visual *visual;
static XVisualInfo *visual_list;
static int RShift, GShift, BShift;
static ulg RMask, GMask, BMask;
static Window window;
static GC gc;
static Colormap colormap;

static int have_nondefault_visual = FALSE;
static int have_colormap = FALSE;
static int have_window = FALSE;




int main(int argc, char **argv)
{
#ifdef sgi
    char tmpline[80];
#endif
    char *p, *bgstr = NULL;
    int rc, alen, flen;
    int error = 0;
    int timing = FALSE;
    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 */
    XEvent e;
    KeySym k;


    /* First initialize a few things, just to be sure--memset takes care of
     * default background color (black), booleans (FALSE), pointers (NULL),
     * etc. */

    displayname = (char *)NULL;
    filename = (char *)NULL;
    memset(&rpng2_info, 0, sizeof(mainprog_info));


    /* 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. */

#if defined(NeXT)
    /* third-party utilities can modify the default LUT exponent */
    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)
        rpng2_info.display_exponent = atof(p);
    else
        rpng2_info.display_exponent = default_display_exponent;


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

    while (*++argv && !error) {
        if (!strncmp(*argv, "-display", 2)) {
            if (!*++argv)
                ++error;
            else
                displayname = *argv;
        } else if (!strncmp(*argv, "-gamma", 2)) {
            if (!*++argv)
                ++error;
            else {
                rpng2_info.display_exponent = atof(*argv);
                if (rpng2_info.display_exponent <= 0.0)
                    ++error;
            }
        } else if (!strncmp(*argv, "-bgcolor", 4)) {
            if (!*++argv)
                ++error;
            else {
                bgstr = *argv;
                if (strlen(bgstr) != 7 || bgstr[0] != '#')
                    ++error;
                else {
                    have_bg = TRUE;
                    bg_image = FALSE;
                }
            }
        } else if (!strncmp(*argv, "-bgpat", 4)) {
            if (!*++argv)
                ++error;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
av爱爱亚洲一区| 国产一区二区在线视频| 国产精品久久久久一区二区三区共| 欧美写真视频网站| 国产美女主播视频一区| 麻豆精品一区二区三区| 久久精品国产99国产| 蜜臀av一区二区在线免费观看| 日韩欧美一区在线观看| 在线国产亚洲欧美| 欧美午夜理伦三级在线观看| 欧美三电影在线| 欧美精品在线一区二区| 欧美一区二区免费| 精品久久久久久久久久久久包黑料| 国产成人99久久亚洲综合精品| 久久婷婷色综合| 欧美激情艳妇裸体舞| 1024成人网| 一个色妞综合视频在线观看| 一区二区三区不卡在线观看| 亚洲va欧美va国产va天堂影院| 久久精品一级爱片| 综合电影一区二区三区| 午夜欧美2019年伦理| 精品一区免费av| 99久久国产免费看| 91丨九色丨蝌蚪富婆spa| 欧美午夜电影在线播放| 日韩欧美专区在线| 中文字幕av不卡| 亚洲国产精品一区二区尤物区| 久久久久久电影| 亚洲人精品一区| 欧美a级理论片| 色婷婷一区二区| 欧美mv日韩mv国产| 一区二区成人在线观看| 久久99精品久久久久| 99久久久久久| 欧美精品一区二区三区四区| 国产欧美精品国产国产专区 | 亚洲精品在线免费观看视频| 欧美成人video| 1024国产精品| 精品无人区卡一卡二卡三乱码免费卡| 亚洲天堂av一区| 蜜桃一区二区三区在线观看| 国产一区二区91| 欧美性受xxxx| 国产精品青草综合久久久久99| 精品国产伦一区二区三区免费| 在线这里只有精品| 久久久久久99久久久精品网站| 日韩一卡二卡三卡国产欧美| 亚洲视频香蕉人妖| 丰满亚洲少妇av| 欧美一区午夜视频在线观看| 玉足女爽爽91| 高清国产午夜精品久久久久久| 国产一区999| 欧美丝袜丝交足nylons图片| 亚洲欧洲在线观看av| 国产一区二区三区在线观看精品| 久久99久久精品| 91精品国产综合久久蜜臀| 亚洲视频你懂的| 色噜噜狠狠一区二区三区果冻| 91性感美女视频| 久久久久久久久99精品| 久久国产精品一区二区| 日韩久久久精品| 日本怡春院一区二区| 欧美片网站yy| 午夜私人影院久久久久| 欧美吻胸吃奶大尺度电影| 亚洲精品菠萝久久久久久久| 91小视频在线免费看| 亚洲视频精选在线| 在线视频中文字幕一区二区| 亚洲人成精品久久久久| 在线观看视频一区二区欧美日韩| 欧美日韩高清一区二区不卡| 一区二区三区av电影| 欧美亚洲自拍偷拍| 日韩二区在线观看| 欧美成人一区二区| 国产乱人伦偷精品视频不卡| 亚洲国产精品国自产拍av| av爱爱亚洲一区| 亚洲一二三专区| 日韩欧美一级二级三级久久久| 久久精品人人做| jizzjizzjizz欧美| 亚洲女女做受ⅹxx高潮| 91亚洲精品久久久蜜桃| 一区二区三区日韩在线观看| 欧美日韩三级视频| 精品一区二区三区不卡 | 欧美夫妻性生活| 日韩不卡一二三区| 精品国产制服丝袜高跟| 国产成人精品aa毛片| 一区二区三区国产精品| 欧美大片在线观看一区| 99久久99久久免费精品蜜臀| 艳妇臀荡乳欲伦亚洲一区| 91精品国产综合久久国产大片| 亚洲色图制服丝袜| 日韩亚洲欧美高清| 国产精品一区二区三区乱码| 亚洲一区视频在线| 久久久久久久久久久久久夜| 日本韩国一区二区| 激情深爱一区二区| 樱花影视一区二区| 久久日韩粉嫩一区二区三区| 91麻豆高清视频| 久久99国产乱子伦精品免费| 亚洲视频网在线直播| 日韩免费福利电影在线观看| 色综合久久中文综合久久牛| 精品一区二区三区的国产在线播放| 在线成人av网站| 成人av在线一区二区三区| 亚洲福利一二三区| 中文欧美字幕免费| 精品三级在线看| 欧美亚洲动漫精品| 91视频国产资源| 国产精品一区二区无线| 日韩在线a电影| 夜夜夜精品看看| 亚洲四区在线观看| 国产日产欧美精品一区二区三区| 国产精品自拍毛片| 免费观看日韩av| 天堂午夜影视日韩欧美一区二区| 91小视频免费观看| 国产99久久久国产精品免费看| 久久理论电影网| 日韩精品自拍偷拍| 91精品国产色综合久久不卡电影 | 欧美性生交片4| 99re这里只有精品6| 国产a区久久久| 国产成人精品网址| 国产a精品视频| 成人视屏免费看| 国产成人精品综合在线观看 | 91精品国模一区二区三区| 91网站最新网址| 暴力调教一区二区三区| 成人夜色视频网站在线观看| 国产精品1区2区3区| 国产成人精品三级| 成人听书哪个软件好| 99re视频精品| 91免费观看国产| 欧美视频在线播放| 5566中文字幕一区二区电影| 欧美日韩亚洲综合一区二区三区| 麻豆视频观看网址久久| 日本中文字幕一区二区视频| 亚洲成年人影院| 六月丁香婷婷色狠狠久久| 久久精品国产免费| 国产在线精品一区二区夜色| 国产尤物一区二区| av在线一区二区三区| 日本韩国欧美在线| 日韩欧美一级二级| 久久久久久免费网| 亚洲天堂av老司机| 五月婷婷综合激情| 国产在线看一区| 一本到不卡精品视频在线观看| 日韩不卡手机在线v区| 国产一区二区影院| 一本到三区不卡视频| 91精品国产综合久久久蜜臀图片| 国产精品一线二线三线精华| 成人免费黄色在线| 精品1区2区3区| 久久久综合视频| 亚洲欧美视频一区| 免费观看久久久4p| 97国产一区二区| 日韩女同互慰一区二区| 国产精品麻豆一区二区| 午夜欧美大尺度福利影院在线看| 国产精品国产精品国产专区不片| 日韩欧美精品在线| 国产精品久久久久久久久免费相片| 在线91免费看| 国产精品成人在线观看| 日韩精品免费视频人成| 国产成人欧美日韩在线电影| 欧美日韩成人高清| 国产精品久久久久9999吃药|