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

!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;
  
  S lua() {
    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";
    change();
    ret lua;
  }
}

p {
  loadAndAutoSaveConcepts();
  
  image = loadImage(imageID);
  int w = image.getWidth(), h = image.getHeight();
  bool[] mark = new bool[w*h];
  //for i over mark: mark[i] = (i & 15) < 8;
  //for y to h: for x to w:
  //  mark[y*w+x] = true;
  
  c = unlisted(Choice.class);
  //c.x = 0x200000; c.y = 0xE00000;
  //c.x = 0; c.y = 0xFFFFFF;
  //c.x = 0x200000; c.y = 0xFFFFFF;
  c.x = 0x100000; c.y = 0xFFFFFF;
  print(c.lua());
  c.mark = mark = markImageThroughLua(image, c.lua());
  
  JPanel controls = centeredLine(jbutton("Save", "saveChoice"));
  
  imageSurface = showImage(greenWhiteMarkedImage(image, mark));
  addToWindow(imageSurface, controls);
}

static void saveChoice() {
  if (hasWhere(listConcepts(Choice.class), "x", c.x, "y", c.y))
    print("Choice exists");
  else {
    c.register();
    print("Choice registered!");
  }
}

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