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

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

?? rpng-win.c

?? 教你如何簡單顯示一章TIFF位圖,分析的很透徹,很適合出學者.希望能給你帶來幫助!
?? C
?? 第 1 頁 / 共 2 頁
字號:

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

    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一区二区三区免费野_久草精品视频
亚洲五码中文字幕| 国产激情视频一区二区在线观看 | 风间由美一区二区av101| 91社区在线播放| 精品国产乱码久久久久久久久| 国产精品久99| 国产精品一区二区黑丝| 91精品在线观看入口| 中文字幕字幕中文在线中不卡视频| 日本vs亚洲vs韩国一区三区| 91麻豆免费观看| 中文在线资源观看网站视频免费不卡| 蜜桃视频在线观看一区二区| 欧美中文字幕亚洲一区二区va在线| 国产区在线观看成人精品 | 亚洲欧美日韩一区| 国产剧情一区二区三区| 欧美一区2区视频在线观看| 一区二区成人在线观看| 92国产精品观看| 国产欧美日韩麻豆91| 另类欧美日韩国产在线| 欧美男男青年gay1069videost| 亚洲欧洲成人自拍| 春色校园综合激情亚洲| 国产人久久人人人人爽| 粉嫩在线一区二区三区视频| 久久亚洲精精品中文字幕早川悠里 | 亚洲激情第一区| 99精品黄色片免费大全| 国产精品欧美久久久久无广告 | 成人看片黄a免费看在线| 精品成人a区在线观看| 精品中文字幕一区二区小辣椒| 制服丝袜亚洲精品中文字幕| 肉丝袜脚交视频一区二区| 欧美日韩第一区日日骚| 日韩黄色免费电影| 日韩欧美专区在线| 国产一区二区三区视频在线播放| 26uuu国产一区二区三区| 精品一区二区三区免费毛片爱| 欧美视频一区二区三区四区| 亚洲第一狼人社区| 91精品国产aⅴ一区二区| 老司机精品视频线观看86| 精品久久久影院| 国产v综合v亚洲欧| 亚洲女同一区二区| 欧美日韩高清影院| 美腿丝袜一区二区三区| 日韩免费性生活视频播放| 国产一区二区三区四区五区入口| 欧美激情综合五月色丁香小说| 成人妖精视频yjsp地址| 亚洲激情成人在线| 日韩亚洲欧美中文三级| 国产中文一区二区三区| 国产精品久久久久久久久动漫| 色噜噜狠狠色综合欧洲selulu| 丝袜美腿亚洲综合| 久久亚洲欧美国产精品乐播| 99久久综合色| 琪琪久久久久日韩精品| 欧美国产日韩亚洲一区| 色综合色狠狠天天综合色| 免费xxxx性欧美18vr| 久久久精品国产免大香伊| 91在线视频播放地址| 天天影视色香欲综合网老头| 精品处破学生在线二十三| 91在线免费播放| 免费人成在线不卡| 国产精品电影一区二区| 欧美一区二区在线观看| 不卡大黄网站免费看| 日韩av电影一区| 亚洲视频你懂的| 亚洲精品在线免费播放| 91视频一区二区三区| 国产一区久久久| 亚洲1区2区3区4区| 国产精品另类一区| 欧美大白屁股肥臀xxxxxx| 91影院在线观看| 国产成a人无v码亚洲福利| 亚洲国产成人高清精品| 欧美激情在线观看视频免费| 欧美一区二区视频免费观看| 欧美日韩在线精品一区二区三区激情| 精品在线播放免费| 图片区小说区国产精品视频| 亚洲欧洲另类国产综合| 国产无一区二区| 日韩久久免费av| 欧美高清视频在线高清观看mv色露露十八| 大胆亚洲人体视频| 国产剧情一区在线| 久久精品国产亚洲一区二区三区| 亚洲va国产va欧美va观看| 久久精品欧美一区二区三区麻豆| 538在线一区二区精品国产| 日本精品一区二区三区高清 | 欧美性色aⅴ视频一区日韩精品| 丁香另类激情小说| 国产露脸91国语对白| 久久国产精品99久久久久久老狼| 亚洲国产精品久久久久秋霞影院| 亚洲精品视频一区二区| 日韩理论片中文av| 中文字幕一区在线| 亚洲欧美国产毛片在线| 国产精品传媒视频| 国产精品久久久久永久免费观看 | 免费av成人在线| 蜜桃av一区二区在线观看| 日韩电影在线一区二区| 五月激情六月综合| 日韩成人精品在线观看| 日本不卡一区二区| 麻豆精品一二三| 国产在线精品一区二区不卡了 | 亚洲成人精品一区| 五月天中文字幕一区二区| 亚洲成人www| 日韩中文字幕区一区有砖一区| 日本vs亚洲vs韩国一区三区二区| 久久精品国产77777蜜臀| 黄色日韩网站视频| 国产xxx精品视频大全| 99re视频精品| 欧美日韩中文字幕一区| 日韩欧美一二三区| 久久尤物电影视频在线观看| 国产精品久久久久久久久免费桃花| 中文字幕亚洲不卡| 亚洲乱码国产乱码精品精的特点 | 欧美体内she精高潮| 在线观看91av| 亚洲精品一区二区三区香蕉| 亚洲国产精品成人综合| 国产精品毛片无遮挡高清| 亚洲黄网站在线观看| 蜜臀久久久99精品久久久久久| 激情六月婷婷综合| 91视频.com| 亚洲精品一区二区三区99| 中文字幕视频一区| 日韩精品成人一区二区三区| 国产精品亚洲а∨天堂免在线| eeuss鲁片一区二区三区| 欧美日韩精品一区二区| 久久久久亚洲蜜桃| 亚洲大片在线观看| 国产福利一区二区| 欧美亚洲日本一区| 久久精品夜夜夜夜久久| 一个色综合av| 国产精品香蕉一区二区三区| 欧美日韩一区二区在线观看视频| 久久久久久久久久美女| 亚洲图片欧美一区| 成人免费看黄yyy456| 91麻豆精品久久久久蜜臀| 18成人在线视频| 国产美女久久久久| 5858s免费视频成人| 亚洲视频中文字幕| 国产一区二三区好的| 欧美日韩亚洲综合一区| 国产精品沙发午睡系列990531| 天天爽夜夜爽夜夜爽精品视频| 成人教育av在线| 欧美tk丨vk视频| 国产精品久久久久久久午夜片| 日韩国产高清在线| 欧美日精品一区视频| 综合网在线视频| 成人自拍视频在线| 精品捆绑美女sm三区| 午夜私人影院久久久久| 91小视频在线| 国产精品欧美综合在线| 国产美女视频91| www久久精品| 激情另类小说区图片区视频区| 欧美卡1卡2卡| 国产精品美女久久久久av爽李琼| 久草精品在线观看| 日韩精品中文字幕在线不卡尤物| 亚洲午夜精品在线| 在线视频你懂得一区| 亚洲精品免费看| 色综合av在线| 亚洲精品久久久久久国产精华液| 高清国产一区二区| 亚洲国产精品二十页| 粉嫩aⅴ一区二区三区四区| 久久新电视剧免费观看| 国产精品一品二品|