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.

1  
svoid bwCopy(BufferedImage src, BWImage dst, int dstX, int dstY) {
2  
  bwCopy(new BWImage(src), dst, dstX, dstY);
3  
}
4  
  
5  
svoid bwCopy(BWImage src, BWImage dst, int dstX, int dstY) {
6  
  int w = dst.getWidth()-dstX;
7  
  int h = dst.getHeight()-dstY;
8  
  w = min(w, src.getWidth());
9  
  h = min(h, src.getHeight());
10  
  for (int y = 0; y < h; y++)
11  
    for (int x = 0; x < w; x++)
12  
      dst.setInt(dstX+x, dstY+y, src.getInt(x, y));
13  
}

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: 198 / 282
Version history: 2 change(s)
Referenced in: [show references]