Simple and easy-to-use device without bit map class CSIMPLEDIB

xiaoxiao2021-03-06  40

CSIMPLEDIB (); // Default constructor

CSIMPLEDIB (const csimpledib & src); // copy constructor

CSIMpleDib (lpbyte lpbitibmem, lpbyte lpbits = null); // Create an object, LPDIBMEM - bitmap information head, LPBITS - bitmap header pointer from the memory area, if lpbits is 0, then lpbits and header information is connected together Just like a bitmap file.

CSIMPLEDIB & Operator = (const lpbyte lpdibmem); // lpdibmem -

CSIMPLEDIB & Operator = (Const CsimpleDIB & SRC);

Bool Create (int CX, int Cy, int nbitcount = 24, bool bfillblack = false); // bfillblack for True is created after creating black fills

void clear (); // Clear DIB object data

Int width (); // acquire bitmap width

INT height (); // get a bitmap height

Int bitcount (); // get the number of color characters

INT imageSize (); // Image data array size, not included information head

INT getpitch (); / / / / number of items per row data

LPbitMapInfo getBitmapInfo (); // get information head pointer

Const lpbyte getBits (); // get a bitmap data array head pointer

INT Headersize (lpbitmapinfo lpbi = null); // get information head size

Operator HPALETTE (); // Create a palette if you have already created directly return to its handle

Bool load (lpctstr lpszpathname); // Load from the file (BMP file)

Bool Load (uint nid, hrodule hresmodule = null); // Load NID from the resource - Resource ID HRESMODULE - Module handle 0 indicates loading from process EXE

Bool Save (LPCTSTR LPSZPATHNAME); // Store as a BMP file

Bool Blt (HDC HDC, INT X, INT Y, INT CX = -1, INT CY = -1, INT XSRC = 0, INT YSRC = 0); // Paint bit drawings to DC, x, y is DC The coordinates, CX is width, CY is height, XSRC, YSRC starts from the (XSRC, YSRC) coordinate point on the bitmap. This function does not support zoom

Download the source code and use sample files http://www.nhvideo.rar Because Win32's StretchDibits function is used to scale the image quality of the palette is serious (of course, it may be my horizontal) Limitation), therefore encapsulated a class CDIBDRAW using the DrawDibdraw function to draw bitmaps.

Bool CDIBDraw :: Stretchblt (HDC HDC, INT X, INT Y, INT CX, INT CY, Const CsimpleDib & Dib, Int XSRC = 0, INT YSRC = 0, INT CXSRC = -1, INT CYSRC = -1); specific usage Please refer to the sample code.

转载请注明原文地址:https://www.9cbs.com/read-73617.html

New Post(0)