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

17
LINES

< > BotCompany Repo | #1035930 // hi15_imageMinusImage

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

Libraryless. Click here for Pure Java version (10522L/61K).

static Hi15Image hi15_imageMinusImage(Hi15Image img1, Hi15Image img2, double scale default 1) {
  assertSameSize(img1, img2);
  short[] pixels1 = img1.pixels, pixels2 = img2.pixels;
  int n = pixels1.length;
  short[] pixels3 = new[n];
  double shift = 16; // gray = zero
  
  for i to n: {
    short p1 = pixels1[i], p2 = pixels2[i];
    int r = iround((hi15_r(p1)-hi15_r(p2))*scale+shift);
    int g = iround((hi15_g(p1)-hi15_g(p2))*scale+shift);
    int b = iround((hi15_b(p1)-hi15_b(p2))*scale+shift);
    pixels3[i] = hi15_clamp(r, g, b);
  }
  
  ret new Hi15Image(img1.w(), img1.h(), pixels3);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035930
Snippet name: hi15_imageMinusImage
Eternal ID of this version: #1035930/3
Text MD5: 89500b9409a87d795125edc35fbca842
Transpilation MD5: 85d193b206e4f1f7ff5b315681600f5e
Author: stefan
Category: javax / gazelle 22
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-08-14 22:13:37
Source code size: 618 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 130 / 175
Version history: 2 change(s)
Referenced in: [show references]