I am unable to take screenshot in a graphics output that is generated in a Turbo C++ in Windows XP. How to do that?
I tried PrintScreen and pasting it in MSPaint, but didn't help.
I am unable to take screenshot in a graphics output that is generated in a Turbo C++ in Windows XP. How to do that?
I tried PrintScreen and pasting it in MSPaint, but didn't help.
Turbo C graphics works in VGA (or compatible) mode. To save your output to a JPEG file, the best bet is do it yourself in the code.
Draw your pixels to a memory buffer and then use any open source library, such as "libjpeg", to convert it to JPEG. Check http://www.jpegcameras.com/libjpeg/libjpeg.html
Since you are already drawing your output to screen, you can copy the VGA memory buffer to your own memory buffer and use it (instead of directly drawing your pixels to memory buffer).
Or else, get a pointer to the VGA memory and pass it on to the JPEG library for creating a jpeg image.
You can access the video memory as below:
typedef unsigned char byte;
byte far *VGA = (byte far*)0xA0000000L;
Check out http://www.brackeen.com/vga/basics.html
Also be noted that JPEG is a lossy compression. That is, your saved jpeg image may not be the "same" as the input image. Visually they both appear same, but the "content" itself is not same.
If you are planning for "comparisions" then you should be choosing a non-lossy formats, such as TIFF or BMP. Saving images to BMP is quick and straight forward. Check out http://gpalem.web.officelive.com/bitmap.html#SaveB itmap
Also, if you would be interested in creating a movie out of a sequence of JPEG images or Bitmaps, you might find http://gpalem.web.officelive.com/createmovie.html good for that.
Checkout the project at codeproject.com which has what you want!
Using the code is very simple. Checkout this example.