!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!"); } }