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

19
LINES

< > BotCompany Repo | #1009140 // randomPt - random point in w/h, BufferedImage, Rect or currentImage()

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

Transpiled version (2986L) is out of date.

static Pt randomPt() {
  ret randomPt(currentImage().getWidth(), currentImage().getHeight());
}

static Pt randomPt(BufferedImage img) {
  ret img == null ? null : randomPt(img.getWidth(), img.getHeight());
}

static Pt randomPt(MakesBufferedImage img) {
  ret img == null ? null : randomPt(img.getWidth(), img.getHeight());
}

static Pt randomPt(int w, int h default w) {
  ret new Pt(random(w), random(h));
}

static Pt randomPt(Rect r) {
  ret r == null ?: Pt(r.x+random(r.w), r.y+random(r.h));
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1009140
Snippet name: randomPt - random point in w/h, BufferedImage, Rect or currentImage()
Eternal ID of this version: #1009140/9
Text MD5: bdb7915ea8c81a168df28052b7d5e44c
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-11-04 03:41:32
Source code size: 517 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 409 / 524
Version history: 8 change(s)
Referenced in: [show references]