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

10
LINES

< > BotCompany Repo | #1034423 // rgbIntFromGrayscale

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

Libraryless. Click here for Pure Java version (8050L/45K).

1  
// brightness: 0 to 255
2  
static int rgbIntFromGrayscale(int brightness) {
3  
  brightness = clampToUByte(brightness);
4  
  ret brightness | (brightness << 8) | (brightness << 16);
5  
}
6  
7  
// brightness: 0 to 1
8  
static int rgbIntFromGrayscale(double brightness) {
9  
  ret rgbIntFromGrayscale(zeroToOneToZeroTo255(brightness));
10  
}

Author comment

Began life as a copy of #1033954

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034423
Snippet name: rgbIntFromGrayscale
Eternal ID of this version: #1034423/5
Text MD5: 8b53b0dcb2ede77409a77f12687b0838
Transpilation MD5: 253420d2dedcf46711711de6e8cb42e1
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-05-22 22:17:42
Source code size: 321 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 157 / 240
Version history: 4 change(s)
Referenced in: [show references]