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

4
LINES

< > BotCompany Repo | #1021078 // centerRect - center a rect in another one

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

Libraryless. Click here for Pure Java version (216L/2K).

static Rect centerRect(Rect a, Rect b) {
  if (a == null || b == null) ret a;
  ret Rect(b.x+(b.w-a.w)/2, b.y+(b.h-a.h)/2, a.w, a.h);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1021078
Snippet name: centerRect - center a rect in another one
Eternal ID of this version: #1021078/2
Text MD5: 8eab76118790b6674256819768c4f413
Transpilation MD5: 38d1dfb09a318ddeaffdc8fcaf36c454
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-08-30 01:47:10
Source code size: 138 bytes / 4 lines
Pitched / IR pitched: No / No
Views / Downloads: 293 / 350
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)