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

15
LINES

< > BotCompany Repo | #1007311 // drawThoughtCircleText

JavaX fragment (include)

1  
static int drawThoughtCircleText_margin = 5;
2  
static Color drawThoughtCircleText_color = Color.yellow;
3  
4  
static void drawThoughtCircleText(BufferedImage bg, BufferedImage img, DoublePt p, S text) {
5  
  Graphics2D g = imageGraphics(bg);
6  
  g.setFont(sansSerifBold(20));
7  
  FontMetrics fm = g.getFontMetrics();
8  
  int h = fm.getHeight();
9  
  double y = p.y+thoughtCircleSize(img)/2+drawThoughtCircleText_margin;
10  
  for (S s : lines(text)) {
11  
    drawTextWithOutline(g, s, (float) (p.x-fm.stringWidth(s)/2), (float) (y+fm.getLeading()+fm.getMaxAscent()), drawThoughtCircleText_color, Color.black);
12  
    y += h;
13  
  }
14  
  g.dispose();
15  
}

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: 518 / 506
Version history: 13 change(s)
Referenced in: [show references]