Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

21
LINES

< > BotCompany Repo | #1005376 // from332 - convert pixel from 332 format (byte) to int (24 bit RGB)

JavaX fragment (include)

static int from332(int x) {
  ret from332((byte) x);
}

static int from332(byte x) {
  int r = iround(((x >> 5) & 7)*255.0/7);
  int g = iround(((x >> 2) & 7)*255.0/7);
  int b = iround((x & 3)*255.0/3);
  ret (r << 16) | (g << 8) | b;
}

static int from332(int r, int g, int b) {
  r = iround(r*255.0/7);
  g = iround(g*255.0/7);
  b = iround(b*255.0/3);
  ret (r << 16) | (g << 8) | b;
}

static int from332(S s) {
  ret from332(parseInt(s.charAt(0)), parseInt(s.charAt(1)), parseInt(s.charAt(2)));
}

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: #1005376
Snippet name: from332 - convert pixel from 332 format (byte) to int (24 bit RGB)
Eternal ID of this version: #1005376/7
Text MD5: 99250c044283fc06b998e0aaba91c16a
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-23 13:21:05
Source code size: 522 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 607 / 619
Version history: 6 change(s)
Referenced in: [show references]