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

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

?? rpng-win.c

?? Borland C++BuilderT 6 Developer s Guide
?? C
?? 第 1 頁 / 共 2 頁
字號:
        exit(2);
    }


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

    if (rpng_win_create_window(hInst, showmode))
        exit(2);


    /* decode the image, all at once */

    Trace((stderr, "calling readpng_get_image()\n"))
    image_data = readpng_get_image(display_exponent, &image_channels,
      &image_rowbytes);
    Trace((stderr, "done with readpng_get_image()\n"))


    /* done with PNG file, so clean up to minimize memory usage (but do NOT
     * nuke image_data!) */

    readpng_cleanup(FALSE);
    fclose(infile);

    if (!image_data) {
        fprintf(stderr, PROGNAME ":  unable to decode PNG image\n");
        exit(3);
    }


    /* display image (composite with background if requested) */

    Trace((stderr, "calling rpng_win_display_image()\n"))
    if (rpng_win_display_image()) {
        free(image_data);
        exit(4);
    }
    Trace((stderr, "done with rpng_win_display_image()\n"))


    /* wait for the user to tell us when to quit */

    printf(
      "Done.  Press Q, Esc or mouse button 1 (within image window) to quit.\n");
    fflush(stdout);

    while (GetMessage(&msg, NULL, 0, 0)) {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }


    /* OK, we're done:  clean up all image and Windows resources and go away */

    rpng_win_cleanup();

    return msg.wParam;
}





static int rpng_win_create_window(HINSTANCE hInst, int showmode)
{
    uch *dest;
    int extra_width, extra_height;
    ulg i, j;
    WNDCLASSEX wndclass;


/*---------------------------------------------------------------------------
    Allocate memory for the display-specific version of the image (round up
    to multiple of 4 for Windows DIB).
  ---------------------------------------------------------------------------*/

    wimage_rowbytes = ((3*image_width + 3L) >> 2) << 2;

    if (!(dib = (uch *)malloc(sizeof(BITMAPINFOHEADER) +
                              wimage_rowbytes*image_height)))
    {
        return 4;   /* fail */
    }

/*---------------------------------------------------------------------------
    Initialize the DIB.  Negative height means to use top-down BMP ordering
    (must be uncompressed, but that's what we want).  Bit count of 1, 4 or 8
    implies a colormap of RGBX quads, but 24-bit BMPs just use B,G,R values
    directly => wimage_data begins immediately after BMP header.
  ---------------------------------------------------------------------------*/

    memset(dib, 0, sizeof(BITMAPINFOHEADER));
    bmih = (BITMAPINFOHEADER *)dib;
    bmih->biSize = sizeof(BITMAPINFOHEADER);
    bmih->biWidth = image_width;
    bmih->biHeight = -((long)image_height);
    bmih->biPlanes = 1;
    bmih->biBitCount = 24;
    bmih->biCompression = 0;
    wimage_data = dib + sizeof(BITMAPINFOHEADER);

/*---------------------------------------------------------------------------
    Fill in background color (black by default); data are in BGR order.
  ---------------------------------------------------------------------------*/

    for (j = 0;  j < image_height;  ++j) {
        dest = wimage_data + j*wimage_rowbytes;
        for (i = image_width;  i > 0;  --i) {
            *dest++ = bg_blue;
            *dest++ = bg_green;
            *dest++ = bg_red;
        }
    }

/*---------------------------------------------------------------------------
    Set the window parameters.
  ---------------------------------------------------------------------------*/

    memset(&wndclass, 0, sizeof(wndclass));

    wndclass.cbSize = sizeof(wndclass);
    wndclass.style = CS_HREDRAW | CS_VREDRAW;
    wndclass.lpfnWndProc = rpng_win_wndproc;
    wndclass.hInstance = hInst;
    wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
    wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
    wndclass.hbrBackground = (HBRUSH)GetStockObject(DKGRAY_BRUSH);
    wndclass.lpszMenuName = NULL;
    wndclass.lpszClassName = progname;
    wndclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);

    RegisterClassEx(&wndclass);

/*---------------------------------------------------------------------------
    Finally, create the window.
  ---------------------------------------------------------------------------*/

    extra_width  = 2*(GetSystemMetrics(SM_CXBORDER) +
                      GetSystemMetrics(SM_CXDLGFRAME));
    extra_height = 2*(GetSystemMetrics(SM_CYBORDER) +
                      GetSystemMetrics(SM_CYDLGFRAME)) +
                      GetSystemMetrics(SM_CYCAPTION);

    global_hwnd = CreateWindow(progname, titlebar, WS_OVERLAPPEDWINDOW,
      CW_USEDEFAULT, CW_USEDEFAULT, image_width+extra_width,
      image_height+extra_height, NULL, NULL, hInst, NULL);

    ShowWindow(global_hwnd, showmode);
    UpdateWindow(global_hwnd);

    return 0;

} /* end function rpng_win_create_window() */





static int rpng_win_display_image()
{
    uch *src, *dest;
    uch r, g, b, a;
    ulg i, row, lastrow;
    RECT rect;


    Trace((stderr, "beginning display loop (image_channels == %d)\n",
      image_channels))
    Trace((stderr, "(width = %ld, rowbytes = %ld, wimage_rowbytes = %d)\n",
      image_width, image_rowbytes, wimage_rowbytes))


/*---------------------------------------------------------------------------
    Blast image data to buffer.  This whole routine takes place before the
    message loop begins, so there's no real point in any pseudo-progressive
    display...
  ---------------------------------------------------------------------------*/

    for (lastrow = row = 0;  row < image_height;  ++row) {
        src = image_data + row*image_rowbytes;
        dest = wimage_data + row*wimage_rowbytes;
        if (image_channels == 3) {
            for (i = image_width;  i > 0;  --i) {
                r = *src++;
                g = *src++;
                b = *src++;
                *dest++ = b;
                *dest++ = g;   /* note reverse order */
                *dest++ = r;
            }
        } else /* if (image_channels == 4) */ {
            for (i = image_width;  i > 0;  --i) {
                r = *src++;
                g = *src++;
                b = *src++;
                a = *src++;
                if (a == 255) {
                    *dest++ = b;
                    *dest++ = g;
                    *dest++ = r;
                } else if (a == 0) {
                    *dest++ = bg_blue;
                    *dest++ = bg_green;
                    *dest++ = bg_red;
                } else {
                    /* this macro (copied from png.h) composites the
                     * foreground and background values and puts the
                     * result into the first argument; there are no
                     * side effects with the first argument */
                    alpha_composite(*dest++, b, a, bg_blue);
                    alpha_composite(*dest++, g, a, bg_green);
                    alpha_composite(*dest++, r, a, bg_red);
                }
            }
        }
        /* display after every 16 lines */
        if (((row+1) & 0xf) == 0) {
            rect.left = 0L;
            rect.top = (LONG)lastrow;
            rect.right = (LONG)image_width;      /* possibly off by one? */
            rect.bottom = (LONG)lastrow + 16L;   /* possibly off by one? */
            InvalidateRect(global_hwnd, &rect, FALSE);
            UpdateWindow(global_hwnd);     /* similar to XFlush() */
            lastrow = row + 1;
        }
    }

    Trace((stderr, "calling final image-flush routine\n"))
    if (lastrow < image_height) {
        rect.left = 0L;
        rect.top = (LONG)lastrow;
        rect.right = (LONG)image_width;      /* possibly off by one? */
        rect.bottom = (LONG)image_height;    /* possibly off by one? */
        InvalidateRect(global_hwnd, &rect, FALSE);
        UpdateWindow(global_hwnd);     /* similar to XFlush() */
    }

/*
    last param determines whether or not background is wiped before paint
    InvalidateRect(global_hwnd, NULL, TRUE);
    UpdateWindow(global_hwnd);
 */

    return 0;
}





static void rpng_win_cleanup()
{
    if (image_data) {
        free(image_data);
        image_data = NULL;
    }

    if (dib) {
        free(dib);
        dib = NULL;
    }
}





LRESULT CALLBACK rpng_win_wndproc(HWND hwnd, UINT iMsg, WPARAM wP, LPARAM lP)
{
    HDC         hdc;
    PAINTSTRUCT ps;
    int rc;

    switch (iMsg) {
        case WM_CREATE:
            /* one-time processing here, if any */
            return 0;

        case WM_PAINT:
            hdc = BeginPaint(hwnd, &ps);
                    /*                    dest                          */
            rc = StretchDIBits(hdc, 0, 0, image_width, image_height,
                    /*                    source                        */
                                    0, 0, image_width, image_height,
                                    wimage_data, (BITMAPINFO *)bmih,
                    /*              iUsage: no clue                     */
                                    0, SRCCOPY);
            EndPaint(hwnd, &ps);
            return 0;

        /* wait for the user to tell us when to quit */
        case WM_CHAR:
            switch (wP) {      /* only need one, so ignore repeat count */
                case 'q':
                case 'Q':
                case 0x1B:     /* Esc key */
                    PostQuitMessage(0);
            }
            return 0;

        case WM_LBUTTONDOWN:   /* another way of quitting */
        case WM_DESTROY:
            PostQuitMessage(0);
            return 0;
    }

    return DefWindowProc(hwnd, iMsg, wP, lP);
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧洲日韩综合一区二区| 欧美激情综合在线| 色婷婷精品久久二区二区蜜臂av | 国产精品美女一区二区三区| 欧美一卡2卡三卡4卡5免费| 欧美精选一区二区| 制服视频三区第一页精品| 91.麻豆视频| 日韩精品一区二区三区在线 | 国产成人精品午夜视频免费| 老司机精品视频导航| 美日韩一区二区三区| 免播放器亚洲一区| 国产伦精品一区二区三区在线观看| 狠狠狠色丁香婷婷综合久久五月| 国产资源在线一区| 成人黄色在线视频| 91在线视频网址| 欧美日韩情趣电影| 777a∨成人精品桃花网| 日韩女优av电影| 精品国产一区久久| 日韩理论片一区二区| 亚洲香蕉伊在人在线观| 亚洲成人动漫在线观看| 麻豆91精品91久久久的内涵| 狠狠色狠狠色综合| 波多野结衣亚洲| 欧美美女一区二区在线观看| 精品国内二区三区| 亚洲美女区一区| 老司机一区二区| 成人国产精品免费网站| 91精品国产91热久久久做人人| 精品不卡在线视频| 亚洲一区二区三区在线播放| 老汉av免费一区二区三区| 91一区二区三区在线观看| 4438x亚洲最大成人网| 欧美国产丝袜视频| 亚洲成av人片在www色猫咪| 精品一区二区三区在线视频| 99久久精品国产毛片| 日韩欧美在线123| 亚洲欧美日本韩国| 国产精品亚洲成人| 日韩欧美一级二级| 亚洲制服丝袜av| 成人性生交大片免费看中文| 欧美精品高清视频| 亚洲理论在线观看| 成人app网站| 精品国产电影一区二区| 香蕉久久一区二区不卡无毒影院 | 日韩免费在线观看| 亚洲综合色区另类av| 成人动漫av在线| 日韩精品中午字幕| 午夜精品久久久久久| 99re热视频精品| 欧美激情综合在线| 国产91在线|亚洲| 久久精品一区二区三区av| 美国三级日本三级久久99| 欧美精品 国产精品| 亚洲一区二区三区视频在线播放 | 欧美日韩在线播放三区| 国产精品久久久久久久久晋中| 国内精品久久久久影院一蜜桃| 欧美日韩精品一区视频| 亚洲一区二区精品视频| 色综合激情五月| 一区二区三区中文字幕电影| 成人h动漫精品| 中文字幕一区二区三区蜜月| 国产成a人亚洲精| 国产午夜亚洲精品午夜鲁丝片| 韩国欧美国产1区| 国产性色一区二区| 国产69精品久久久久777| 久久免费电影网| 成人午夜激情影院| 亚洲丝袜制服诱惑| 色婷婷久久综合| 亚洲最快最全在线视频| 精品视频一区三区九区| 亚洲一二三区在线观看| 欧美日韩国产高清一区二区三区| 视频一区中文字幕国产| 欧美精品777| 国产一区中文字幕| 国产精品看片你懂得| 91亚洲国产成人精品一区二三| 中文字幕精品—区二区四季| av爱爱亚洲一区| 亚洲一区二区精品视频| 欧美变态凌虐bdsm| 高清视频一区二区| 亚洲自拍偷拍欧美| 欧美成人女星排行榜| 国产1区2区3区精品美女| 亚洲精品成人a在线观看| 欧美一区二区三区免费观看视频| 国产精品中文字幕欧美| 亚洲精品视频免费观看| 日韩精品中文字幕在线不卡尤物| 国产精品资源网| 亚洲精品成人天堂一二三| 欧美日韩美女一区二区| 国产一区二区三区日韩| 亚洲精品免费电影| 欧美本精品男人aⅴ天堂| 北岛玲一区二区三区四区| 婷婷丁香激情综合| 欧美国产视频在线| 在线综合+亚洲+欧美中文字幕| 国产福利一区在线| 午夜婷婷国产麻豆精品| 中文字幕巨乱亚洲| 日韩欧美一级精品久久| 在线免费观看一区| 国产乱一区二区| 婷婷久久综合九色综合伊人色| 26uuu色噜噜精品一区| 欧美丝袜丝nylons| 99国产精品视频免费观看| 奇米在线7777在线精品| 亚洲精品精品亚洲| 久久久99免费| 欧美日韩激情一区| 91免费看`日韩一区二区| 国内久久精品视频| 欧美aaaaaa午夜精品| 亚洲一级二级在线| 国产精品久久久久久久久久久免费看| 日韩一区二区中文字幕| 欧美亚洲另类激情小说| 91视频在线看| 国产成人综合精品三级| 久草中文综合在线| 日韩高清电影一区| 亚洲一区二区三区视频在线| 亚洲色图在线视频| 国产精品国产自产拍高清av王其 | 国产精品激情偷乱一区二区∴| 精品免费视频一区二区| 91精品国模一区二区三区| 欧美三级蜜桃2在线观看| 91高清视频免费看| 91网站在线观看视频| 色综合网色综合| 一本久道中文字幕精品亚洲嫩| 99精品欧美一区二区蜜桃免费| 国产91丝袜在线播放九色| 国产在线不卡一区| 国产精品 日产精品 欧美精品| 国产一区二区三区久久久| 精品在线观看视频| 激情五月播播久久久精品| 国产成人h网站| 99热这里都是精品| 91传媒视频在线播放| 欧美午夜宅男影院| 欧美激情一区不卡| 亚洲日本韩国一区| 一区二区三区av电影 | 日韩一级片网站| 精品国产污污免费网站入口| 久久久久久一级片| 中文字幕二三区不卡| 亚洲日本一区二区| 亚洲一区二区不卡免费| 日本欧美大码aⅴ在线播放| 免费的国产精品| 国产精品99久久久久久似苏梦涵| 国产不卡在线一区| 91黄色免费版| 91精品国产色综合久久ai换脸| 日韩欧美国产午夜精品| 国产欧美一区在线| 一区二区三区欧美亚洲| 秋霞电影一区二区| 国产精品99久| 91福利视频网站| 久久只精品国产| 亚洲精品乱码久久久久久日本蜜臀| 亚洲超碰精品一区二区| 国产麻豆欧美日韩一区| 日本电影亚洲天堂一区| 日韩一级免费一区| 国产精品你懂的| 日韩精品电影在线观看| 成人免费视频视频在线观看免费 | 国产精品资源网| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 亚洲乱码国产乱码精品精可以看| 天堂在线亚洲视频| av电影一区二区| 欧美不卡一区二区三区四区| 亚洲色图色小说|