Libraryless. Click here for Pure Java version (3362L/20K).
sclass BoxWithColor implements RenderableWithHints { Pt a, b; RGB color; *() {} *(Pt *a, Pt *b, RGB *color) {} *(Rect r, Color color) { a = pt(r.x, r.y); b = pt(r.x2(), r.y2()); this.color = RGB(color); } *(Rect rect, int r, int g, int b) { this(rect, new Color(r, g, b)); } public void renderOn(Graphics2D g, int w, int h) { int x1 = min(a.x, b.x), y1 = min(a.y, b.y); int x2 = max(a.x, b.x), y2 = max(a.y, b.y); fillRect(g, x1, y1, x2-x1+1, y2-y1+1, toColor(color)); } public void renderHints(Graphics2D g, int w, int h) { int x1 = min(a.x, b.x), y1 = min(a.y, b.y); int x2 = max(a.x, b.x), y2 = max(a.y, b.y); drawRect(g, x1, y1, x2-x1+1, y2-y1+1, hintColor()); } }
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: | #1014949 |
Snippet name: | BoxWithColor |
Eternal ID of this version: | #1014949/7 |
Text MD5: | 9b70a076f1591c263d6400678f77f63f |
Transpilation MD5: | d2f02644f6c3cb3e1118efd4996a020d |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-01-07 18:12:15 |
Source code size: | 764 bytes / 26 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 423 / 1039 |
Version history: | 6 change(s) |
Referenced in: | [show references] |