浏览代码

Added CopyPixmap.

Mark Sibly 9 年之前
父节点
当前提交
4bf7a1b3bc
共有 1 个文件被更改,包括 11 次插入0 次删除
  1. 11 0
      modules/mojo/graphics/device.monkey2

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

@@ -209,6 +209,17 @@ Class GraphicsDevice
 		
 		_modified=True
 	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