1 | static ImageSurface showImageWithGrayToBlackSlider(S name, final BufferedImage img) { |
2 | final ImageSurface is = showImage(name, img); |
3 | final SimpleLiveValue<Float> lv = floatLiveValue(); |
4 | |
5 | Runnable update = r { |
6 | float darkening = min(lv!, 0.99f); |
7 | float factor = 1/(1-darkening); |
8 | float offset = (-darkening*255)*factor; |
9 | //print("factor=" + factor + ", offset=" + offset); |
10 | is.setImage(rgbContrastAndBrightness(factor, offset, img)); |
11 | }; |
12 | |
13 | lv.onChange(update); |
14 | addToWindowAndPack(is, |
15 | withLabel("Darkening factor:", jLiveValueSliderZeroToOne(lv))); |
16 | ret is; |
17 | } |
Began life as a copy of #1018736
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: | #1018738 |
Snippet name: | showImageWithGrayToBlackSlider |
Eternal ID of this version: | #1018738/8 |
Text MD5: | a67e45bb68c7bce7a33aafe4a2176afc |
Author: | stefan |
Category: | javax / imaging / gui |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-10-12 12:34:01 |
Source code size: | 605 bytes / 17 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 403 / 436 |
Version history: | 7 change(s) |
Referenced in: | [show references] |