-- The picture drawn by `guipaint shot` and by the tests: same canvas primitives -- as the interactive tools, so the capture shows the real application state. local palette = require("paint.palette") local M = {} local function index_of(name) local slot = palette.slot_of(name) if slot == nil then return 0 end return palette.index_of_slot(slot) end local function solid(app, name, x1, y1, x2, y2) app.canvas:rect(x1, y1, x2, y2, index_of(name), true) end function M.picture(app) local canvas = app.canvas local width = canvas.width local height = canvas.height local ground = height - 24 canvas:fill(1, 1, index_of("nuit")) local stars = { { 14, 6 }, { 28, 12 }, { 52, 5 }, { 71, 9 }, { 120, 7 }, { 134, 13 }, } for position = 1, #stars do canvas:set(stars[position][1], stars[position][2], index_of("blanc")) end canvas:ellipse(math.floor(width * 0.85), 13, 9, 6, index_of("jaune"), true) solid(app, "gris", 20, 17, 40, 19) solid(app, "gris", 24, 15, 36, 17) solid(app, "vert", 1, ground, width, height) solid(app, "brun", 24, 34, 72, ground) for row = 16, 34 do local half = math.floor((row - 16) * 1.8) solid(app, "brun", 48 - half, row, 48 + half, row) end solid(app, "nuit", 38, 50, 46, ground) solid(app, "cyan", 54, 44, 64, 52) solid(app, "brun", 100, 50, 106, ground) canvas:ellipse(103, 40, 14, 12, index_of("vert"), true) app.slot = palette.slot_of("jaune") app.tool = 4 app.cursor_x = math.floor(width * 0.85) app.cursor_y = 13 app.cursor_in_canvas = true app.message = "PAYSAGE - CLIC POUR DESSINER" return app end return M