📄 imagecls.h
字号:
/*
** IMAGECLS.H
** Header for ImageClass.
**
** Author: C A Marriott
** Created: 19-FEB-93
*/
#if !defined IMAGECLASS
#define IMAGECLASS
// Image formats:
const int FI_GIF = 0; // GIF
const int FI_DIB = 1; // DIB
// Image class.
class ImageClass {
HWND hWnd; // image window handle
HMENU hMenu; // image menu handle.
HMENU hMenuWindow; // Window submenu handle.
char achFileName[128]; // original filename
int nFileFormat; // original file format
WORD nUpdateCount; // count of image updates
BOOL bDIBToDevice; // blit image to device
BOOL bImageValid; // image is OK to draw
HPALETTE hpalCurrent; // handle to GDI palette for image
HANDLE hdibCurrent; // handle to CF_DIB memory block
HBITMAP hbmCurrent; // handle to current memory BITMAP
// Private member functions:
HBITMAP BitmapFromDib ( HANDLE hdib, HPALETTE hpal );
HPALETTE CreateBIPalette ( LPBITMAPINFOHEADER lpbi );
HPALETTE CreateDibPalette ( HANDLE hbi );
BOOL DibBlt (HDC hdc, int x0, int y0, int dx, int dy, HANDLE hdib, int x1, int y1, LONG rop);
BOOL DibInfo ( HANDLE hbi, LPBITMAPINFOHEADER lpbi );
WORD DibNumColors( VOID FAR *pv ); // return number of colours in a DIB
BOOL DrawBitmap ( HDC hdc, int x, int y, HBITMAP hbm, DWORD rop );
void FreeData(); // free all data
void GetRealClientRect ( HWND hwnd, PRECT lprc );
void IdentifyFileFormat(); // identify format of file
DWORD lread (int fh, VOID FAR *pv, DWORD ul ); // read HUGE data from file
HANDLE OpenDIB(); // create memory DIB from file
WORD PaletteSize( VOID FAR *pv ); // return size of palette
BOOL ReadDIB(); // top level DIB reading function
HANDLE ReadDibBitmapInfo ( int ); // read DIB header information
BOOL ReadGIF(); // top level GIF reading function
// Public member functions:
public:
ImageClass( HWND, LPSTR ); // constructor - create image from file
~ImageClass(); // destructor
void Draw( HWND, HDC, int, int ); // draw image
void GetImageDimensions( int *pWidth, int *pHeight );
void Paint( HWND hWnd ); // respond to WM_PAINT message
void PaletteChanged( HWND hWnd ); // respond to WM_PALETTECHANGED message
int QueryNewPalette( HWND hWnd ); // respond to WM_QUERYNEWPALETTE message
void SetCaption( HWND hWnd ); // set window caption
void SetMenu( HWND ); // set menu
void SetScrollRanges( HWND hwnd ); // set scroll bar ranges
void SetWindowSize( HWND hWnd ); // size window to image
};
typedef ImageClass *PIMAGE; // pointer to image
typedef ImageClass FAR *LPIMAGE; // far pointer to image
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -