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

9
LINES

< > BotCompany Repo | #1035326 // bwImageAsAlpha

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

Transpiled version (10575L) is out of date.

1  
static BufferedImage bwImageAsAlpha(BWImage bwImage, Color color) {
2  
  int w = bwImage.w(), h = bwImage.h(), n = w*h;
3  
  int rgb = colorToInt(color);
4  
  byte[] in = bwImage.pixels;
5  
  int[] out = new[n];
6  
  for i to n:
7  
    out[i] = ubyteToInt(in[i]) << 24 | rgb;
8  
  ret bufferedImage(w, h, out);
9  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1035326
Snippet name: bwImageAsAlpha
Eternal ID of this version: #1035326/4
Text MD5: 8dc5566ff67dea3b601a78c20e085a90
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-05-01 04:42:50
Source code size: 299 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 121 / 184
Version history: 3 change(s)
Referenced in: [show references]