geopackage-sdk/src/main/java/mil/nga/geopackage/tiles/features/custom/NumberFeaturesTile.java
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.max(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;
    }
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.max(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;
    }
Draw a tile with the provided text label in the middle

@param tileWidth  tile width
@param tileHeight tile height
@param text       text
@return tile bitmap