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)

please include function drawThoughtLine.

!include once #1010984 // drawThoughtLineText_shift

static void drawThoughtLineText(BufferedImage bg,
  BufferedImage img1, int x1, int y1,
  BufferedImage img2, int x2, int y2,
  S text, Color color) {
  
  Graphics2D g = imageGraphics(bg);
  g.setColor(color);
  g.setFont(sansSerif(20));
  
  int w1 = img_minOfWidthAndHeight(img1);
  int w2 = img_minOfWidthAndHeight(img2);
  int sideShift = (w1-w2)/4;
  int len = vectorLength(x2-x1, y2-y1);
  int dx = iround(sideShift*(x2-x1)/len), dy = iround(sideShift*(y2-y1)/len);
  x1 += dx; x2 += dx;
  y1 += dy; y2 += dy;
  
  drawOutlineTextAlongLine(g, text, x1, y1, x2, y2, drawThoughtLine_width/2+drawThoughtLineText_shift, color, Color.black);
  g.dispose();
}

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: 519 / 554
Version history: 16 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1010983 - drawThoughtLineText_multiLine - draws on bg