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

16
LINES

< > BotCompany Repo | #1005700 // clipBufferedImage - make "virtual" clip

JavaX fragment (include)

static BufferedImage clipBufferedImage(BufferedImage src, Rectangle clip) {
  ret clipBufferedImage(src, new Rect(clip));
}

static BufferedImage clipBufferedImage(BufferedImage src, Rect r) {
  if (src == null || r == null) null;
  // fixClipRect
  r = intersectRects(r, new Rect(0, 0, src.getWidth(), src.getHeight()));
  if (rectEmpty(r)) null; // can't make zero-sized BufferedImage
    
  ret src.getSubimage(r.x, r.y, r.w, r.h);
}

static BufferedImage clipBufferedImage(BufferedImage src, int x, int y, int w, int h) {
  ret clipBufferedImage(src, Rect(x, y, w, h));
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1005700
Snippet name: clipBufferedImage - make "virtual" clip
Eternal ID of this version: #1005700/10
Text MD5: d5e2d81483eb2008777ed78436cfc17d
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-23 14:09:44
Source code size: 592 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 626 / 692
Version history: 9 change(s)
Referenced in: [show references]