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

19
LINES

< > BotCompany Repo | #1007302 // drawThoughtArrow - draws on bg

JavaX fragment (include)

1  
please include function drawThoughtLine.
2  
3  
static int drawThoughtArrow_size = 15;
4  
5  
static void drawThoughtArrow(BufferedImage bg,
6  
  BufferedImage img1, double x1, double y1,
7  
  BufferedImage img2, double x2, double y2, Color color) {
8  
  double cs = thoughtCircleSize(img2)/2-1;
9  
  double dist = pointDistance(x1, y1, x2, y2);
10  
  double arrowLen = drawThoughtArrow_size*drawArrowHead_length-1;
11  
  DoublePt v = blendDoublePts(new DoublePt(x2, y2), new DoublePt(x1, y1), (cs+arrowLen)/dist);
12  
  DoublePt p = blendDoublePts(new DoublePt(x2, y2), new DoublePt(x1, y1), cs/dist);
13  
  Graphics2D g = imageGraphics(bg);
14  
  g.setColor(color);
15  
  g.setStroke(new BasicStroke(drawThoughtLine_width));
16  
  g.draw(new Line2D.Double(x1, y1, v.x, v.y));
17  
  drawArrowHead(g, x1, y1, p.x, p.y, drawThoughtArrow_size);
18  
  g.dispose();
19  
}

Author comment

Began life as a copy of #1007297

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: #1007302
Snippet name: drawThoughtArrow - draws on bg
Eternal ID of this version: #1007302/19
Text MD5: 75a6aaecdb2e2d2f4e9cc1ceed45e39d
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:35:24
Source code size: 821 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 517 / 536
Version history: 18 change(s)
Referenced in: [show references]