Screenshots

BlitzPlus Forums/BlitzPlus Programming/Screenshots

Petron(Posted 2006) [#1]
I am working on a game, where you can change the background. I was wondering, if you could make the game take a screenshot of everything behind the window and turn it into an image. Then make you so that the image is updated in real time. I hope that this could make it so that a canvas has a see-through effect. Thanks


Petron(Posted 2006) [#2]
Please I need help, anyone !!!


DjBigWorm(Posted 2006) [#3]
might be helpfull in your question if you post some code. The way it sounds now, might be a slow going since the background screenshot is taken in real time.


Pineapple(Posted 2006) [#4]
Only way I can think of doing it is hiding the window for a split second, lock the desktop buffer, read the pixels from the location of the window, write the said pixels to the canvas, and redraw the window!

Or along them lines!

May make your window flicker if nothing else!

Dabz


Petron(Posted 2006) [#5]
; Get the desktop width and height
Width=GadgetWidth(Desktop())
Height=GadgetHeight(Desktop())

SetBuffer DesktopBuffer()
image=CreateImage( 395,89 )
;Grab the desktop from where the window will appear (middle)
GrabImage image,GraphicsWidth()/2-200,GraphicsHeight()/2-45

The above section is the code I would use. I adjusted the varibles to get the area that I need, but it doesn't work. The above code is from "Splash" a loading bar demo that came with blitzplus. It maniplulates a screeshot to make an odd shaped window. So if anyone has ideas, help would be greatly appreciated. Thanks


Petron(Posted 2006) [#6]
If a flickering window could be avoided, that would be best.


Adam Novagen(Posted 2006) [#7]
;Grab the desktop from where the window will appear (middle)
GrabImage image,GraphicsWidth()/2-200,GraphicsHeight()/2-45



Look, I haven't actually used B+, (I just use this forum due to the lack of a B2D one) so I could be totally wrong about this, but I think you might try replacing the GrabImage with the Locate command. Other than that, I'm not sure, having had 0% experience with the desktop buffer. One thing though, copying from the desktop into your window might be doable, but as far as I know there's no WAY it'll run fast enough for realtime speed. But again, I might be wrong.


Petron(Posted 2006) [#8]
Blitz Plus doesn't have the locate command


Petron(Posted 2006) [#9]
SetBuffer DesktopBuffer()
Global imagebackground=CreateImage( 773,600 )
;Grab the desktop from where the window will appear (middle)
GrabImage imagebackground,GraphicsWidth()/2-386,GraphicsHeight()/2-300


I got that code to work, but I need a way to update it. If I add a section similar to that to my loop it crashes or never follows the flip or cls. I would apprecitate help if anyone has ideas. Thanks


Petron(Posted 2006) [#10]
Is there a way to update a screenshot that a program takes without windows, when there is windows. Or a way to hide a window?


Petron(Posted 2006) [#11]
Please If anyone has a way to update it or prevent program switching, I need it.