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

13
LINES

< > BotCompany Repo | #1006079 // copyRGBImage

JavaX fragment (include)

static void copyRGBImage(RGBImage src, int srcX, int srcY, RGBImage dst, int dstX, int dstY) {
  copyRGBImage(src, srcX, srcY, dst, dstX, dstY, src.getWidth()-srcX, src.getHeight()-srcY);
}

static void copyRGBImage(RGBImage src, int srcX, int srcY, RGBImage dst, int dstX, int dstY, int w, int h) {
  w = min(w, dst.getWidth()-dstX);
  h = min(h, dst.getHeight()-dstY);
  w = min(w, src.getWidth()-srcX);
  h = min(h, src.getHeight()-srcY);
  for (int y = 0; y < h; y++)
    for (int x = 0; x < w; x++)
      dst.setPixel(dstX+x, dstY+y, src.getInt(srcX+x, srcY+y));
}

Author comment

Began life as a copy of #1004617

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1006079
Snippet name: copyRGBImage
Eternal ID of this version: #1006079/1
Text MD5: 1e026efa5b65dc524848236ae5524d25
Author: stefan
Category: javax / images
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-17 01:20:22
Source code size: 583 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 620 / 623
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1006675 - rgbCopy - see copyRGBImage (could be merged)