MineOS/Beta/PS3.lua

649 lines
43 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

------------------------------------------------ Копирайт --------------------------------------------------------------
local copyright = [[
Photoshop v3.0 (закрытая бета)
Автор: IT
Контакты: https://vk.com/id7799889
Соавтор: Pornogion
Контакты: https://vk.com/id88323331
]]
--Массив слоев
local layers = {
{
show = true,
name = "Mamu ebal",
0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ",
0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x33ff66, 0x0092ff, 0x00, " ", 0x33ff66, 0x0092ff, 0x00, " ", 0x33ff66, 0x0092ff, 0x00, " ", 0x33ff66, 0x0092ff, 0x00, " ", 0x33ff66, 0x0092ff, 0x00, " ", 0x33ff66, 0x0092ff, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x336d3f, 0x004936, 0x00, " ", 0x336d3f, 0x004936, 0x00, " ", 0x336d3f, 0x004936, 0x00, " ", 0x336d3f, 0x004936, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ",
0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ",
0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x339286, 0x004936, 0x00, " ", 0x339286, 0x004936, 0x00, " ", 0x339286, 0x004936, 0x00, " ", 0x339286, 0x004936, 0x00, " ", 0x339286, 0x004936, 0x00, " ", 0x339286, 0x004936, 0x00, " ", 0x339286, 0x004936, 0x00, " ", 0x339286, 0x004936, 0x00, " ", 0x339286, 0x004936, 0x00, " ", 0x339286, 0x004936, 0x00, " ", 0x339286, 0x004936, 0x00, " ", 0x339286, 0x004936, 0x00, " ", 0x339286, 0x004936, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ",
0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x004936, 0x00926d, 0x00, " ", 0x004936, 0x00926d, 0x00, " ", 0x004936, 0x00926d, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ",
0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x004936, 0x339286, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ",
0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x004936, 0x339286, 0x00, " ", 0x004936, 0x339286, 0x00, " ", 0x339286, 0x004936, 0x00, " ", 0x339286, 0x004936, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ",
0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x004936, 0x339286, 0x00, " ", 0x004936, 0x339286, 0x00, " ", 0x339286, 0x004936, 0x00, " ", 0x339286, 0x004936, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0xff6d80, 0x004940, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x660000, 0x004940, 0x00, " ", 0x660000, 0x004940, 0x00, " ", 0x660000, 0x004940, 0x00, " ", 0x660000, 0x004940, 0x00, " ", 0x660000, 0x004940, 0x00, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ",
0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x004936, 0x339286, 0x00, " ", 0x004936, 0x339286, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x339286, 0x004936, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0xff6d80, 0x004940, 0x00, " ", 0xff6d80, 0x004940, 0x00, " ", 0xff6d80, 0x004940, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x004940, 0xffffff, 0x00, " ", 0x660000, 0x004940, 0x00, " ", 0x990000, 0x004940, 0x00, " ", 0x990000, 0x004940, 0x00, " ", 0x990000, 0x004940, 0x00, " ", 0x990000, 0x004940, 0x00, " ", 0x990000, 0x004940, 0x00, " ", 0x660000, 0x004940, 0x00, " ", 0x660000, 0x004940, 0x00, " ", 0xffffff, 0xcccccc, 0xff, " ",
0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x004936, 0x339286, 0x00, " ", 0x004936, 0x339286, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0xff6d80, 0x004940, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0x660000, 0x004940, 0x00, " ", 0x660000, 0x004940, 0x00, " ", 0x660000, 0x004940, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0x990000, 0x004940, 0x00, " ", 0x990000, 0x004940, 0x00, " ", 0x660000, 0x004940, 0x00, " ",
0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x004936, 0x339286, 0x00, " ", 0x004936, 0x339286, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x339286, 0x004936, 0x00, " ", 0xff6d80, 0x004940, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xff0000, 0xffffff, 0x00, " ", 0xff0000, 0xffffff, 0x00, " ", 0xff0000, 0x004940, 0x00, " ", 0xff0000, 0x004940, 0x00, " ", 0xff0000, 0x004940, 0x00, " ", 0xff0000, 0x004940, 0x00, " ", 0xff0000, 0x004940, 0x00, " ", 0xff0000, 0xffffff, 0x00, " ", 0xff0000, 0xffffff, 0x00, " ", 0xff0000, 0xffffff, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0x990000, 0x004940, 0x00, " ", 0x660000, 0x004940, 0x00, " ",
0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x004936, 0x339286, 0x00, " ", 0x339286, 0x004936, 0x00, " ", 0x339286, 0x004936, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xff0000, 0xffffff, 0x00, " ", 0xff0000, 0xffffff, 0x00, " ", 0xff0000, 0xffffff, 0x00, " ", 0xff0000, 0xffffff, 0x00, " ", 0xff0000, 0xffffff, 0x00, " ", 0xff0000, 0xffffff, 0x00, " ", 0xff0000, 0xffffff, 0x00, " ", 0xff0000, 0xffffff, 0x00, " ", 0xff0000, 0xffffff, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0x990000, 0x004940, 0x00, " ", 0x660000, 0x004940, 0x00, " ", 0xffffff, 0xcccccc, 0xff, " ",
0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x004936, 0x339286, 0x00, " ", 0x339286, 0x004936, 0x00, " ", 0x339286, 0x004936, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xff0000, 0xffffff, 0x00, " ", 0xff0000, 0xffffff, 0x00, " ", 0xff0000, 0xffffff, 0x00, " ", 0xff0000, 0xffffff, 0x00, " ", 0xff0000, 0xffffff, 0x00, " ", 0xff0000, 0xffffff, 0x00, " ", 0xff0000, 0xffffff, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0x990000, 0x004940, 0x00, " ", 0x990000, 0x004940, 0x00, " ", 0x660000, 0x004940, 0x00, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ",
0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x004936, 0x339286, 0x00, " ", 0x339286, 0x004936, 0x00, " ", 0x339286, 0x004936, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xff0000, 0xffffff, 0x00, " ", 0xff0000, 0xffffff, 0x00, " ", 0xff0000, 0xffffff, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0x990000, 0x004940, 0x00, " ", 0x990000, 0x004940, 0x00, " ", 0x660000, 0x004940, 0x00, " ", 0x660000, 0x004940, 0x00, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ",
0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x338592, 0x003f49, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x1e1e1e, 0x004936, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x004936, 0x339286, 0x00, " ", 0x339286, 0x004936, 0x00, " ", 0x339286, 0x004936, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xff4940, 0x004940, 0x00, " ", 0xff0000, 0xffffff, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0x990000, 0x004940, 0x00, " ", 0x990000, 0x004940, 0x00, " ", 0x660000, 0x004940, 0x00, " ", 0x660000, 0x004940, 0x00, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ",
0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0x338592, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x003f49, 0xffffff, 0x00, " ", 0x004940, 0xffffff, 0x00, " ", 0x004940, 0xffffff, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0xcc0000, 0x004940, 0x00, " ", 0x990000, 0x004940, 0x00, " ", 0x990000, 0x004940, 0x00, " ", 0x660000, 0x004940, 0x00, " ", 0x660000, 0x004940, 0x00, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ",
0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0x660000, 0x004940, 0x00, " ", 0x660000, 0x004940, 0x00, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ", 0xffffff, 0xcccccc, 0xff, " ",
},
}
-- for i = 1, 10 do
-- table.insert(layers, {show = true, name = "Ahaha"..tostring(math.random(1, 9)), 0x00FFFF, 0xFF0000, 0x00, "B"})
-- end
--Массив главного изображения
local masterPixels = {}
------------------------------------------------ Библиотеки --------------------------------------------------------------
--Не требующиеся для ОС
--local ecs = require("ECSAPI")
--local fs = require("filesystem")
--local unicode = require("unicode")
--Обязательные
local colorlib = require("colorlib")
local palette = require("palette")
local event = require("event")
local gpu = component.gpu
------------------------------------------------ Переменные --------------------------------------------------------------
--Базовая цветовая схема программы
local colors = {
toolbar = 0x535353,
layersToolbar = 0x4b4b4b,
toolbarInfo = 0x3d3d3d,
toolbarButton = 0x3d3d3d,
toolbarButtonText = 0xeeeeee,
drawingArea = 0x262626,
console = 0x3d3d3d,
consoleText = 0x999999,
transparencyWhite = 0xffffff,
transparencyGray = 0xcccccc,
transparencyVariable = 0xffffff,
}
--Различные константы и размеры тулбаров и кликабельных зон
local sizes = {
widthOfLeftBar = 6,
widthOfRightBar = 20,
}
sizes.xSize, sizes.ySize = gpu.getResolution()
sizes.xStartOfDrawingArea = sizes.widthOfLeftBar + 1
sizes.xEndOfDrawingArea = sizes.xSize - sizes.widthOfRightBar
sizes.yStartOfDrawingArea = 2
sizes.yEndOfDrawingArea = sizes.ySize
sizes.widthOfDrawingArea = sizes.xEndOfDrawingArea - sizes.xStartOfDrawingArea + 1
sizes.heightOfDrawingArea = sizes.yEndOfDrawingArea - sizes.yStartOfDrawingArea + 1
sizes.heightOfLeftBar = sizes.ySize - 1
--Для правого тулбара
sizes.heightOfRightBar = sizes.heightOfLeftBar
sizes.xStartOfRightBar = sizes.xSize - sizes.widthOfRightBar + 1
sizes.yStartOfRightBar = 2
sizes.yStartOfLayers = sizes.yStartOfRightBar
sizes.heightOfLayers = sizes.ySize - sizes.yStartOfLayers - 1
sizes.heightOfOneLayer = 3
sizes.countOfLayers = math.floor(sizes.heightOfLayers / sizes.heightOfOneLayer)
--Для изображения
sizes.widthOfImage = 40
sizes.heightOfImage = 17
sizes.sizeOfPixelData = 4
sizes.xStartOfImage = 9
sizes.yStartOfImage = 3
sizes.xEndOfImage = sizes.xStartOfImage + sizes.widthOfImage - 1
sizes.yEndOfImage = sizes.yStartOfImage + sizes.heightOfImage - 1
--Инструменты
sizes.heightOfInstrument = 3
sizes.yStartOfInstruments = 2
local instruments = {
{"", "Move"},
{"", "Crop"},
{"", "Brush"},
{"", "Eraser"},
{"", "Text"},
}
local currentInstrument = 3
local currentLayer = 1
local currentBackground = 0x000000
local currentForeground = 0xFFFFFF
local currentAlpha = 0x00
local currentSymbol = " "
local drawLayersFrom = 1
local currentBrushSize = 1
--Верхний тулбар
local topToolbar = {{"PS", 0xaaaaff}, {"Файл"}, {"Изображение"}, {"Инструменты"}, {"Фильтры"}}
------------------------------------------------ Функции отрисовки --------------------------------------------------------------
--Объекты для тача
local obj = {}
local function newObj(class, name, ...)
obj[class] = obj[class] or {}
obj[class][name] = {...}
end
local function drawTransparentPixel(xPos, yPos, i, j)
if j % 2 == 0 then
if i % 2 == 0 then
colors.transparencyVariable = colors.transparencyWhite
else
colors.transparencyVariable = colors.transparencyGray
end
else
if i % 2 == 0 then
colors.transparencyVariable = colors.transparencyGray
else
colors.transparencyVariable = colors.transparencyWhite
end
end
gpu.setBackground(colors.transparencyVariable)
gpu.set(xPos, yPos, " ")
end
local function drawBackground()
ecs.square(sizes.xStartOfDrawingArea, sizes.yStartOfDrawingArea, sizes.widthOfDrawingArea, sizes.heightOfDrawingArea, colors.drawingArea)
end
local function drawInstruments()
local yPos = sizes.yStartOfInstruments
for i = 1, #instruments do
if currentInstrument == i then
ecs.square(1, yPos, sizes.widthOfLeftBar, sizes.heightOfInstrument, colors.toolbarButton)
else
ecs.square(1, yPos, sizes.widthOfLeftBar, sizes.heightOfInstrument, colors.toolbar)
end
ecs.colorText(3, yPos + 1, colors.toolbarButtonText, instruments[i][1])
newObj("Instruments", i, 1, yPos, sizes.widthOfLeftBar, yPos + sizes.heightOfInstrument - 1)
yPos = yPos + sizes.heightOfInstrument
end
end
local function drawColors()
local xPos, yPos = 2, sizes.ySize - 4
ecs.square(xPos, yPos, 3, 2, currentBackground)
ecs.square(xPos + 3, yPos + 1, 1, 2, currentForeground)
ecs.square(xPos + 1, yPos + 2, 2, 1, currentForeground)
ecs.colorTextWithBack(xPos + 1, yPos + 3, 0xaaaaaa, colors.toolbar, "←→")
newObj("Colors", 1, xPos, yPos, xPos + 2, yPos + 1)
newObj("Colors", 2, xPos + 3, yPos + 1, xPos + 3, yPos + 2)
newObj("Colors", 3, xPos + 1, yPos + 2, xPos + 3, yPos + 2)
newObj("Colors", 4, xPos + 1, yPos + 3, xPos + 2, yPos + 3)
end
local function drawLeftBar()
ecs.square(1, 2, sizes.widthOfLeftBar, sizes.heightOfLeftBar, colors.toolbar)
drawInstruments()
drawColors()
end
local function drawLayers()
obj["Layers"] = {}
--Рисуем надпись "слои"
yPos = sizes.yStartOfLayers
ecs.square(sizes.xStartOfRightBar, yPos, sizes.widthOfRightBar, 1, colors.toolbarInfo)
ecs.colorText(sizes.xStartOfRightBar + 1, yPos, 0xffffff, "Слои ("..currentLayer.." из "..#layers..")")
yPos = yPos + 1
--Очищаем панель слоев
ecs.square(sizes.xStartOfRightBar, yPos, sizes.widthOfRightBar - 1, sizes.heightOfLayers, colors.toolbar)
--Рисуем скроллбар слоев
ecs.srollBar(sizes.xSize, yPos, 1, sizes.heightOfLayers, #layers, drawLayersFrom, 0xFFFFFF, ecs.colors.blue)
--Рисуем кнопочки слоев
local button1, button2, button3, button4, button5, button6 = "","","D","J","N","R"
local xPos = sizes.xStartOfRightBar + 2
local color = 0x000000
ecs.square(sizes.xStartOfRightBar, sizes.ySize, sizes.widthOfRightBar, 1, colors.layersToolbar)
if currentLayer > 1 then ecs.colorText(xPos, sizes.ySize, colors.toolbarButtonText, button1) else ecs.colorText(xPos, sizes.ySize, color, button1) end; xPos = xPos + 3
if currentLayer < #layers then ecs.colorText(xPos, sizes.ySize, colors.toolbarButtonText, button2) else ecs.colorText(xPos, sizes.ySize, color, button2) end; xPos = xPos + 3
ecs.colorText(xPos, sizes.ySize, colors.toolbarButtonText, button3); xPos = xPos + 3
if #layers > 1 then ecs.colorText(xPos, sizes.ySize, colors.toolbarButtonText, button4) else ecs.colorText(xPos, sizes.ySize, color, button4) end; xPos = xPos + 3
ecs.colorText(xPos, sizes.ySize, colors.toolbarButtonText, button5); xPos = xPos + 3
if #layers > 1 then ecs.colorText(xPos, sizes.ySize, colors.toolbarButtonText, button6) else ecs.colorText(xPos, sizes.ySize, color, button6) end; xPos = xPos + 3
--Рисуем сами слои
local color = colors.toolbar
gpu.setForeground(colors.toolbarButtonText)
local counter = 1
for i = drawLayersFrom, #layers do
if counter > sizes.countOfLayers then break end
--Если это текущий слой
if i == currentLayer then
color = 0x66b6ff
ecs.square(sizes.xStartOfRightBar, yPos, sizes.widthOfRightBar - 1, 3, color)
else
if i % 2 == 0 then
color = 0x666666
ecs.square(sizes.xStartOfRightBar, yPos, sizes.widthOfRightBar - 1, 3, color)
else
color = colors.toolbar
gpu.setBackground(color)
end
end
gpu.set(sizes.xStartOfRightBar + 1, yPos + 1, (function() if layers[i].show then return "" else return "" end end)())
gpu.set(sizes.xStartOfRightBar + 4, yPos + 1, ecs.stringLimit("end", layers[i].name, sizes.widthOfRightBar - 6))
newObj("Layers", i, sizes.xStartOfRightBar, yPos, sizes.xSize - 1, yPos + 2)
counter = counter + 1
yPos = yPos + 3
end
end
local function drawRightBar()
ecs.square(sizes.xStartOfRightBar, sizes.yStartOfRightBar, sizes.widthOfRightBar, sizes.heightOfRightBar, colors.toolbar)
-- --Рисуем надпись "Кисть"
-- ecs.square(sizes.xStartOfRightBar, yPos, sizes.widthOfRightBar, 1, colors.toolbarInfo)
-- ecs.colorText(sizes.xStartOfRightBar + 1, yPos, 0xffffff, "Параметры кисти")
--Рисуем слои
drawLayers()
end
local function drawTopBar()
ecs.square(1, 1, sizes.xSize, 1, colors.toolbar)
local xPos = 3
local spaceBetween = 2
for i = 1, #topToolbar do
ecs.colorText(xPos, 1, topToolbar[i][2] or 0xffffff, topToolbar[i][1])
xPos = xPos + unicode.len(topToolbar[i][1]) + spaceBetween
end
end
local function createEmptyMasterPixels()
--Очищаем мастерпиксельс и задаем ширину с высотой
masterPixels = {}
masterPixels.width = sizes.widthOfImage
masterPixels.height = sizes.heightOfImage
--Создаем пустой мастерпиксельс
for j = 1, sizes.heightOfImage * sizes.widthOfImage do
table.insert(masterPixels, 0x000000)
table.insert(masterPixels, 0x000000)
table.insert(masterPixels, 0xFF)
table.insert(masterPixels, " ")
end
--ecs.error("#masterPixels = "..#masterPixels)
end
local function mergeAllLayersToMasterPixels()
--Перебираем все слои
local layer = #layers
while layer >= 1 do
--Если слой не скрыт
if layers[layer].show then
--Перебираем все пиксели в слоях
for iterator = 1, sizes.widthOfImage * sizes.heightOfImage * 4, 4 do
--Если в данном слое существует такой элемент по итератору, то заменить мастерпикселевский им, а если нет, то похуй
masterPixels[iterator] = layers[layer][iterator] or masterPixels[iterator]
masterPixels[iterator + 1] = layers[layer][iterator + 1] or masterPixels[iterator + 1]
masterPixels[iterator + 2] = layers[layer][iterator + 2] or masterPixels[iterator + 2]
masterPixels[iterator + 3] = layers[layer][iterator + 3] or masterPixels[iterator + 3]
end
end
layer = layer - 1
end
end
--Формула конвертации итератора массива в абсолютные координаты пикселя изображения
local function convertIteratorToCoords(iterator)
--Приводим итератор к корректному виду (1 = 1, 5 = 2, 9 = 3, 13 = 4, 17 = 5, ...)
iterator = (iterator + sizes.sizeOfPixelData - 1) / sizes.sizeOfPixelData
--Получаем остаток от деления итератора на ширину изображения
local ostatok = iterator % sizes.widthOfImage
--Если остаток равен 0, то х равен ширине изображения, а если нет, то х равен остатку
local x = (ostatok == 0) and sizes.widthOfImage or ostatok
--А теперь как два пальца получаем координату по Y
local y = math.ceil(iterator / sizes.widthOfImage)
--Очищаем остаток из оперативки
ostatok = nil
--Возвращаем координаты
return x, y
end
--Формула конвертации абсолютных координат пикселя изображения в итератор для массива
local function convertCoordsToIterator(x, y)
--Конвертируем координаты в итератор
return (sizes.widthOfImage * (y - 1) + x) * sizes.sizeOfPixelData - sizes.sizeOfPixelData + 1
end
local function console(text)
ecs.square(sizes.xStartOfDrawingArea, sizes.ySize, sizes.widthOfDrawingArea, 1, colors.console)
local _, total, used = ecs.getInfoAboutRAM()
ecs.colorText(sizes.xEndOfDrawingArea - 15, sizes.ySize, colors.consoleText, used.."/"..total.." KB RAM")
gpu.set(sizes.xStartOfDrawingArea + 1, sizes.ySize, text)
_, total, used = nil, nil, nil
end
local function drawImage()
--Стартовые нужности
local background, foreground, alpha, symbol = 0x000000, 0x000000, 0xFF, " "
local oldBackground, oldForeground = gpu.getBackground(), gpu.getForeground()
local xPixel, yPixel = 1, 1
local xPos, yPos = sizes.xStartOfImage, sizes.yStartOfImage
--Перебираем массив мастерпиксельса
for i = 1, #masterPixels, 4 do
--Если пиксель входит в разрешенную зону рисования
if xPos >= sizes.xStartOfDrawingArea and xPos <= sizes.xEndOfDrawingArea and yPos >= sizes.yStartOfDrawingArea and yPos <= sizes.yEndOfDrawingArea then
--Получаем данные о пикселе
background, foreground, alpha, symbol = masterPixels[i], masterPixels[i + 1], masterPixels[i + 2], masterPixels[i + 3]
--Если пиксель не прозрачный
if alpha < 0xFF then
--Если новый фон не равен старому, то сменить его
if background ~= oldBackground then oldBackground = background; gpu.setBackground(background) end
if foreground ~= oldForeground then oldForeground = foreground; gpu.setForeground(foreground) end
gpu.setBackground(background)
gpu.setForeground(foreground)
gpu.set(xPos, yPos, symbol)
--Если пиксель прозрачный
else
drawTransparentPixel(xPos, yPos, xPixel, yPixel)
oldBackground = colors.transparencyVariable
end
end
--Всякие расчеты координат
xPixel = xPixel + 1
xPos = xPos + 1
if xPixel > sizes.widthOfImage then xPixel = 1; xPos = sizes.xStartOfImage; yPixel = yPixel + 1; yPos = yPos + 1 end
end
end
local function drawBackgroundAndImage()
drawBackground()
drawImage()
end
local function drawAll()
ecs.prepareToExit()
drawBackground()
drawLeftBar()
drawRightBar()
drawTopBar()
--Создаем картинку
mergeAllLayersToMasterPixels()
--Рисуем картинку
drawBackgroundAndImage()
console("Весь интерфейс перерисован!")
end
------------------------------------------------ Функции расчета --------------------------------------------------------------
local function move(direction)
mergeAllLayersToMasterPixels()
if direction == "up" then
sizes.yStartOfImage = sizes.yStartOfImage - 2
elseif direction == "down" then
sizes.yStartOfImage = sizes.yStartOfImage + 2
elseif direction == "left" then
sizes.xStartOfImage = sizes.xStartOfImage - 2
elseif direction == "right" then
sizes.xStartOfImage = sizes.xStartOfImage + 2
end
drawBackgroundAndImage()
end
local function setPixel(iterator, background, foreground, alpha, symbol)
layers[currentLayer][iterator] = background
layers[currentLayer][iterator + 1] = foreground
layers[currentLayer][iterator + 2] = alpha
layers[currentLayer][iterator + 3] = symbol
end
local function swapColors()
local tempColor = currentForeground
currentForeground = currentBackground
currentBackground = tempColor
tempColor = nil
drawColors()
console("Цвета поменяны местами.")
end
local function inputText(x, y, limit)
local oldPixels = ecs.rememberOldPixels(x,y-1,x+limit-1,y+1)
local text = ""
local inputPos = 1
local function drawThisShit()
for i=1,inputPos do
ecs.invertedText(x + i - 1, y + 1, "")
ecs.adaptiveText(x + i - 1, y - 1, " ", currentBackground)
end
ecs.invertedText(x + inputPos - 1, y + 1, "")--"▲","▼"
ecs.invertedText(x + inputPos - 1, y - 1, "")
ecs.adaptiveText(x, y, ecs.stringLimit("start", text, limit, false), currentForeground)
end
drawThisShit()
while true do
local e = {event.pull()}
if e[1] == "key_down" then
if e[4] == 14 then
if unicode.len(text) >= 1 then
text = unicode.sub(text, 1, -2)
if unicode.len(text) < (limit - 1) then
inputPos = inputPos - 1
end
ecs.drawOldPixels(oldPixels)
drawThisShit()
end
elseif e[4] == 28 then
break
else
local symbol = ecs.convertCodeToSymbol(e[3])
if symbol ~= nil then
text = text .. symbol
if unicode.len(text) < limit then
inputPos = inputPos + 1
end
drawThisShit()
end
end
elseif e[1] == "clipboard" then
if e[3] then
text = text .. e[3]
if unicode.len(text) < limit then
inputPos = inputPos + unicode.len(e[3])
end
drawThisShit()
end
end
end
ecs.drawOldPixels(oldPixels)
if text == "" then text = " " end
return text
end
local function saveTextToPixels(x, y, text)
local sText = unicode.len(text)
local iterator
x = x - 1
for i = 1, sText do
if x + i > sizes.widthOfImage then break end
iterator = convertCoordsToIterator(x + i, y)
setPixel(iterator, layers[currentLayer][iterator], currentForeground, currentAlpha, unicode.sub(text, i, i))
end
end
local function newLayer(name)
name = name or "Новый слой"
table.insert(layers, currentLayer, {["name"] = name, show = true})
end
------------------------------------------------ Старт программы --------------------------------------------------------------
--Создаем пустой мастерпиксельс
createEmptyMasterPixels()
--Рисуем весь интерфейс
drawAll()
while true do
local e = {event.pull()}
if e[1] == "touch" or e[1] == "drag" then
--Левый клик
if e[5] == 0 then
--Если кликнули на рисовабельную зонку
if ecs.clickedAtArea(e[3], e[4], sizes.xStartOfImage, sizes.yStartOfImage, sizes.xEndOfImage, sizes.yEndOfImage) then
local x, y = e[3] - sizes.xStartOfImage + 1, e[4] - sizes.yStartOfImage + 1
local iterator = convertCoordsToIterator(x, y)
--Кисть
if currentInstrument == 3 then
--Если нажата клавиша альт
if keyboard.isKeyDown(56) then
local _, _, background = gpu.get(e[3], e[4])
currentBackground = background
drawColors()
else
if gpu.getBackground() ~= currentBackground then gpu.setBackground(currentBackground) end
if gpu.getForeground() ~= currentForeground then gpu.setForeground(currentForeground) end
local x, y = e[3] - sizes.xStartOfImage + 1, e[4] - sizes.yStartOfImage + 1
local iterator = convertCoordsToIterator(x, y)
gpu.set(e[3], e[4], currentSymbol)
setPixel(iterator, currentBackground, currentForeground, currentAlpha, currentSymbol)
console("Кисть: клик на точку "..e[3].."x"..e[4]..", координаты в изображении: "..x.."x"..y..", индекс массива изображения: "..iterator)
end
--Ластик
elseif currentInstrument == 4 then
drawTransparentPixel(e[3], e[4], x, y)
setPixel(iterator, 0x000000, 0x000000, 0xFF, " ")
console("Ластик: клик на точку "..e[3].."x"..e[4]..", координаты в изображении: "..x.."x"..y..", индекс массива изображения: "..iterator)
--Текст
elseif currentInstrument == 5 then
local limit = sizes.widthOfImage - x + 1
local text = inputText(e[3], e[4], limit)
saveTextToPixels(x, y, text)
mergeAllLayersToMasterPixels()
drawImage()
end
iterator, x, y = nil, nil, nil
end
for key in pairs(obj["Colors"]) do
if ecs.clickedAtArea(e[3], e[4], obj["Colors"][key][1], obj["Colors"][key][2], obj["Colors"][key][3], obj["Colors"][key][4]) then
if key == 1 then
currentBackground = palette.draw("auto", "auto", currentBackground) or currentBackground
drawColors()
elseif key == 2 or key == 3 then
currentForeground = palette.draw("auto", "auto", currentForeground) or currentForeground
drawColors()
elseif key == 4 then
ecs.colorTextWithBack(obj["Colors"][key][1], obj["Colors"][key][2], 0xFF0000, colors.toolbar, "←→")
os.sleep(0.2)
swapColors()
end
break
end
end
for key in pairs(obj["Instruments"]) do
if ecs.clickedAtArea(e[3], e[4], obj["Instruments"][key][1], obj["Instruments"][key][2], obj["Instruments"][key][3], obj["Instruments"][key][4]) then
currentInstrument = key
drawInstruments()
break
end
end
for key in pairs(obj["Layers"]) do
if ecs.clickedAtArea(e[3], e[4], obj["Layers"][key][1], obj["Layers"][key][2], obj["Layers"][key][3], obj["Layers"][key][4]) then
if ecs.clickedAtArea(e[3], e[4], obj["Layers"][key][1] + 1, obj["Layers"][key][2] + 1, obj["Layers"][key][1] + 2, obj["Layers"][key][4] + 1) then
layers[key].show = not layers[key].show
end
currentLayer = key
drawLayers()
break
end
end
else
ecs.universalWindow(e[3], e[4], 30, 0xeeeeee, true, {"EmptyLine"}, {"CenterText", 0x880000, "Параметры кисти"}, {"Slider", 0x262626, 0x880000, 1, 10, currentBrushSize, "Размер: ", " px"}, {"Slider", 0x262626, 0x880000, 1, 100, 50, "Прозрачность: ", "%"}, {"EmptyLine"}, {"Button", {0xbbbbbb, 0xffffff, "OK"}})
end
elseif e[1] == "key_down" then
--Стрелки
if e[4] == 200 then
move("up")
elseif e[4] == 208 then
move("down")
elseif e[4] == 203 then
move("left")
elseif e[4] == 205 then
move("right")
--Пробел
elseif e[4] == 57 then
drawAll()
--X
elseif e[4] == 45 then
swapColors()
--N
elseif e[4] == 49 then
newLayer()
drawLayers()
elseif e[4] == 32 then
currentBackground = 0x000000
currentForeground = 0xFFFFFF
currentAlpha = 0x00
drawColors()
--1
elseif e[4] == 2 or e[4] == 3 or e[4] == 4 or e[4] == 5 or e[4] == 6 then
currentInstrument = e[4] - 1
drawInstruments()
end
elseif e[1] == "scroll" then
if ecs.clickedAtArea(e[3], e[4], sizes.xStartOfRightBar, sizes.yStartOfLayers, sizes.xSize, sizes.ySize - 1) then
if e[5] == 1 then
if drawLayersFrom > 1 then drawLayersFrom = drawLayersFrom - 1; drawLayers() end
else
if drawLayersFrom < #layers then drawLayersFrom = drawLayersFrom + 1; drawLayers() end
end
end
end
end
------------------------------------------------ Выход из программы --------------------------------------------------------------