#include ONCE "window9.bi"

function Grab_Image (pImage as Hbitmap ,  iX as Long , iY as Long , iWidth as long , iHeght as long) as Hbitmap export
	
	dim as Hbitmap pDest
	
	if iWidth <> 0 andalso iHeght <> 0 then
	
		pDest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, true, 8 , iWidth, iHeght)
		
		if pDest then
		
			gdk_pixbuf_copy_area( pImage , iX , iY  , iWidth  , iHeght , pDest , 0 , 0)		
			
			return pDest		

		EndIf	

	EndIf

End Function