Поиск по сайту
Результаты поиска по тегам 'screenshots'.
Найдено 1 результат
-
Программа позволяет создавать снимки экрана. Сохраняет она его в файл /screenshots/Screenshot-Год-День-Час-Минута.ast Формат ast Для выхода из программы после распечатывания экрана надо по нему нажать(создать ивент touch). Вот код "AsumScreenshoter"'а: local mode = ({...})[1] if mode==nil then print("Использование: screenshot init для создания ивента сохранения экрана(Кнопка Print Screen, папка screenshots)\n screenshot <имя файла> для просмотра(По окончанию просмотра нажмите на экран)"); os.exit() return end local fs = require("filesystem") local unicode = require("unicode") local gpu = require("component").gpu local event = require("event") local function dec2hex(n, s) local h = string.format("%x", n) return string.rep("0", s-string.len(h))..h end local function hex2dec(s) return tonumber("0x"..s) end local function createScreenshotFile() DD, HH, MM, SS = os.date("%Y"), os.date("%H"), os.date("%M"), os.date("%S") if not fs.isDirectory("/screenshots") then fs.makeDirectory("/screenshots") end return io.open("/screenshots/Screenshot-"..DD.."-"..HH.."-"..MM.."-"..SS..".ast", "w") end local function getScreen() local W, H = gpu.getResolution() local screenshot = dec2hex(W, 2)..dec2hex(H, 2) local lfg, lbg for y=1, H do for x=1, W do local symbol, fgcolor, bgcolor = gpu.get(x, y) if lfg ~= fgcolor then lfg = fgcolor screenshot = screenshot .. "␑" screenshot = screenshot .. dec2hex(fgcolor, 6) end if lbg ~= bgcolor then lbg = bgcolor screenshot = screenshot .. "␒" screenshot = screenshot .. dec2hex(bgcolor, 6) end screenshot = screenshot .. symbol end end return screenshot end local function writeScreen() local file=createScreenshotFile() file:write(getScreen()) file:flush() file:close() end local function printScreen(filename) local screenshot=io.lines(filename)() local oldw, oldh = gpu.getResolution() local header = screenshot:sub(1, 4) screenshot = screenshot:sub(5) local W = hex2dec(header:sub(1, 2)) local x = 0 local H = hex2dec(header:sub(3, 4)) local y = 0 gpu.setResolution(W, H) while y < H do y = y + 1 x = 0 while x < W do local sym = unicode.sub(screenshot, 1, 1) if sym == "␑" then gpu.setForeground(hex2dec(unicode.sub(screenshot, 2, 7))) screenshot = unicode.sub(screenshot, 8) elseif sym == "␒" then gpu.setBackground(hex2dec(unicode.sub(screenshot, 2, 7))) screenshot = unicode.sub(screenshot, 8) else x = x + 1 gpu.set(x, y, sym) screenshot = unicode.sub(screenshot, 2) end end end event.pull("touch") gpu.setResolution(oldw, oldh) end local function saveScreenByKey(_, _, key1, key2) if key1==0 and key2==183 then writeScreen() end end if mode=="init" then event.listen("key_down", saveScreenByKey) else printScreen(mode) end Надеюсь вы будете пользоваться этой программой!=) Для того,что бы начать делать скриншоты, после каждой перезагрузки надо запустить приложение с параметром init Для того,что бы создать скриншот после инициализации-надо нажать кнопку Print Screen
- 18 ответов
-
- opencomputers
- lua
-
(и ещё 1 )
Теги: