📄 dib.h
字号:
// Dib.h: interface for the CDib class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_DIB_H__28F7ACCA_AC40_4185_8238_E4633742A490__INCLUDED_)
#define AFX_DIB_H__28F7ACCA_AC40_4185_8238_E4633742A490__INCLUDED_
#include <afxwin.h>
#include "DibAPI.h"
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CDib : public CObject
{
DECLARE_SERIAL(CDib)
public:
BOOL ChangeFromMatrix(IMGMATRIX * img);
IMGMATRIX *ChangeToMatrix();
BOOL FlipVert();
BOOL FlipHorz();
BOOL Rotate();
BOOL Canvas(int nWidth,int nHeight,int nPos);
BOOL Zoom(int nW,int nH);
BOOL Merge(HDIB hDIB,POINT ptTopLeft);
BOOL Crop(CRect rc);
BOOL Cut(CRect rc);
BOOL DisplayMosiacOut(CDC *pDC,int xx,int yy,int nTileSize,DWORD dwDelayTime);
BOOL DisplayMosiacIn(CDC *pDC,int xx,int yy,int nTileSize,DWORD dwDelayTime,DWORD dwRop);
BOOL DisplayFadeOut(CDC* pDC,int x,int y,int nDeta,DWORD dwDelayTime);
BOOL DisplayFadeIn(CDC* pDC,int x,int y,int nDeta,DWORD dwDelayTime);
//public member data
CBitmap* m_pBitmap;//DDB object
CPalette* m_pPalette;//relevant palette
HBITMAP m_hBitmap;//handle of DIBSECTION
HDIB m_hDib; //handle of DIB
// CImgMatrix m_imgMatrix;
//attribute functions
BOOL ConvertFormat(WORD wBitCount);
LONG GetPixelOffset(LONG x,LONG y);
COLORREF GetPixel(LONG x,LONG y);
LPBYTE GetBitsPtr();
HANDLE GetHandle();
CPalette* GetPalette();
CBitmap* GetBitmap();
WORD GetPaletteSize();
WORD GetColorNumber();
LONG GetWidthBytes();
LONG GetHeight();
LONG GetWidth();
WORD GetBitCount();
DWORD GetCompression();
BOOL IsEmpty();
//DDB and palette
BOOL BuildPalette();
BOOL BuildBitmap();
//DC for modify DIB
void EndPaint();
CDC* BeginPaint(CDC *pDC);
//display
BOOL DisplayPalette(CDC *pDC,CRect rc);
BOOL Display(CDC * pDC,CRect rcDest,CRect rcSrc,DWORD dwRop=SRCCOPY);
BOOL Display(CDC * pDC,int x,int y,DWORD dwRop=SRCCOPY);
BOOL Display(CDC * pDC,int xDest,int yDest,int nWidthDest,int nHeightDest,int xSrc,int ySrc,int nWidthSrc,int nHeightSrc,DWORD dwRop=SRCCOPY);
BOOL Display(CDC * pDC,int xDest,int yDest,int nWidthDest,int nHeightDest,int xSrc,int ySrc,DWORD dwRop=SRCCOPY);
//overloading the serialize
virtual void Serialize(CArchive &ar);
//destroy
HDIB Detach();
void Destroy();
//load and save fuctions
BOOL Write(CFile *pFile);
BOOL Read(CFile *pFile);
BOOL Save(LPCTSTR lpszDibFile);
BOOL Load(LPCTSTR lpszDibFile);
BOOL Load(LPCTSTR lpszDibRes,LPCTSTR lpszDibType);
BOOL Load(UINT uIDS,LPCTSTR lpszDibType);
//attach handle
BOOL Attach(HDIB hDib);
//create functions
BOOL Create(HWND hWnd,CRect rcClientArea);
BOOL Create(HWND hWnd,WORD fPrintArea);
BOOL Create(CRect rcScreen);
BOOL Create(HBITMAP hBitmap, HPALETTE hPalette,WORD wBitCount);
BOOL Create(HBITMAP hBitmap, HPALETTE hPalette);
BOOL Create(HBITMAP hBitmap, WORD wBitCount);
BOOL Create(HBITMAP hBitmap);
BOOL Create(LPBYTE lpDIB,WORD wBitCount);
BOOL Create(LPBYTE lpDIB);
BOOL Create(DWORD dwWidth,DWORD dwHeight,WORD wBitCount);
BOOL Create(DWORD dwWidth,DWORD dwHeight);
//constructor
CDib();
//deconstructor
virtual ~CDib();
//display transparently
BOOL DisplayTransparent(CDC *pDC,int x,int y,
COLORREF cTransparentColor);//effect operation
BOOL Display(int nEffect,CDC *pDC,int x,int y,int nDeta,
DWORD dwDelayTime,DWORD dwRop=SRCCOPY);
BOOL Clear(int nEffect,CDC *pDC,int x,int y,int nDeta,
DWORD dwDelayTime);
//FJ Function
BOOL ModifyColorMap();
private:
//private member data
//for drawing in DI
CPalette* m_pPaletteTmp;
CBitmap* m_pBitmapTmp;
CDC* m_pMemDC;
//private member function
BOOL UpdateInternal();
};
#endif // !defined(AFX_DIB_H__28F7ACCA_AC40_4185_8238_E4633742A490__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -