?
Solved

fast screen capture

Posted on 2003-03-19
5
Medium Priority
?
319 Views
Last Modified: 2012-05-04
Hello, im trying to capture the screen of a OpenGL game, and im trying to make the screen capture as fast as possible, the normal methods are very slow ( 1,300ms~ ) , i would like of a way to capture the screen, even if it will be in bad quality or a small resolution, as long as its fast.
0
Comment
Question by:SabrWolf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 9

Accepted Solution

by:
mocarts earned 300 total points
ID: 8169563
on my PIII 450mhz this code takes 10 ms to capture screen (800x600)

var
iX, iY: integer;
ScreenDC: HDC;
bmp: TBitmap;
begin
 // for performance it's better to get once (somwhere in form create)
 ScreenDC := GetDC(0);
 try
   iX := Screen.Width;
   iY := Screen.Height;
   Bmp := TBitmap.Create;
   try
     bmp.Height := iY;
     bmp.Width := iX;
     if not BitBlt(bmp.Canvas.Handle, 0,0, iX, iY, ScreenDC, 0, 0, SRCCOPY) then
       raise Exception.Create('Error on copy from DC');
     Image1.Picture.Bitmap := bmp;
   finally
     bmp.free;
   end;
 finally
   ReleaseDC(0, ScreenDC);
 end;
end;
wbr, mo.
0
 

Author Comment

by:SabrWolf
ID: 8169835
hmm is there a way to resize the bmp before i save it to disk ?
0
 
LVL 9

Expert Comment

by:mocarts
ID: 8170017
there are two methods to reduce size of bitmap:
- reducing color count:

bmp.PixelFormat := pf8bit; // pf16bit, pf24bit...
Image1.Picture.Bitmap := bmp;

- resizing (with stretchdraw or resampling for better quality (resampling code can be found at search.borland.com)):

with Image1.Picture.Bitmap do begin
  Height := Trunc(bmp.Height / 1.5);
  Width := Trunc(bmp.Width / 1.5);
  Canvas.StretchDraw(Rect(0, 0, Width, Height), bmp);
end;

and combination of both methods.
wbr, mo.
0
 

Author Comment

by:SabrWolf
ID: 8170557
got any way that doesnt involve TBitmap, i dont want to use the VCL..
0
 

Author Comment

by:SabrWolf
ID: 8170987
nm. found my answer, thx again!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month14 days, 14 hours left to enroll

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question