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

13
LINES

< > BotCompany Repo | #1004617 // copyBWImage

JavaX fragment (include)

1  
static void copyBWImage(BWImage src, int srcX, int srcY, BWImage dst, int dstX, int dstY) {
2  
  copyBWImage(src, srcX, srcY, dst, dstX, dstY, src.getWidth()-srcX, src.getHeight()-srcY);
3  
}
4  
5  
static void copyBWImage(BWImage src, int srcX, int srcY, BWImage dst, int dstX, int dstY, int w, int h) {
6  
  w = min(w, dst.getWidth()-dstX);
7  
  h = min(h, dst.getHeight()-dstY);
8  
  w = min(w, src.getWidth()-srcX);
9  
  h = min(h, src.getHeight()-srcY);
10  
  for (int y = 0; y < h; y++)
11  
    for (int x = 0; x < w; x++)
12  
      dst.setByte(dstX+x, dstY+y, src.getByte(srcX+x, srcY+y));
13  
}

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: #1004617
Snippet name: copyBWImage
Eternal ID of this version: #1004617/1
Text MD5: 74731f5864aab483a85eb20a5c122d86
Author: stefan
Category: javax / images
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-08-23 23:39:01
Source code size: 576 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 600 / 588
Referenced in: [show references]