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

10
LINES

< > BotCompany Repo | #1036069 // twoColorImageWithAlpha

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

Transpiled version (11135L) is out of date.

1  
static BufferedImage twoColorImageWithAlpha(Color newBlack, Color newWhite, IBinaryImage image) {
2  
  int fgInt = colorToRGBA(newWhite), bgInt = colorToRGBA(newBlack);
3  
  ret image == null ?: bufferedImageFromFunctionWithAlpha(
4  
    image.getWidth(), image.getHeight(), (x, y)
5  
      -> image.getBoolPixel_noRangeCheck(x, y) ? fgInt : bgInt);
6  
}
7  
8  
static BufferedImage twoColorImageWithAlpha(IBinaryImage image, Color bg, Color fg) {
9  
  ret twoColorImageWithAlpha(bg, fg, image);
10  
}

Author comment

Began life as a copy of #1036061

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1036069
Snippet name: twoColorImageWithAlpha
Eternal ID of this version: #1036069/4
Text MD5: 111a8f379b4056988ff4a7366995a988
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 03:22:26
Source code size: 484 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 120 / 184
Version history: 3 change(s)
Referenced in: [show references]