static void invertImage(BufferedImage img) { int w = img.getWidth(), h = img.getHeight(); for (int x = 0; x < w; x++) for (int y = 0; y < h; y++) { int rgba = img.getRGB(x, y); Color col = new Color(rgba, true); col = new Color(255-col.getRed(), 255-col.getGreen(), 255-col.getBlue()); img.setRGB(x, y, col.getRGB()); } }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1004506 |
Snippet name: | invertImage - invert a BufferedImage. TODO: rescaleOp? |
Eternal ID of this version: | #1004506/4 |
Text MD5: | f28aa3169a2373e65b3e3f6c6df66db8 |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-15 12:30:42 |
Source code size: | 366 bytes / 10 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 663 / 645 |
Version history: | 3 change(s) |
Referenced in: | #1006600 - invertedImage - invert a BufferedImage (return clone) #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1015520 - containsColor |