Z
ZhuHongQing
Unregistered / Unconfirmed
GUEST, unregistred user!
我用的是内存流和timer实现连续抓图!但速度并不行!
这是我的程序
var
DC: HDC;
Canvas: TCanvas;
MyBitmap: TBitmap;
aPicture : TPicture;
jpg:tjpegimage;
begin
DC := GetDC(0);
mybitmap:=tbitmap.Create;
canvas:=tcanvas.Create;
Canvas.Handle := DC;
with Screen do
begin
MyBitmap.Width := Width;
MyBitmap.Height := Height;
Application.ProcessMessages;
MyBitmap.Canvas.CopyRect(Rect(0, 0, Width, Height), Canvas,
Rect(0, 0, Width, Height));
end;
jpg:=tjpegimage.Create ;
aPicture:= TPicture.Create;
apicture.Bitmap:=mybitmap;
jpg.Assign(apicture.Bitmap);
TempStream[zuatu] := TMemoryStream.Create;
jpg.SaveToStream(TempStream[zuatu]);
ReleaseDC(0, DC);
mybitmap.free;
canvas.Free;
jpg.Free;
apicture.Free ;
zuatu:=zuatu-1;
if zuatu<1 then timer1.free;
这是我的程序
var
DC: HDC;
Canvas: TCanvas;
MyBitmap: TBitmap;
aPicture : TPicture;
jpg:tjpegimage;
begin
DC := GetDC(0);
mybitmap:=tbitmap.Create;
canvas:=tcanvas.Create;
Canvas.Handle := DC;
with Screen do
begin
MyBitmap.Width := Width;
MyBitmap.Height := Height;
Application.ProcessMessages;
MyBitmap.Canvas.CopyRect(Rect(0, 0, Width, Height), Canvas,
Rect(0, 0, Width, Height));
end;
jpg:=tjpegimage.Create ;
aPicture:= TPicture.Create;
apicture.Bitmap:=mybitmap;
jpg.Assign(apicture.Bitmap);
TempStream[zuatu] := TMemoryStream.Create;
jpg.SaveToStream(TempStream[zuatu]);
ReleaseDC(0, DC);
mybitmap.free;
canvas.Free;
jpg.Free;
apicture.Free ;
zuatu:=zuatu-1;
if zuatu<1 then timer1.free;