// TODO misleading name - is centered around point and scaled font but not scale center point
  // (probably :)
  public void drawAntialiasedTextCenteredNoScale(
      Graphics2D g2,
      String text,
      int fontSize,
      Position pos,
      ImmutablePoint center,
      Color fgColor,
      Color bgColor) {
    Color original = g2.getColor();
    FontRenderContext frc = g2.getFontRenderContext();
    TextLayout tl = new TextLayout(text, getFont(fontSize), frc);
    Rectangle2D bounds = tl.getBounds();

    center = center.translate((int) (bounds.getWidth() / -2), (int) (bounds.getHeight() / -2));

    if (bgColor != null) {
      g2.setColor(bgColor);
      g2.fillRect(
          getOffsetX(pos) + center.getX() - 6,
          getOffsetY(pos) + center.getY() - 5,
          12 + (int) bounds.getWidth(),
          10 + (int) bounds.getHeight());
    }

    g2.setColor(fgColor);
    tl.draw(
        g2,
        getOffsetX(pos) + center.getX(),
        getOffsetY(pos) + center.getY() + (int) bounds.getHeight());
    g2.setColor(original);
  }
 private void paintPositionedImage(Graphics2D g, PositionedImage mi, int boxSize) {
   ImmutablePoint scaledOffset = mi.getScaledOffset(boxSize);
   // TODO optimize also for scrolling
   if (mi.scaledImage == null) {
     int size = (int) (getSquareSize() * FIGURE_SIZE_RATIO);
     Image img = mi.sourceImage.getScaledInstance(size, size, Image.SCALE_SMOOTH);
     mi.scaledImage = new ImageIcon(img).getImage();
   }
   g.drawImage(
       mi.scaledImage,
       getOffsetX(mi.position) + scaledOffset.getX(),
       getOffsetY(mi.position) + scaledOffset.getY(),
       gridPanel);
 }
 /** debug purposes highlight - it always shows basic follower (doesn't important for dbg */
 private void paintFigureHighlight(Graphics2D g2) {
   // ugly copy pasted code from Meeple but uncached here
   g2.setComposite(FIGURE_HIGHLIGHT_AREA_ALPHA_COMPOSITE);
   Tile tile = getGame().getBoard().get(selectedPosition);
   ImmutablePoint point =
       getClient()
           .getResourceManager()
           .getMeeplePlacement(tile, SmallFollower.class, selectedLocation);
   Player p = getClient().getGame().getActivePlayer();
   Image unscaled =
       getClient()
           .getFigureTheme()
           .getFigureImage(SmallFollower.class, p.getColors().getMeepleColor(), null);
   int size = (int) (getSquareSize() * MeepleLayer.FIGURE_SIZE_RATIO);
   Image scaled = unscaled.getScaledInstance(size, size, Image.SCALE_SMOOTH);
   scaled = new ImageIcon(scaled).getImage();
   ImmutablePoint scaledOffset =
       point.scale(getSquareSize(), (int) (getSquareSize() * MeepleLayer.FIGURE_SIZE_RATIO));
   g2.drawImage(
       scaled,
       getOffsetX(selectedPosition) + scaledOffset.getX(),
       getOffsetY(selectedPosition) + scaledOffset.getY(),
       gridPanel);
 }