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

24
LINES

< > BotCompany Repo | #1007309 // drawThoughtLineText - draws on bg

JavaX fragment (include)

1  
please include function drawThoughtLine.
2  
3  
!include once #1010984 // drawThoughtLineText_shift
4  
5  
static void drawThoughtLineText(BufferedImage bg,
6  
  BufferedImage img1, int x1, int y1,
7  
  BufferedImage img2, int x2, int y2,
8  
  S text, Color color) {
9  
  
10  
  Graphics2D g = imageGraphics(bg);
11  
  g.setColor(color);
12  
  g.setFont(sansSerif(20));
13  
  
14  
  int w1 = img_minOfWidthAndHeight(img1);
15  
  int w2 = img_minOfWidthAndHeight(img2);
16  
  int sideShift = (w1-w2)/4;
17  
  int len = vectorLength(x2-x1, y2-y1);
18  
  int dx = iround(sideShift*(x2-x1)/len), dy = iround(sideShift*(y2-y1)/len);
19  
  x1 += dx; x2 += dx;
20  
  y1 += dy; y2 += dy;
21  
  
22  
  drawOutlineTextAlongLine(g, text, x1, y1, x2, y2, drawThoughtLine_width/2+drawThoughtLineText_shift, color, Color.black);
23  
  g.dispose();
24  
}

Author comment

Began life as a copy of #1007302

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: #1007309
Snippet name: drawThoughtLineText - draws on bg
Eternal ID of this version: #1007309/17
Text MD5: 305513e70b3bcaa39004a144ec344d14
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-11 01:57:51
Source code size: 778 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 518 / 553
Version history: 16 change(s)
Referenced in: [show references]