1 | static byte to332(Color color) { |
2 | ret to332(colorToInt(color)); |
3 | } |
4 | |
5 | static byte to332(int rgb) { |
6 | int r = (rgb >> 16) & 0xFF; |
7 | int g = (rgb >> 8) & 0xFF; |
8 | int b = rgb & 0xFF; |
9 | //ret (byte) (((r >> 5) << 5) | ((g >> 5) << 2) | (b >> 6)); |
10 | ret (byte) ((iround(r*7.0/255) << 5) | (iround(g*7.0/255) << 2) |
11 | | (iround(b*3.0/255))); |
12 | } |
Began life as a copy of #1005376
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: | #1005377 |
Snippet name: | to332 - convert pixel to 332 format (byte) from int (24 bit RGB) |
Eternal ID of this version: | #1005377/2 |
Text MD5: | 2e1eaa2ffc60fa5d483f04f393178b32 |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-04-29 14:18:19 |
Source code size: | 349 bytes / 12 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 620 / 618 |
Version history: | 1 change(s) |
Referenced in: | [show references] |