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

14
LINES

< > BotCompany Repo | #1006977 // getAlphaChannel

JavaX fragment (include)

1  
static BWImage getAlphaChannel(BufferedImage src) {
2  
  int w = src.getWidth();
3  
  int h = src.getHeight();
4  
5  
  BWImage alpha = new BWImage(w, h);
6  
  for y to h: for x to w: {
7  
    //int a = (srcBuffer[i] >> 24) & 0xff;
8  
    //int a = srcBuffer[i] & 0xff;
9  
    int a = (src.getRGB(x, y) >> 24) &0xff;
10  
    alpha.setByte(x, y, a);
11  
    //print(intToHex= (srcBuffer[i]));
12  
  }
13  
  ret alpha;
14  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1006977
Snippet name: getAlphaChannel
Eternal ID of this version: #1006977/10
Text MD5: 58776b05c7b358f7527ffed416df64b5
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-02-21 19:19:19
Source code size: 391 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 519 / 515
Version history: 9 change(s)
Referenced in: [show references]