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

12
LINES

< > BotCompany Repo | #1033583 // FloodFillBWImage [dev.]

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

Libraryless. Click here for Pure Java version (6510L/37K).

sclass FloodFillBWImage extends FloodFill {
  IBWImage img;
  settable double tolerance = 1/8.0; // color tolerance pixel-to-pixel as fraction of 1
  
  *(IBWImage *img) { super(img.getWidth(), img.getHeight()); }
  
  bool isConnectable(Pt a, Pt b) {
    float brightnessA = img.getFloatPixel(a);
    float brightnessB = img.getFloatPixel(b);
    ret abs(brightnessA-brightnessB) <= tolerance;
  }
}

Author comment

Began life as a copy of #1033582

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1033583
Snippet name: FloodFillBWImage [dev.]
Eternal ID of this version: #1033583/3
Text MD5: 51d4f986492daa90e0ffcf31173bb720
Transpilation MD5: 2e3044ffaa9b83dfd6b7c814765cea2e
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-12-26 23:18:37
Source code size: 411 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 147 / 234
Version history: 2 change(s)
Referenced in: [show references]