mirror of
https://github.com/IgorTimofeev/MineOS.git
synced 2026-01-06 19:22:40 +01:00
Багфикс скриншота экрана с новым форматом изображения
This commit is contained in:
parent
c0638887ce
commit
59829c7c5c
@ -292,7 +292,7 @@ end
|
||||
function event.takeScreenshot()
|
||||
if keyboard.isKeyDown(100) or keyboard.isKeyDown(183) then
|
||||
computer.beep(1500)
|
||||
local screenshotPath = "screenshot.jpg"
|
||||
local screenshotPath = "screenshot.pic"
|
||||
image.screenshot(screenshotPath)
|
||||
computer.beep(2000)
|
||||
computer.beep(2000)
|
||||
|
||||
@ -433,6 +433,25 @@ local function loadOldPng(path)
|
||||
return massiv
|
||||
end
|
||||
|
||||
--Сделать скриншот экрана и сохранить его по указанному пути
|
||||
function image.screenshot(path)
|
||||
local picture = {}
|
||||
local foreground, background, symbol
|
||||
picture.width, picture.height = gpu.getResolution()
|
||||
|
||||
for j = 1, picture.height do
|
||||
for i = 1, picture.width do
|
||||
foreground, background, symbol = gpu.get(i, j)
|
||||
table.insert(picture, background)
|
||||
table.insert(picture, foreground)
|
||||
table.insert(picture, 0x00)
|
||||
table.insert(picture, symbol)
|
||||
end
|
||||
end
|
||||
|
||||
image.save(path, picture)
|
||||
end
|
||||
|
||||
------------------------------------------ Примеры работы с библиотекой ------------------------------------------------
|
||||
|
||||
-- ecs.prepareToExit()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user