EFileTahi-A
Contributor
How can this be done? I need to retrieve the backbuffer image and copy it to a texture or whatever device.present() is going to show back to a texture.
Thank you
Thank you
Public Class ScreenShot
Public dxDevice As Direct3D.Device
Public Sub New(ByVal Device As Direct3D.Device)
dxDevice = Device
End Sub
Public Sub TakeScreenShot()
TakeShot()
End Sub
Private Sub TakeShot()
SurfaceLoader.Save("test.jpg", ImageFileFormat.Jpg, dxDevice.GetBackBuffer(0, 0, BackBufferType.Mono))
End Sub
End Class
Example:
[I](Pseucode)[/I]
You clear the screen (800x600) using black color;
[I]You draw the following into the back buffer[/I]
You draw a 300 pixel diameter circle;
You draw a 100x200 box;
And you draw 120x50 box;
[I]Now you retrieve all that is drawn so far and scale it by +50%[/I]
Texture = BackbufferContents;
ScaledImageTexture = Texture.Size +50%
You clear the screen again using black color
you draw the scaled image;
Continue drawing other graphics which are no needed to be scaled
dxDevice.GetBackBuffer(0, 0, BackBufferType.Mono)
Dim gs As GraphicsStream
gs = SurfaceLoader.SaveToStream(ImageFileFormat.Bmp, dxDevice.GetBackBuffer(0, 0, BackBufferType.Mono))
Dim bmp As New Bitmap(gs)
Dim tx As New Texture(dxDevice, bmp, Usage.AutoGenerateMipMap, Pool.SystemMemory)
SurfaceLoader.SaveToStream()