nl_tokens: Draw a tile with the provided text label in the middle
pl_tokens: private Bitmap drawTile ( int tileWidth , int tileHeight , String text ) { // Create bitmap and canvas Bitmap bitmap = Bitmap . createBitmap ( tileWidth , tileHeight , Bitmap . Config . ARGB_8888 ) ; Canvas canvas = new Canvas ( bitmap ) ; // Draw the tile fill paint if ( tileFillPaint != null ) { canvas . drawRect ( 0 , 0 , tileWidth , tileHeight , tileFillPaint ) ; } // Draw the tile border if ( tileBorderPaint != null ) { canvas . drawRect ( 0 , 0 , tileWidth , tileHeight , tileBorderPaint ) ; } // Determine the text bounds Rect textBounds = new Rect ( ) ; textPaint . getTextBounds ( text , 0 , text . length ( ) , textBounds ) ; // Determine the center of the tile int centerX = ( int ) ( bitmap . getWidth ( ) / 2.0f ) ; int centerY = ( int ) ( bitmap . getHeight ( ) / 2.0f ) ; // Draw the circle if ( circlePaint != null || circleFillPaint != null ) { int diameter = Math . <mask> ( textBounds . width ( ) , textBounds . height ( ) ) ; float radius = diameter / 2.0f ; radius = radius + ( diameter * circlePaddingPercentage ) ; // Draw the filled circle if ( circleFillPaint != null ) { canvas . drawCircle ( centerX , centerY , radius , circleFillPaint ) ; } // Draw the circle if ( circlePaint != null ) { canvas . drawCircle ( centerX , centerY , radius , circlePaint ) ; } } // Draw the text canvas . drawText ( text , centerX - textBounds . exactCenterX ( ) , centerY - textBounds . exactCenterY ( ) , textPaint ) ; return bitmap ; }