Libraryless. Click here for Pure Java version (6510L/37K).
1 | sclass FloodFillBWImage extends FloodFill { |
2 | IBWImage img; |
3 | settable double tolerance = 1/8.0; // color tolerance pixel-to-pixel as fraction of 1 |
4 | |
5 | *(IBWImage *img) { super(img.getWidth(), img.getHeight()); } |
6 | |
7 | bool isConnectable(Pt a, Pt b) { |
8 | float brightnessA = img.getFloatPixel(a); |
9 | float brightnessB = img.getFloatPixel(b); |
10 | ret abs(brightnessA-brightnessB) <= tolerance; |
11 | } |
12 | } |
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: | 149 / 238 |
Version history: | 2 change(s) |
Referenced in: | [show references] |