#include ONCE "window9.bi"

function CreateCopyImageRect (hWin as any ptr , iX as long, iY as Long, iWidth as Long, iHeight as Long , iFlag as Long = 0) as Hbitmap export
	
	if iFlag = 0 then 
		
		#ifdef __USE_GTK3__
		
		return gdk_pixbuf_get_from_window (gtk_widget_get_window(hWin), iX, iY, iWidth, iHeight)
		
		#else
		
		return  gdk_pixbuf_get_from_drawable(NULL , gtk_widget_get_window(hWin), gdk_colormap_get_system(), iX, iY, 0, 0, iWidth, iHeight)		
		
		#endif
		
	else
	
		#ifdef __USE_GTK3__
	
		return gdk_pixbuf_get_from_window (hWin, iX, iY, iWidth, iHeight)
		
		#else
		
		return  gdk_pixbuf_get_from_drawable(NULL , hWin, gdk_colormap_get_system(), iX, iY, 0, 0, iWidth, iHeight)		
		
		#endif		

	EndIf

End Function