public Region region ( final float rx , final float ry , final float rwidth , final float rheight ) { final Image image = this ; return new Region ( ) { private Tile tile ; @ Override public boolean isLoaded ( ) { return image . isLoaded ( ) ; } @ Override public Tile tile ( ) { if ( tile == null ) tile = image . texture ( ) . tile ( rx , ry , rwidth , rheight ) ; return tile ; } @ Override public RFuture < Tile > tileAsync ( ) { return image . state . map ( new Function < Image , Tile > ( ) { public Tile apply ( Image image ) { return tile ( ) ; } } ) ; } @ Override public float width ( ) { return rwidth ; } @ Override public float height ( ) { return rheight ; } @ Override public void draw ( Object ctx , float x , float y , float width , float height ) { image . draw ( ctx , x , y , width , height , rx , ry , rwidth , rheight ) ; } @ Override public void draw ( Object ctx , float dx , float dy , float dw , float dh , float sx , float sy , float sw , float sh ) { image . draw ( ctx , dx , dy , dw , dh , rx + sx , ry + sy , sw , sh ) ; } } ; }
Returns a region of this image which can be drawn independently .