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).

1  
!752
2  
3  
!include #1004681 // Concepts
4  
5  
sS imageID = "#1002132";
6  
7  
static RGBImage image;
8  
static ImageSurface imageSurface;
9  
static Choice c; // Choice currently displayed
10  
11  
sclass Choice extends Concept {
12  
  int x, y; // color values in RRGGBB
13  
  S lua;
14  
  bool[] mark;
15  
}
16  
17  
p {
18  
  loadConceptsFrom("#1004895");
19  
  
20  
  image = loadImage(imageID);
21  
  int w = image.getWidth(), h = image.getHeight();
22  
  
23  
  c = conceptOfType(Choice.class);
24  
  bool[] mark = cloneArray(c.mark);
25  
  fillVertical(mark, w, h, 10);
26  
  imageSurface = showImage(greenWhiteMarkedImage(image, mark));
27  
}
28  
29  
static void fillVertical(bool[] mark, int w, int h, int fillh) {     
30  
  for (int x = 0; x < w; x++) {
31  
    for (int y = 0; y < h; y++) {
32  
      if (!mark[y*w+x]) continue;
33  
      while (y < h && mark[y*w+x]) ++y;
34  
      int y2 = y+1;
35  
      while (y2 < h && !mark[y2*w+x]) ++y2;
36  
      if (y2 >= h) break;
37  
      // y = first unset pixel, y2 = first set pixel
38  
      int len = y2-y;
39  
      if (len <= fillh)
40  
        while (y < y2) mark[(y++)*w+x] = true;
41  
      else
42  
        y = y2;
43  
      --y;
44  
    }
45  
  }
46  
}

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: 580 / 662
Referenced in: [show references]