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   

Travelled to 11 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz

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: 370 / 392
Version history: 6 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1009810 & http://1009810.tinybrain.de