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

19
LINES

< > BotCompany Repo | #1009810 // toRect

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2301L/14K).

1  
import java.awt.geom.*;
2  
3  
static Rect toRect(Rectangle r) {
4  
  ret r == null ? null : Rect(r);
5  
}
6  
7  
static Rect toRect(RectangularShape r) {
8  
  ret r == null ? null : toRect(r.getBounds());
9  
}
10  
11  
ifclass DoubleRect
12  
static Rect toRect(DoubleRect r) {
13  
  if (r == null) null;
14  
  int x = iround(r.x), y = iround(r.y);
15  
  ret Rect(x, y, iround(r.x2())-x, iround(r.y2())-y);
16  
}
17  
endif
18  
19  
static Rect toRect(Rect r) { ret r; }

download  show line numbers  debug dex  old transpilations   

Travelled to 19 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, elmgxqgtpvxh, gjtlkbvenryc, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, podlckwnjdmb, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, wnsclhtenguj

No comments. add comment

Snippet ID: #1009810
Snippet name: toRect
Eternal ID of this version: #1009810/7
Text MD5: abbdb5b0325ac9084ebc2a0ea6714a7f
Transpilation MD5: d8d30e7b2e599ffb556d95cb396eeb40
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-17 02:13:50
Source code size: 423 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 667 / 3024
Version history: 6 change(s)
Referenced in: [show references]