Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

15
LINES

< > BotCompany Repo | #1007311 // drawThoughtCircleText

JavaX fragment (include)

static int drawThoughtCircleText_margin = 5;
static Color drawThoughtCircleText_color = Color.yellow;

static void drawThoughtCircleText(BufferedImage bg, BufferedImage img, DoublePt p, S text) {
  Graphics2D g = imageGraphics(bg);
  g.setFont(sansSerifBold(20));
  FontMetrics fm = g.getFontMetrics();
  int h = fm.getHeight();
  double y = p.y+thoughtCircleSize(img)/2+drawThoughtCircleText_margin;
  for (S s : lines(text)) {
    drawTextWithOutline(g, s, (float) (p.x-fm.stringWidth(s)/2), (float) (y+fm.getLeading()+fm.getMaxAscent()), drawThoughtCircleText_color, Color.black);
    y += h;
  }
  g.dispose();
}

Author comment

Began life as a copy of #1007293

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1007311
Snippet name: drawThoughtCircleText
Eternal ID of this version: #1007311/14
Text MD5: e956794a6498df7d84dc464ade8968f7
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-14 04:02:17
Source code size: 630 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 403 / 397
Version history: 13 change(s)
Referenced in: [show references]