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

19
LINES

< > TinyBrain | #1007302 - drawThoughtArrow - draws on bg

JavaX fragment (include)

please include function drawThoughtLine.

static int drawThoughtArrow_size = 15;

static void drawThoughtArrow(BufferedImage bg,
  BufferedImage img1, double x1, double y1,
  BufferedImage img2, double x2, double y2, Color color) {
  double cs = thoughtCircleSize(img2)/2-1;
  double dist = pointDistance(x1, y1, x2, y2);
  double arrowLen = drawThoughtArrow_size*drawArrowHead_length-1;
  DoublePt v = blendDoublePts(new DoublePt(x2, y2), new DoublePt(x1, y1), (cs+arrowLen)/dist);
  DoublePt p = blendDoublePts(new DoublePt(x2, y2), new DoublePt(x1, y1), cs/dist);
  Graphics2D g = imageGraphics(bg);
  g.setColor(color);
  g.setStroke(new BasicStroke(drawThoughtLine_width));
  g.draw(new Line2D.Double(x1, y1, v.x, v.y));
  drawArrowHead(g, x1, y1, p.x, p.y, drawThoughtArrow_size);
  g.dispose();
}

Author comment

Began life as a copy of #1007297

download  show line numbers  debug dex   

Travelled to 2 computer(s): cfunsshuasjs, tvejysmllsmz

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: 85 / 72
Version history: 18 change(s)
Referenced in: [show]