Page 1 of 1

Screen to Image

Posted: Sun May 28, 2006 12:35 am
by Demivec
Parts of this topic have been dealt with but I need a more direct response than what I've found.

How do I grab a screen and copy it to an image. I know I can grab a screen and store it in a sprite. I do not know how to display the sprite on an image to complete the process. I imagine that a large sprite could be used to replace the use of the image as the destination, though it doesn't answer how to display a sprite on an image.

Would it have to be done via the screen capture methods with DirectX that have been posted elsewhere? I was hoping it wouldn't.



Speed is important, as usual.

As a side note, a new language feature that may be useful is duplicating the contents of the flipbuffers() for double buffering. This means to duplicate the displayed buffer contents in the hidden buffer.


Demivec

Posted: Mon May 29, 2006 9:03 am
by travismcgee
May I ask why you want it in image form? What are you going to do with it that a sprite would not be suitable for?

Posted: Mon May 29, 2006 12:23 pm
by josku_x
travismcgee wrote:May I ask why you want it in image form? What are you going to do with it that a sprite would not be suitable for?
Perhaps he is making a game and he wants to have a screenshot feature in his game which allows the user to take a screenshot of the game. I am not sure, but I think I saw an example in PureArea which did that.

Look in www.purearea.net in CodeArchiv.

Posted: Mon May 29, 2006 12:56 pm
by Psychophanta
Demivec,
perhaps you can get some interesting some stuff useful for you here:
http://www.purebasic.fr/english/viewtop ... 6779#96779

There, the macros called MyCopyBuffer and MyCopyBufferEx are useful to get displayed graphic info to an image or whatever buffer in memory.
What you need is to convert graphic data (add BMP , JPG, or whatever header) after copy the graph info.

Posted: Mon May 29, 2006 6:18 pm
by Demivec
travismcqee wrote:May I ask why you want it in image form? What are you going to do with it that a sprite would not be suitable for?
I wanted to do so because I had wanted to use the image as a type of buffer to test or change display types and then redisplay them as a whole composition. So in effect, with sprites moving over a background I would want to take a screen shot, then use this as a background (it could be retransferred to back into large sprites) for what would be displayed next with additional sprites over the top. I would also be able to test the parts of that new background image for effects based on conditions of what was present (in color form for instance).

psycopantha wrote:There, the macros called MyCopyBuffer and MyCopyBufferEx are useful to get displayed graphic info to an image or whatever buffer in memory.
What you need is to convert graphic data (add BMP , JPG, or whatever header) after copy the graph info.
This may fit the bill, though I think I still have questions about the conversion at the end you mentioned (how to accomplish it).


We are exploring other methods but the obvious ones seem to have roadblocks.


Demivec

Posted: Tue May 30, 2006 6:53 pm
by SFSxOI
Are you talking about just a basic screen capture?

Maybe some info in these posts also that might help you:

http://www.purebasic.fr/english/viewtop ... en+capture

http://www.purebasic.fr/english/viewtop ... en+capture

http://www.purebasic.fr/english/viewtop ... en+capture