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

11
LINES

< > BotCompany Repo | #1015520 // containsColor

JavaX fragment (include)

1  
static bool containsColor(BufferedImage img, int color) {
2  
  if (img == null) false;
3  
  color |= 0xFF000000; // alpha
4  
  int w = img.getWidth(), h = img.getHeight();
5  
  for (int x = 0; x < w; x++)
6  
    for (int y = 0; y < h; y++) {
7  
      int rgba = img.getRGB(x, y);
8  
      if (rgba == color) true;
9  
    }
10  
  false;
11  
}

Author comment

Began life as a copy of #1004506

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: #1015520
Snippet name: containsColor
Eternal ID of this version: #1015520/2
Text MD5: 6ba057dae97df38f5acff0605847a845
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-15 12:49:50
Source code size: 319 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 317 / 339
Version history: 1 change(s)
Referenced in: [show references]