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).

// brightness: 0 to 255
static int rgbIntFromGrayscale(int brightness) {
  brightness = clampToUByte(brightness);
  ret brightness | (brightness << 8) | (brightness << 16);
}

// brightness: 0 to 1
static int rgbIntFromGrayscale(double brightness) {
  ret rgbIntFromGrayscale(zeroToOneToZeroTo255(brightness));
}

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: 156 / 238
Version history: 4 change(s)
Referenced in: [show references]