static ImageSurface showImageWithGrayToBlackSlider(S name, final BufferedImage img) { final ImageSurface is = showImage(name, img); final SimpleLiveValue<Float> lv = floatLiveValue(); Runnable update = r { float darkening = min(lv!, 0.99f); float factor = 1/(1-darkening); float offset = (-darkening*255)*factor; //print("factor=" + factor + ", offset=" + offset); is.setImage(rgbContrastAndBrightness(factor, offset, img)); }; lv.onChange(update); addToWindowAndPack(is, withLabel("Darkening factor:", jLiveValueSliderZeroToOne(lv))); ret is; }
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: | 402 / 434 |
Version history: | 7 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |