#include Once "window9.bi"

Function Grab_imagea(Byval GpImage As Any Ptr,Byval iX As Single=0, Byval iY As Single=0, Byref iWidth As Single=0, Byref iHeight As Single=0) As Any Ptr
	
	Dim As Any Ptr pDest
	
	If iWidth <> 0 Andalso iHeight <> 0 Then
		
		pDest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, True, 8 , iWidth, iHeight)
		
		If pDest Then
			
			gdk_pixbuf_copy_area( GpImage , iX , iY  , iWidth  , iHeight , pDest , 0 , 0)		
			
			Return pDest		
			
		Endif	
		
	Endif	
	
End Function