Source code captured by video image in playback

xiaoxiao2021-03-06  60

Bool cdxgraph :: snapshotbitmap (const char * outfile)

{

IF (MbasicVideo)

{

Long bitmapsize = 0;

IF (Succeeded (MbasicVideo-> GetCurrentImage (& Bitmapsize, 0))))))

{

BOOL Pass = false;

Unsigned char * buffer = new unsigned char [bitmapsize];

IF (Succeeded (MbasicVideo-> GetCurrentImage (& Bitmapsize, (long *) buffer))))

{

BitmapfileHeader HDR;

LpbitmapInfoHeader LPBI;

LPBI = (LPBitmapInfoHeader) BUFFER

Int ncolors = 1 << lpbi-> bibitcount;

IF (ncolors> 256) ncolors = 0;

Hdr.bfType = ((Word) ('M' << 8) | 'b'); // ALWAYS IS "BM"

HDr.bfsize = bitmapsize sizeof (HDR);

Hdr.bfreserved1 = 0;

Hdr.bfreserved2 = 0;

Hdr.bfoff bits = (dWord) (Sizeof (BitmapfileHeader) LPBI-> Bisize NCOLORS * SIZEOF (RGBQUAD));

Cfile Bitma Pfile (Outfile, CFile :: ModeReadwrite | CFile :: Modecreate | CFILE :: Typebinary);

Bitmapfile.write (& HDR, SIZEOF (BitmapfileHead);

Bitmapfile.write (buffer, bitmapsize);

Bitmapfile.Close ();

PASS = TRUE;

}

DELETE [] BUFFER;

Return Pass;

}

}

Return False;

}

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

New Post(0)