Browse Source

Added CopyPixmap.

Mark Sibly 9 years ago
parent
commit
4bf7a1b3bc
1 changed files with 11 additions and 0 deletions
  1. 11 0
      modules/mojo/graphics/device.monkey2

+ 11 - 0
modules/mojo/graphics/device.monkey2

@@ -209,6 +209,17 @@ Class GraphicsDevice
 		
 		
 		_modified=True
 		_modified=True
 	End
 	End
+	
+	Method CopyPixmap:Pixmap( rect:Recti )
+	
+		Validate()
+
+		Local pixmap:=New Pixmap( rect.Width,rect.Height,PixelFormat.RGBA32 )
+		
+		glReadPixels( rect.X,rect.Y,rect.Width,rect.Height,GL_RGBA,GL_UNSIGNED_BYTE,pixmap.Data )
+		
+		Return pixmap
+	End
 
 
 	Private
 	Private