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).

import java.awt.geom.*;

static Rect toRect(Rectangle r) {
  ret r == null ? null : Rect(r);
}

static Rect toRect(RectangularShape r) {
  ret r == null ? null : toRect(r.getBounds());
}

ifclass DoubleRect
static Rect toRect(DoubleRect r) {
  if (r == null) null;
  int x = iround(r.x), y = iround(r.y);
  ret Rect(x, y, iround(r.x2())-x, iround(r.y2())-y);
}
endif

static Rect toRect(Rect r) { ret r; }

download  show line numbers  debug dex  old transpilations   

Travelled to 18 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ekrmjmnbrukm, elmgxqgtpvxh, 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: 588 / 2922
Version history: 6 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1031924 - toRect_floor