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

54
LINES

< > BotCompany Repo | #1004895 // Decipher The Eleutheria Logo

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

Uses 5262K of libraries. Click here for Pure Java version (5718L/38K/125K).

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  
  S lua() {
17  
    lua = "for y=0, h-1 do for x=0, w-1 do local color = getInt(x, y) if color >= \*x*/ and color <= \*y*/ then markPixel(x, y) end end end";
18  
    change();
19  
    ret lua;
20  
  }
21  
}
22  
23  
p {
24  
  loadAndAutoSaveConcepts();
25  
  
26  
  image = loadImage(imageID);
27  
  int w = image.getWidth(), h = image.getHeight();
28  
  bool[] mark = new bool[w*h];
29  
  //for i over mark: mark[i] = (i & 15) < 8;
30  
  //for y to h: for x to w:
31  
  //  mark[y*w+x] = true;
32  
  
33  
  c = unlisted(Choice.class);
34  
  //c.x = 0x200000; c.y = 0xE00000;
35  
  //c.x = 0; c.y = 0xFFFFFF;
36  
  //c.x = 0x200000; c.y = 0xFFFFFF;
37  
  c.x = 0x100000; c.y = 0xFFFFFF;
38  
  print(c.lua());
39  
  c.mark = mark = markImageThroughLua(image, c.lua());
40  
  
41  
  JPanel controls = centeredLine(jbutton("Save", "saveChoice"));
42  
  
43  
  imageSurface = showImage(greenWhiteMarkedImage(image, mark));
44  
  addToWindow(imageSurface, controls);
45  
}
46  
47  
static void saveChoice() {
48  
  if (hasWhere(listConcepts(Choice.class), "x", c.x, "y", c.y))
49  
    print("Choice exists");
50  
  else {
51  
    c.register();
52  
    print("Choice registered!");
53  
  }
54  
}

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: #1004895
Snippet name: Decipher The Eleutheria Logo
Eternal ID of this version: #1004895/1
Text MD5: 159c0d030eac27c01fb96cdabf7f305f
Transpilation MD5: d98b5aacbadf14f9b2c38c2c9f543229
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:21:11
Source code size: 1355 bytes / 54 lines
Pitched / IR pitched: No / No
Views / Downloads: 544 / 901
Referenced in: [show references]