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

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

?? visualpng.c

?? Borland C++BuilderT 6 Developer s Guide
?? C
?? 第 1 頁 / 共 2 頁
字號:
//------------------------------------
//  VisualPng.C -- Shows a PNG image
//------------------------------------

// Copyright 2000, Willem van Schaik.  For conditions of distribution and
// use, see the copyright/license/disclaimer notice in png.h

// switches

// defines

#define PROGNAME  "VisualPng"
#define LONGNAME  "Win32 Viewer for PNG-files"
#define VERSION   "1.0 of 2000 June 07"

// constants

#define MARGIN 8

// standard includes

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <windows.h>

// application includes

#include "png.h"
#include "pngfile.h"
#include "resource.h"

// macros

// function prototypes

LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM);
BOOL    CALLBACK AboutDlgProc (HWND, UINT, WPARAM, LPARAM) ;

BOOL CenterAbout (HWND hwndChild, HWND hwndParent);

BOOL BuildPngList (PTSTR pstrPathName, TCHAR **ppFileList, int *pFileCount,
        int *pFileIndex);

BOOL SearchPngList (TCHAR *pFileList, int FileCount, int *pFileIndex,
        PTSTR pstrPrevName, PTSTR pstrNextName);

BOOL LoadImageFile(HWND hwnd, PTSTR pstrPathName,
        png_byte **ppbImage, int *pxImgSize, int *pyImgSize, int *piChannels,
        png_color *pBkgColor);

BOOL DisplayImage (HWND hwnd, BYTE **ppDib,
        BYTE **ppDiData, int cxWinSize, int cyWinSize,
        BYTE *pbImage, int cxImgSize, int cyImgSize, int cImgChannels,
        BOOL bStretched);

BOOL InitBitmap (
        BYTE *pDiData, int cxWinSize, int cyWinSize);

BOOL FillBitmap (
        BYTE *pDiData, int cxWinSize, int cyWinSize,
        BYTE *pbImage, int cxImgSize, int cyImgSize, int cImgChannels,
        BOOL bStretched);

// a few global variables

static char *szProgName = PROGNAME;
static char *szAppName = LONGNAME;
static char *szIconName = PROGNAME;
static char szCmdFileName [MAX_PATH];

// MAIN routine

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    PSTR szCmdLine, int iCmdShow)
{
    HACCEL   hAccel;
    HWND     hwnd;
    MSG      msg;
    WNDCLASS wndclass;
    int ixBorders, iyBorders;

    wndclass.style         = CS_HREDRAW | CS_VREDRAW;
    wndclass.lpfnWndProc   = WndProc;
    wndclass.cbClsExtra    = 0;
    wndclass.cbWndExtra    = 0;
    wndclass.hInstance     = hInstance;
    wndclass.hIcon         = LoadIcon (hInstance, szIconName) ;
    wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW);
    wndclass.hbrBackground = NULL; // (HBRUSH) GetStockObject (GRAY_BRUSH);
    wndclass.lpszMenuName  = szProgName;
    wndclass.lpszClassName = szProgName;

    if (!RegisterClass (&wndclass))
    {
        MessageBox (NULL, TEXT ("Error: this program requires Windows NT!"),
            szProgName, MB_ICONERROR);
        return 0;
    }

    // if filename given on commandline, store it
    if ((szCmdLine != NULL) && (*szCmdLine != '\0'))
        if (szCmdLine[0] == '"')
            strncpy (szCmdFileName, szCmdLine + 1, strlen(szCmdLine) - 2);
        else
            strcpy (szCmdFileName, szCmdLine);
    else
        strcpy (szCmdFileName, "");

    // calculate size of window-borders
    ixBorders = 2 * (GetSystemMetrics (SM_CXBORDER) +
                     GetSystemMetrics (SM_CXDLGFRAME));
    iyBorders = 2 * (GetSystemMetrics (SM_CYBORDER) +
                     GetSystemMetrics (SM_CYDLGFRAME)) +
                     GetSystemMetrics (SM_CYCAPTION) +
                     GetSystemMetrics (SM_CYMENUSIZE) +
                     1; /* WvS: don't ask me why? */

    hwnd = CreateWindow (szProgName, szAppName,
        WS_OVERLAPPEDWINDOW,
        CW_USEDEFAULT, CW_USEDEFAULT,
        512 + 2 * MARGIN + ixBorders, 384 + 2 * MARGIN + iyBorders,
//      CW_USEDEFAULT, CW_USEDEFAULT,
        NULL, NULL, hInstance, NULL);

    ShowWindow (hwnd, iCmdShow);
    UpdateWindow (hwnd);

    hAccel = LoadAccelerators (hInstance, szProgName);

    while (GetMessage (&msg, NULL, 0, 0))
    {
        if (!TranslateAccelerator (hwnd, hAccel, &msg))
        {
            TranslateMessage (&msg);
            DispatchMessage (&msg);
        }
    }
    return msg.wParam;
}

LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
        LPARAM lParam)
{
    static HINSTANCE          hInstance ;
    static HDC                hdc;
    static PAINTSTRUCT        ps;
    static HMENU              hMenu;

    static BITMAPFILEHEADER  *pbmfh;
    static BITMAPINFOHEADER  *pbmih;
    static BYTE              *pbImage;
    static int                cxWinSize, cyWinSize;
    static int                cxImgSize, cyImgSize;
    static int                cImgChannels;
    static png_color          bkgColor = {127, 127, 127};

    static BOOL               bStretched = TRUE;

    static BYTE              *pDib = NULL;
    static BYTE              *pDiData = NULL;

    static TCHAR              szImgPathName [MAX_PATH];
    static TCHAR              szTitleName [MAX_PATH];

    static TCHAR             *pPngFileList = NULL;
    static int                iPngFileCount;
    static int                iPngFileIndex;

    BOOL                      bOk;

    switch (message)
    {
    case WM_CREATE:
        hInstance = ((LPCREATESTRUCT) lParam)->hInstance ;
        PngFileInitialize (hwnd);

        strcpy (szImgPathName, "");

        // in case we process file given on command-line

        if (szCmdFileName[0] != '\0')
        {
            strcpy (szImgPathName, szCmdFileName);

            // read the other png-files in the directory for later
            // next/previous commands

            BuildPngList (szImgPathName, &pPngFileList, &iPngFileCount,
                          &iPngFileIndex);

            // load the image from file

            if (!LoadImageFile (hwnd, szImgPathName,
                &pbImage, &cxImgSize, &cyImgSize, &cImgChannels, &bkgColor))
                return 0;

            // invalidate the client area for later update

            InvalidateRect (hwnd, NULL, TRUE);

            // display the PNG into the DIBitmap

            DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
                pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
        }

        return 0;

    case WM_SIZE:
        cxWinSize = LOWORD (lParam);
        cyWinSize = HIWORD (lParam);

        // invalidate the client area for later update

        InvalidateRect (hwnd, NULL, TRUE);

        // display the PNG into the DIBitmap

        DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
            pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);

        return 0;

    case WM_INITMENUPOPUP:
        hMenu = GetMenu (hwnd);

        if (pbImage)
            EnableMenuItem (hMenu, IDM_FILE_SAVE, MF_ENABLED);
        else
            EnableMenuItem (hMenu, IDM_FILE_SAVE, MF_GRAYED);

        return 0;

    case WM_COMMAND:
        hMenu = GetMenu (hwnd);

        switch (LOWORD (wParam))
        {
        case IDM_FILE_OPEN:

            // show the File Open dialog box

            if (!PngFileOpenDlg (hwnd, szImgPathName, szTitleName))
                return 0;

            // read the other png-files in the directory for later
            // next/previous commands

            BuildPngList (szImgPathName, &pPngFileList, &iPngFileCount,
                          &iPngFileIndex);

            // load the image from file

            if (!LoadImageFile (hwnd, szImgPathName,
                &pbImage, &cxImgSize, &cyImgSize, &cImgChannels, &bkgColor))
                return 0;

            // invalidate the client area for later update

            InvalidateRect (hwnd, NULL, TRUE);

            // display the PNG into the DIBitmap

            DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
                pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);

            return 0;

        case IDM_FILE_SAVE:

            // show the File Save dialog box

            if (!PngFileSaveDlg (hwnd, szImgPathName, szTitleName))
                return 0;

            // save the PNG to a disk file

            SetCursor (LoadCursor (NULL, IDC_WAIT));
            ShowCursor (TRUE);

            bOk = PngSaveImage (szImgPathName, pDiData, cxWinSize, cyWinSize,
                  bkgColor);

            ShowCursor (FALSE);
            SetCursor (LoadCursor (NULL, IDC_ARROW));

            if (!bOk)
                MessageBox (hwnd, TEXT ("Error in saving the PNG image"),
                szProgName, MB_ICONEXCLAMATION | MB_OK);
            return 0;

        case IDM_FILE_NEXT:

            // read next entry in the directory

            if (SearchPngList (pPngFileList, iPngFileCount, &iPngFileIndex,
                NULL, szImgPathName))
            {
                if (strcmp (szImgPathName, "") == 0)
                    return 0;
                
                // load the image from file
                
                if (!LoadImageFile (hwnd, szImgPathName, &pbImage,
                        &cxImgSize, &cyImgSize, &cImgChannels, &bkgColor))
                    return 0;
                
                // invalidate the client area for later update
                
                InvalidateRect (hwnd, NULL, TRUE);
                
                // display the PNG into the DIBitmap
                
                DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
                    pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
            }
            
            return 0;

        case IDM_FILE_PREVIOUS:

            // read previous entry in the directory

            if (SearchPngList (pPngFileList, iPngFileCount, &iPngFileIndex,
                szImgPathName, NULL))
            {
                
                if (strcmp (szImgPathName, "") == 0)
                    return 0;
                
                // load the image from file
                
                if (!LoadImageFile (hwnd, szImgPathName, &pbImage, &cxImgSize,
                    &cyImgSize, &cImgChannels, &bkgColor))
                    return 0;
                
                // invalidate the client area for later update
                
                InvalidateRect (hwnd, NULL, TRUE);
                
                // display the PNG into the DIBitmap
                
                DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
                    pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
            }

            return 0;

        case IDM_FILE_EXIT:

            // more cleanup needed...

            // free image buffer

            if (pDib != NULL)
            {
                free (pDib);
                pDib = NULL;
            }

            // free file-list

            if (pPngFileList != NULL)
            {
                free (pPngFileList);
                pPngFileList = NULL;
            }

            // let's go ...

            exit (0);

            return 0;

        case IDM_OPTIONS_STRETCH:
            bStretched = !bStretched;
            if (bStretched)
                CheckMenuItem (hMenu, IDM_OPTIONS_STRETCH, MF_CHECKED);
            else
                CheckMenuItem (hMenu, IDM_OPTIONS_STRETCH, MF_UNCHECKED);

            // invalidate the client area for later update

            InvalidateRect (hwnd, NULL, TRUE);

            // display the PNG into the DIBitmap

            DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
                pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);

            return 0;

        case IDM_HELP_ABOUT:
            DialogBox (hInstance, TEXT ("AboutBox"), hwnd, AboutDlgProc) ;
            return 0;

        } // end switch

        break;

    case WM_PAINT:
        hdc = BeginPaint (hwnd, &ps);

        if (pDib)
            SetDIBitsToDevice (hdc, 0, 0, cxWinSize, cyWinSize, 0, 0,
                0, cyWinSize, pDiData, (BITMAPINFO *) pDib, DIB_RGB_COLORS);

        EndPaint (hwnd, &ps);
        return 0;

    case WM_DESTROY:
        if (pbmfh)
        {
            free (pbmfh);
            pbmfh = NULL;
        }

        PostQuitMessage (0);
        return 0;
    }

    return DefWindowProc (hwnd, message, wParam, lParam);
}

BOOL CALLBACK AboutDlgProc (HWND hDlg, UINT message,
                            WPARAM wParam, LPARAM lParam)
{
     switch (message)
     {
     case WM_INITDIALOG :
          ShowWindow (hDlg, SW_HIDE);
          CenterAbout (hDlg, GetWindow (hDlg, GW_OWNER));
          ShowWindow (hDlg, SW_SHOW);
          return TRUE ;

     case WM_COMMAND :
          switch (LOWORD (wParam))
          {
          case IDOK :
          case IDCANCEL :
               EndDialog (hDlg, 0) ;
               return TRUE ;
          }
          break ;
     }
     return FALSE ;
}

//---------------
//  CenterAbout
//---------------

BOOL CenterAbout (HWND hwndChild, HWND hwndParent)
{
   RECT    rChild, rParent, rWorkArea;
   int     wChild, hChild, wParent, hParent;
   int     xNew, yNew;
   BOOL  bResult;

   // Get the Height and Width of the child window
   GetWindowRect (hwndChild, &rChild);
   wChild = rChild.right - rChild.left;
   hChild = rChild.bottom - rChild.top;

   // Get the Height and Width of the parent window
   GetWindowRect (hwndParent, &rParent);
   wParent = rParent.right - rParent.left;
   hParent = rParent.bottom - rParent.top;

   // Get the limits of the 'workarea'
   bResult = SystemParametersInfo(
      SPI_GETWORKAREA,  // system parameter to query or set
      sizeof(RECT),
      &rWorkArea,
      0);
   if (!bResult) {
      rWorkArea.left = rWorkArea.top = 0;
      rWorkArea.right = GetSystemMetrics(SM_CXSCREEN);
      rWorkArea.bottom = GetSystemMetrics(SM_CYSCREEN);
   }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩一区二区精品| 国产精品午夜免费| 成人性视频免费网站| 亚洲第一激情av| 欧美激情中文不卡| 日韩一区二区不卡| 91在线小视频| 国产电影一区在线| 天堂va蜜桃一区二区三区漫画版| 国产精品嫩草影院com| 欧美一卡2卡三卡4卡5免费| 99re视频这里只有精品| 国产美女在线观看一区| 亚洲大尺度视频在线观看| 18成人在线观看| 国产三级精品在线| 精品区一区二区| 欧美精品视频www在线观看| 色噜噜久久综合| 99久久精品国产观看| 国产在线一区观看| 青娱乐精品视频| 亚洲成人你懂的| 亚洲免费观看高清完整版在线 | 色哟哟国产精品免费观看| 国产剧情av麻豆香蕉精品| 裸体一区二区三区| 日韩av一区二区在线影视| 亚洲第一主播视频| 亚洲一区二区三区激情| 伊人夜夜躁av伊人久久| 亚洲精品综合在线| 亚洲色图欧美激情| 亚洲欧美另类久久久精品| 中文字幕一区二区三区四区 | 日韩精品资源二区在线| 欧美久久久久久久久久| 欧美日韩五月天| 欧美日韩成人在线| 欧美欧美欧美欧美| 欧美精选一区二区| 日韩亚洲欧美中文三级| 日韩精品一区二区三区四区视频 | 国产精品美女久久福利网站| 久久精品免费在线观看| 中文久久乱码一区二区| 国产精品久久久久国产精品日日| 亚洲欧美自拍偷拍色图| 亚洲精品中文在线影院| 香蕉久久夜色精品国产使用方法 | 欧美区一区二区三区| 欧美日韩美少妇| 制服丝袜成人动漫| 精品盗摄一区二区三区| 欧美国产一区二区在线观看| 国产精品福利影院| 一区二区三区国产| 日本午夜精品一区二区三区电影| 久久精品99久久久| 成人免费电影视频| 色婷婷久久99综合精品jk白丝| 在线观看一区日韩| 日韩午夜激情av| 中文字幕精品三区| 亚洲一区二区在线视频| 麻豆91在线播放| 成人av在线资源网| 欧美在线不卡一区| 欧美成人福利视频| 成人免费在线观看入口| 日韩激情一区二区| 国产ts人妖一区二区| 日本高清视频一区二区| 欧美绝品在线观看成人午夜影视| 久久毛片高清国产| 一区二区在线看| 黄页视频在线91| 91一区二区在线| 欧美成人欧美edvon| 亚洲视频网在线直播| 蜜臀精品一区二区三区在线观看| 成人性生交大片免费看视频在线| 在线视频中文字幕一区二区| 精品粉嫩超白一线天av| 一区二区三区欧美视频| 国产精品原创巨作av| 在线观看网站黄不卡| 久久你懂得1024| 日韩精品久久理论片| www.色精品| 日韩精品一区二区三区视频播放 | 粉嫩在线一区二区三区视频| 欧美亚一区二区| 国产日韩欧美激情| 亚洲成人av中文| 成人性生交大片免费看视频在线| 欧美精品久久一区二区三区| 国产精品久久国产精麻豆99网站| 日本亚洲最大的色成网站www| av一二三不卡影片| 日韩精品一区二区三区在线| 亚洲小说欧美激情另类| 成人福利电影精品一区二区在线观看| 91精品国产综合久久久久久久久久 | 亚洲第一在线综合网站| 成人在线综合网站| 欧美va亚洲va国产综合| 亚洲一区二区三区在线播放| 成人毛片老司机大片| 欧美成人一区二区三区在线观看| 亚洲一区在线观看免费观看电影高清| 高清在线不卡av| 2019国产精品| 美女国产一区二区三区| 欧美日韩中文另类| 亚洲一区自拍偷拍| 色欲综合视频天天天| 中文字幕亚洲欧美在线不卡| 国产精品伊人色| 2021久久国产精品不只是精品| 石原莉奈在线亚洲二区| 欧美日精品一区视频| 亚洲宅男天堂在线观看无病毒| 99久久国产免费看| 国产精品色一区二区三区| 国产在线精品一区在线观看麻豆| 日韩午夜av电影| 免费在线观看一区二区三区| 欧美高清激情brazzers| 亚洲第一福利视频在线| 欧美日韩一区二区在线观看| 一区二区三区在线免费视频| 色综合天天做天天爱| 亚洲色大成网站www久久九九| 99久久国产免费看| 亚洲激情男女视频| 欧美系列在线观看| 亚洲aⅴ怡春院| 欧美高清视频一二三区 | 久久免费国产精品| 精东粉嫩av免费一区二区三区| 欧美大胆人体bbbb| 九九视频精品免费| 欧美成人一区二区三区在线观看| 紧缚奴在线一区二区三区| 久久久久久久久久久黄色| 成人性生交大合| 日韩美女久久久| 欧美系列亚洲系列| 日韩av网站免费在线| 欧美哺乳videos| 国产精品1区2区3区| 亚洲视频在线一区| 欧美日韩三级一区二区| 麻豆91小视频| 中文字幕国产精品一区二区| 一本大道综合伊人精品热热| 亚洲成在线观看| 久久婷婷一区二区三区| 成人高清av在线| 亚洲国产一区二区三区青草影视| 欧美一级在线免费| 丁香一区二区三区| 亚洲一级片在线观看| 精品国产一区二区国模嫣然| 国产jizzjizz一区二区| 亚洲最新在线观看| 日韩欧美国产午夜精品| av网站免费线看精品| 日韩专区中文字幕一区二区| 久久久美女毛片| 在线观看一区二区精品视频| 久久精品国产网站| 亚洲欧洲99久久| 欧美一级午夜免费电影| 成人午夜视频网站| 日韩高清不卡在线| 国产精品久久久久精k8| 欧美一区二区三区喷汁尤物| 美国毛片一区二区| 18成人在线视频| 精品三级在线观看| 91啪九色porn原创视频在线观看| 蜜臀av在线播放一区二区三区| 中文字幕一区不卡| 日韩精品在线一区| 在线看国产日韩| 国产精品一级在线| 天堂一区二区在线| 综合网在线视频| 久久色在线视频| 欧美日韩亚洲综合在线 | 99精品视频一区二区三区| 婷婷综合五月天| 亚洲日韩欧美一区二区在线| 精品欧美久久久| 欧美日韩不卡视频| 91美女蜜桃在线| 成人性生交大片免费看视频在线 | 中文字幕一区二区在线观看|