Libraryless. Click here for Pure Java version (5133L/28K).
1 | sclass BoundsFinder { |
2 | int x1 = Int.MAX_VALUE, y1 = Int.MAX_VALUE, x2 = 0, y2 = 0; |
3 | |
4 | *() {} |
5 | *(int w, int h) { x1 = w; y1 = h; } |
6 | |
7 | void addPt aka add(Pt p) { |
8 | if (p != null) addPt(p.x, p.y); |
9 | } |
10 | |
11 | void addPt aka add(int x, int y) { |
12 | if (x < x1) x1 = x; |
13 | if (x > x2) x2 = x; |
14 | if (y < y1) y1 = y; |
15 | if (y > y2) y2 = y; |
16 | } |
17 | |
18 | Rect get() { |
19 | ret rectFromPointsOrNull(x1, y1, x2+1, y2+1); |
20 | } |
21 | } |
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1034661 |
Snippet name: | BoundsFinder |
Eternal ID of this version: | #1034661/5 |
Text MD5: | f02c00cdefc4699fc45e1b86787272b0 |
Transpilation MD5: | 2db22ea53035da7e6df3e59f16ab4a3f |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-03-18 23:13:21 |
Source code size: | 439 bytes / 21 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 152 / 252 |
Version history: | 4 change(s) |
Referenced in: | [show references] |