private static ImageBuffer extract ( SpriteTiled level , int number ) { final ColorRgba transparency = level . getSurface ( ) . getTransparentColor ( ) ; final ImageBuffer tile = Graphics . createImageBuffer ( level . getTileWidth ( ) , level . getTileHeight ( ) , transparency ) ; final Graphic g = tile . createGraphic ( ) ; level . setTile ( number ) ; level . render ( g ) ; g . dispose ( ) ; final ImageBuffer copy = Graphics . getImageBuffer ( tile ) ; tile . dispose ( ) ; return copy ; }
Extract the tile from level .