-- The video rectangle: the picture shifted, scaled and turned inside a Sinden border, with a -- crosshair at a fixed overlay coordinate that must stay on the same point of the picture. The -- shift has no runtime setter, so it comes from --shiftx and --shifty and the script is run once -- for each of the three shifts; the scale and the rotation step here. dofile("Singe/Framework.singe") local font = fontLoad("Singe/FreeSansBold.ttf", 14) local width, height = overlayGetWidth(), overlayGetHeight() local crossX = math.floor(width / 4) local crossY = math.floor(height / 4) local frames = 0 local shot = 0 local steps = { { "as given", nil }, { "scale 50", function() return vldpSetScale(50) end }, { "scale 25", function() return vldpSetScale(25) end }, { "scale 100", function() return vldpSetScale(100) end }, { "rotate 90", function() return vldpSetRotate(90) end }, { "rotate 180", function() return vldpSetRotate(180) end }, { "rotate 270", function() return vldpSetRotate(270) end }, { "rotate 0", function() return vldpSetRotate(0) end }, } local label = steps[1][1] local applied = true local step = 1 local STEP_FRAMES = 20 local SHOT_DELAY = 10 fontSelect(font) discPlay() function onOverlayUpdate() frames = frames + 1 overlayClear() -- A frame around the very edge of the picture, so the rectangle's position and size are visible. colorForeground(255, 255, 0) overlayBox(0, 0, width - 1, height - 1) overlayBox(3, 3, width - 4, height - 4) -- Corner ticks tell a turned picture from a shifted one: the long arm is the top left corner. colorForeground(255, 0, 255) overlayLine(0, 0, 60, 0) overlayLine(0, 0, 0, 40) -- The crosshair sits a quarter of the way in and must stay on the same point of the picture. colorForeground(0, 255, 255) overlayCircle(crossX, crossY, 14) overlayLine(crossX - 24, crossY, crossX + 24, crossY) overlayLine(crossX, crossY - 24, crossX, crossY + 24) colorForeground(255, 255, 255) fontPrint(10, height - 46, string.format("%s scale %d rotate %d applied %s", label, vldpGetScale(), vldpGetRotate(), tostring(applied))) fontPrint(10, height - 26, string.format("overlay %dx%d crosshair %d,%d disc frame %d", width, height, crossX, crossY, discGetFrame())) -- One step every STEP_FRAMES frames, shot SHOT_DELAY frames later so the change is on screen. if (frames % STEP_FRAMES) == 0 then step = (frames / STEP_FRAMES) + 1 if steps[step] ~= nil then label = steps[step][1] if steps[step][2] ~= nil then applied = steps[step][2]() end end end if ((frames % STEP_FRAMES) == SHOT_DELAY) and (shot < #steps) then shot = shot + 1 singeScreenshot() end if shot >= #steps and (frames % STEP_FRAMES) == SHOT_DELAY + 2 then singeQuit() end return OVERLAY_UPDATED end