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

6
LINES

< > BotCompany Repo | #1036061 // twoColorImage

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

Libraryless. Click here for Pure Java version (11130L/64K).

1  
static BufferedImage twoColorImage(Color bg, Color fg, IBinaryImage image) {
2  
  int fgInt = colorToInt(fg), bgInt = colorToInt(bg);
3  
  ret image == null ?: bufferedImageFromFunctionWithoutAlpha(
4  
    image.getWidth(), image.getHeight(), (x, y)
5  
      -> image.getBoolPixel_noRangeCheck(x, y) ? fgInt : bgInt);
6  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1036061
Snippet name: twoColorImage
Eternal ID of this version: #1036061/4
Text MD5: 6db82a86fb603af8e7dcd45eb1f55a24
Transpilation MD5: 730d88b0bfbb14768d0f79d62a45d8a7
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-09-05 01:27:12
Source code size: 312 bytes / 6 lines
Pitched / IR pitched: No / No
Views / Downloads: 167 / 223
Version history: 3 change(s)
Referenced in: [show references]