A
ansili
Unregistered / Unconfirmed
GUEST, unregistred user!
用这个两个API(DrawDibBegin,DrawDibDraw)在Panel上画的图片怎么可以保存下来。比如:BMP文件,TBitmap.
代码如下:
procedure TPlayML20.DrawDiB;
var
hdib : HDRAWDIB;
m_hdc: HDC;
BitDecompressed : PBITMAPINFOHEADER;
BitBuffer : PBITMAPINFOHEADER;
begin
hdib := DrawDibOpen;
m_hdc := GetDC(FPlayHandle);
//New(BitDecompressed);
BitDecompressed := (FDecoder.BitDecompressed);
if(hdib <> 0) then
begin
DrawDibBegin(
hdib,
m_hdc,
-1,
-1,
BitDecompressed,
BitDecompressed^.biWidth,
BitDecompressed^.biHeight,
0
);
end;
DrawDibDraw(
hdib,
m_hdc,
0,
0,
-1,
-1,
BitDecompressed,
FDecoder.pout,// Pointer to the buffer that contains the bitmap bits
0,
0,
BitDecompressed^.biWidth,
BitDecompressed^.biHeight,
DDF_SAME_DRAW
);
DrawDibEnd(hdib);
DrawDibClose(hdib);
ReleaseDC(FPlayHandle,m_hdc);
end;
代码如下:
procedure TPlayML20.DrawDiB;
var
hdib : HDRAWDIB;
m_hdc: HDC;
BitDecompressed : PBITMAPINFOHEADER;
BitBuffer : PBITMAPINFOHEADER;
begin
hdib := DrawDibOpen;
m_hdc := GetDC(FPlayHandle);
//New(BitDecompressed);
BitDecompressed := (FDecoder.BitDecompressed);
if(hdib <> 0) then
begin
DrawDibBegin(
hdib,
m_hdc,
-1,
-1,
BitDecompressed,
BitDecompressed^.biWidth,
BitDecompressed^.biHeight,
0
);
end;
DrawDibDraw(
hdib,
m_hdc,
0,
0,
-1,
-1,
BitDecompressed,
FDecoder.pout,// Pointer to the buffer that contains the bitmap bits
0,
0,
BitDecompressed^.biWidth,
BitDecompressed^.biHeight,
DDF_SAME_DRAW
);
DrawDibEnd(hdib);
DrawDibClose(hdib);
ReleaseDC(FPlayHandle,m_hdc);
end;