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

18
LINES

< > BotCompany Repo | #1035604 // rgbToHi15

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (9406L/51K).

static short rgbToHi15(RGB rgb) {
  ret rgbIntToHi15(rgb.asInt());
}

static short rgbToHi15(Color color) {
  ret rgbIntToHi15(colorToInt(color));
}

static short rgbToHi15(int rgb) {
  ret rgbIntToHi15(rgb);
}

static short rgbToHi15(int r, int g, int b) {
  r >>= 3;
  g >>= 3;
  b >>= 3;
  ret (short) ((r << 10) | (g << 5) | b);
}

Author comment

Began life as a copy of #1035587

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035604
Snippet name: rgbToHi15
Eternal ID of this version: #1035604/5
Text MD5: cd8b89a06a300723915263985b95309b
Transpilation MD5: cb1feddcb85e628b9d336d33a139e6e0
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-08-05 22:24:00
Source code size: 351 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 162 / 211
Version history: 4 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)