Libraryless. Click here for Pure Java version (7998L/45K).
1 | svoid g22drawConnectingCurve(Graphics2D g, Pt start, Pt end, int clipAmount default 4) {
|
2 | var controlY = random(0, 40); |
3 | |
4 | var control = doublePt(avg(start.x, end.x), controlY); |
5 | var path = new Path2D.Float; |
6 | path.moveTo(start.x, start.y); |
7 | path.quadTo(control.x, control.y, end.x, end.y); |
8 | |
9 | var color = oneOf(ll((Color.black), (Color.gray), (Color.red))); |
10 | var g2 = (Graphics2D) g.create(); |
11 | g2.setColor(color); |
12 | |
13 | if (clipAmount != 0) {
|
14 | Rect clip = rectFromPoints(start.x+clipAmount, 0, |
15 | end.x-clipAmount, max(end.y, start.y)-clipAmount); |
16 | print(+clip); |
17 | g2.clipRect(clip.x, clip.y, clip.w, clip.h); |
18 | } |
19 | |
20 | g2.draw(path); |
21 | } |
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): mowyntqkapby, mqqgnosmbjvj
No comments. add comment
| Snippet ID: | #1035370 |
| Snippet name: | g22drawConnectingCurve |
| Eternal ID of this version: | #1035370/7 |
| Text MD5: | 809cc675a0eb59cad884ae1b3532aff2 |
| Transpilation MD5: | 42ef829ebba9f99b724cf32759b6bdf2 |
| Author: | stefan |
| Category: | javax / gazelle 22 |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2022-05-02 21:26:41 |
| Source code size: | 673 bytes / 21 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 435 / 556 |
| Version history: | 6 change(s) |
| Referenced in: | [show references] |