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

46
LINES

< > BotCompany Repo | #1004904 // Decipher The Eleutheria Logo, Step 2

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (5153L/34K/114K).

!752

!include #1004681 // Concepts

sS imageID = "#1002132";

static RGBImage image;
static ImageSurface imageSurface;
static Choice c; // Choice currently displayed

sclass Choice extends Concept {
  int x, y; // color values in RRGGBB
  S lua;
  bool[] mark;
}

p {
  loadConceptsFrom("#1004895");
  
  image = loadImage(imageID);
  int w = image.getWidth(), h = image.getHeight();
  
  c = conceptOfType(Choice.class);
  bool[] mark = cloneArray(c.mark);
  fillVertical(mark, w, h, 10);
  imageSurface = showImage(greenWhiteMarkedImage(image, mark));
}

static void fillVertical(bool[] mark, int w, int h, int fillh) {     
  for (int x = 0; x < w; x++) {
    for (int y = 0; y < h; y++) {
      if (!mark[y*w+x]) continue;
      while (y < h && mark[y*w+x]) ++y;
      int y2 = y+1;
      while (y2 < h && !mark[y2*w+x]) ++y2;
      if (y2 >= h) break;
      // y = first unset pixel, y2 = first set pixel
      int len = y2-y;
      if (len <= fillh)
        while (y < y2) mark[(y++)*w+x] = true;
      else
        y = y2;
      --y;
    }
  }
}

Author comment

Began life as a copy of #1004895

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

-
Snippet ID: #1004904
Snippet name: Decipher The Eleutheria Logo, Step 2
Eternal ID of this version: #1004904/1
Text MD5: fa2ff26be54f3249396ae0ca7051e572
Transpilation MD5: 2e13022d3650e7ee07e14c279e09083b
Author: stefan
Category: javax / a.i.
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-09-15 23:35:23
Source code size: 1098 bytes / 46 lines
Pitched / IR pitched: No / No
Views / Downloads: 643 / 737
Referenced in: