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.

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

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: 122 / 186
Version history: 3 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)