1 | // contrast=1 => original |
2 | // contrast=2 => twice as contrasty |
3 | // contrast=.5 => half as contrasty |
4 | static BWImage bwContrast(double contrast, BWImage bw) { |
5 | if (contrast == 1 || bw == null) ret bw; |
6 | int w = bw.getWidth(), h = bw.getHeight(); |
7 | BWImage bw2 = new BWImage(w, h); |
8 | for y to h: for x to w: |
9 | bw2.setPixel(x, y, (float) (0.5+(bw.getPixel(x, y)-0.5)*contrast)); |
10 | ret bw2; |
11 | } |
Began life as a copy of #1015507
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1018878 |
Snippet name: | bwContrast - adjust contrast of BWImage |
Eternal ID of this version: | #1018878/5 |
Text MD5: | f27ebf520248bd8a0aa89981151528a4 |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-08-24 12:02:14 |
Source code size: | 398 bytes / 11 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 312 / 358 |
Version history: | 4 change(s) |
Referenced in: | [show references] |