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.

static BufferedImage twoColorImageWithAlpha(Color newBlack, Color newWhite, IBinaryImage image) {
  int fgInt = colorToRGBA(newWhite), bgInt = colorToRGBA(newBlack);
  ret image == null ?: bufferedImageFromFunctionWithAlpha(
    image.getWidth(), image.getHeight(), (x, y)
      -> image.getBoolPixel_noRangeCheck(x, y) ? fgInt : bgInt);
}

static BufferedImage twoColorImageWithAlpha(IBinaryImage image, Color bg, Color fg) {
  ret twoColorImageWithAlpha(bg, fg, image);
}

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: 63 / 99
Version history: 3 change(s)
Referenced in: [show references]