Capture Backbuffer?

BlitzMax Forums/BlitzMax Programming/Capture Backbuffer?

Yahfree(Posted 2009) [#1]
How do I capture what's currently drawn into a pixmap? In other words, just a screenshot. Except I want to manipulate this screenshot later and redraw it for things such as blur effects, etc.

Thanks.


plash(Posted 2009) [#2]
Local screenshot:TPixmap = GrabPixmap(0, 0, screen_width, screen_height)


Yeah?


Yahfree(Posted 2009) [#3]
I didn't think it was THAT easy.. :|

Is there a faster way of copying a pixmap onto another pixmap? Other than reading each pixel from one pixmap, and writing it onto the other pixmap?


GfK(Posted 2009) [#4]
myPixmap.Paste()


orgos(Posted 2009) [#5]
Please Yahfree can you notifyme if you can make a fast blur effect with that?

Some days ago I try to make that but run very slow.


Arowx(Posted 2009) [#6]
You could just grab an image and redraw it like this...

' Grad a screenshot then blur it...

Graphics 800,600

Global screenshot:TImage = CreateImage(800,600,1,DYNAMICIMAGE|MASKEDIMAGE)

Repeat

	Cls

	SetBlend alphablend
	SetAlpha 1.0
	
	SetColor 255,128,0
	DrawRect 100,100,100,100
	DrawOval 200,400,100,100
	
	DrawText "This should appear all blurred....", 10,10
	
	GrabImage(screenshot,0,0)
	
	Cls
	
	SetAlpha 0.2
	
	DrawImage screenshot, -1, -1
	DrawImage screenshot, -1, +1
	DrawImage screenshot, +1, -1
	DrawImage screenshot, +1, +1
	DrawImage screenshot, 0, 0

	Flip
	
Until AppTerminate() Or KeyHit(ESCAPE_KEY)


As pixmaps can be slow, but it depends on what you want to do?


orgos(Posted 2009) [#7]
Good effect, but it run really slow when you have sprite moving on screen.


Arowx(Posted 2009) [#8]
You could always have a blurred version of the graphics, as long as you only use images for everything you can do a blurred version and just flip to that?


orgos(Posted 2009) [#9]
Yes Merx, thats can be a solution. But I need to make the effect in real time.