1 | sclass LineWithColor implements RenderableWithHints { |
2 | Pt a, b; |
3 | RGB color; |
4 | int width = 14; |
5 | |
6 | *() {} |
7 | *(Pt *a, Pt *b, RGB *color) {} |
8 | *(Pt *a, Pt *b, Color color, int *width) { this.color = new RGB(color); } |
9 | |
10 | public void renderOn(Graphics2D g, int w, int h) { |
11 | drawRoundEdgeLine(g, a, b, toColor(color), width); |
12 | } |
13 | |
14 | public void renderHints(Graphics2D g, int w, int h) { |
15 | fillRect(g, a.x, a.y, 1, 1, hintColor()); |
16 | fillRect(g, b.x, b.y, 1, 1, hintColor()); |
17 | } |
18 | |
19 | // 0 to 360 (clockwise, 0 is north) |
20 | double angle() { |
21 | double angle = Math.toDegrees(Math.atan2(b.y-a.y, b.x-a.x)); |
22 | ret mod(angle+90, 360); |
23 | } |
24 | } |
Began life as a copy of #1014949
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: | #1015016 |
Snippet name: | LineWithColor |
Eternal ID of this version: | #1015016/10 |
Text MD5: | 38965e41f5fb4f1f81b3b8ef1b7e71c7 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-01-02 06:04:19 |
Source code size: | 668 bytes / 24 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 443 / 1018 |
Version history: | 9 change(s) |
Referenced in: | [show references] |