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

25
LINES

< > BotCompany Repo | #1034030 // gazelle22_highlightRegionOutline

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

Libraryless. Click here for Pure Java version (19032L/116K).

svoid gazelle22_highlightRegionOutline(int[] pixels,
  Gazelle22_ImageToRegions itr, RegionBorder_innerPoints x) {
  class X {
    bool hole;
    int n;
    Gazelle22_GradientImage gradientImage = new(itr.posterized);
    
    *() {
      gradientImage.init();
      int color = 0xFF008000, holeColor = 0xFFFFB266;
      x.onNewTrace(isHole -> hole = isHole);
      x.onFoundPoint(p -> {
        ++n;
        bool gradient = gradientImage.isGradientPoint(p.x, p.y);
        int col = hole ? holeColor : color;
        if (gradient)
          //col = darkerIntColor(col);
          if (odd(n)) ret;
        pixels[p.y*itr.regions.w+p.x] = col;
      });
      x.run();
    }
  }
  new X;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, ekrmjmnbrukm, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034030
Snippet name: gazelle22_highlightRegionOutline
Eternal ID of this version: #1034030/8
Text MD5: 33b8ada27478dcbf378b735a3f6a9ce7
Transpilation MD5: 69fe0334ac28457b14d6a7bd8707761d
Author: stefan
Category: javax / gazelle 22
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-17 18:39:51
Source code size: 712 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 158 / 255
Version history: 7 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)