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

13
LINES

< > BotCompany Repo | #1027291 // bwCopy

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

Transpiled version (5113L) is out of date.

svoid bwCopy(BufferedImage src, BWImage dst, int dstX, int dstY) {
  bwCopy(new BWImage(src), dst, dstX, dstY);
}
  
svoid bwCopy(BWImage src, BWImage dst, int dstX, int dstY) {
  int w = dst.getWidth()-dstX;
  int h = dst.getHeight()-dstY;
  w = min(w, src.getWidth());
  h = min(h, src.getHeight());
  for (int y = 0; y < h; y++)
    for (int x = 0; x < w; x++)
      dst.setInt(dstX+x, dstY+y, src.getInt(x, y));
}

Author comment

Began life as a copy of #1006675

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1027291
Snippet name: bwCopy
Eternal ID of this version: #1027291/3
Text MD5: 808e03bfab36bb553e5de2fb8ec3fff0
Author: stefan
Category: javax / images
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-29 23:17:02
Source code size: 431 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 120 / 183
Version history: 2 change(s)
Referenced in: [show references]