Libraryless. Click here for Pure Java version (4973L/32K).
1 | static BWImage img_distanceFromColor_withGain(RGBImage img, RGB color, double gain) { |
2 | int w = img.getWidth(), h = img.getHeight(); |
3 | int col = color.getInt(); |
4 | BWImage bw = new(w, h); |
5 | for y to h: |
6 | for x to w: |
7 | bw.setPixel(x, y, rgbDiff(img.getInt(x, y), col)*(float) gain); |
8 | ret bw; |
9 | } |
10 | |
11 | static BWImage img_distanceFromColor_withGain(BufferedImage img, RGB color, double gain) { |
12 | int w = img.getWidth(), h = img.getHeight(); |
13 | int col = color.getInt(); |
14 | BWImage bw = new(w, h); |
15 | for y to h: |
16 | for x to w: |
17 | bw.setPixel(x, y, rgbDiff(img.getRGB(x, y), col)*(float) gain); |
18 | ret bw; |
19 | } |
20 | |
21 | static BWImage img_distanceFromColor_withGain(double gain, BufferedImage img, RGB color) { |
22 | ret img_distanceFromColor_withGain(img, color, gain); |
23 | } |
Began life as a copy of #1024558
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1024559 |
Snippet name: | img_distanceFromColor_withGain |
Eternal ID of this version: | #1024559/4 |
Text MD5: | ffa97e67266a165a586a2523998dcd0b |
Transpilation MD5: | 47ecb0232074de4520a76b9177c7e12a |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-09-20 18:13:52 |
Source code size: | 775 bytes / 23 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 317 / 384 |
Version history: | 3 change(s) |
Referenced in: | [show references] |