Libraryless. Click here for Pure Java version (10522L/61K).
1 | static Hi15Image hi15_imageMinusImage(Hi15Image img1, Hi15Image img2, double scale default 1) { |
2 | assertSameSize(img1, img2); |
3 | short[] pixels1 = img1.pixels, pixels2 = img2.pixels; |
4 | int n = pixels1.length; |
5 | short[] pixels3 = new[n]; |
6 | double shift = 16; // gray = zero |
7 | |
8 | for i to n: { |
9 | short p1 = pixels1[i], p2 = pixels2[i]; |
10 | int r = iround((hi15_r(p1)-hi15_r(p2))*scale+shift); |
11 | int g = iround((hi15_g(p1)-hi15_g(p2))*scale+shift); |
12 | int b = iround((hi15_b(p1)-hi15_b(p2))*scale+shift); |
13 | pixels3[i] = hi15_clamp(r, g, b); |
14 | } |
15 | |
16 | ret new Hi15Image(img1.w(), img1.h(), pixels3); |
17 | } |
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: | 132 / 179 |
Version history: | 2 change(s) |
Referenced in: | [show references] |