diff --git a/Applications/3DPrint/Icon.pic b/Applications/3DPrint/Icon.pic index c0b3f633..22799bf3 100644 Binary files a/Applications/3DPrint/Icon.pic and b/Applications/3DPrint/Icon.pic differ diff --git a/Applications/Autorun/Icon.pic b/Applications/Autorun/Icon.pic index 0ed8eecb..f6c70b65 100644 Binary files a/Applications/Autorun/Icon.pic and b/Applications/Autorun/Icon.pic differ diff --git a/Applications/BufferDemo/Icon.pic b/Applications/BufferDemo/Icon.pic index 588f8928..07ea8497 100644 Binary files a/Applications/BufferDemo/Icon.pic and b/Applications/BufferDemo/Icon.pic differ diff --git a/Applications/BufferDemo/Wallpaper.pic b/Applications/BufferDemo/Wallpaper.pic index 4281c129..8ee5a9e3 100644 Binary files a/Applications/BufferDemo/Wallpaper.pic and b/Applications/BufferDemo/Wallpaper.pic differ diff --git a/Applications/Calc/Icon.pic b/Applications/Calc/Icon.pic index b30b0071..6d111b74 100644 Binary files a/Applications/Calc/Icon.pic and b/Applications/Calc/Icon.pic differ diff --git a/Applications/Calendar/Icon.pic b/Applications/Calendar/Icon.pic index 3083a6c5..3dda989b 100644 Binary files a/Applications/Calendar/Icon.pic and b/Applications/Calendar/Icon.pic differ diff --git a/Applications/Camera/Icon.pic b/Applications/Camera/Icon.pic index 3b67846a..1b681dc4 100644 Binary files a/Applications/Camera/Icon.pic and b/Applications/Camera/Icon.pic differ diff --git a/Applications/Chat/Icon.pic b/Applications/Chat/Icon.pic index 7ae24b6e..3ddcac13 100644 Binary files a/Applications/Chat/Icon.pic and b/Applications/Chat/Icon.pic differ diff --git a/Applications/Chat/MyAvatar.pic b/Applications/Chat/MyAvatar.pic index 88248898..b2187072 100644 Binary files a/Applications/Chat/MyAvatar.pic and b/Applications/Chat/MyAvatar.pic differ diff --git a/Applications/ChristmasTree/Icon.pic b/Applications/ChristmasTree/Icon.pic index dac933d0..62f17419 100644 Binary files a/Applications/ChristmasTree/Icon.pic and b/Applications/ChristmasTree/Icon.pic differ diff --git a/Applications/CodeDoor/Icon.pic b/Applications/CodeDoor/Icon.pic index 5ac0f9d7..9cb31339 100644 Binary files a/Applications/CodeDoor/Icon.pic and b/Applications/CodeDoor/Icon.pic differ diff --git a/Applications/Control/Icon.pic b/Applications/Control/Icon.pic index 57fa9b83..b8239cee 100644 Binary files a/Applications/Control/Icon.pic and b/Applications/Control/Icon.pic differ diff --git a/Applications/Crossword/Icon.pic b/Applications/Crossword/Icon.pic index 968ed2d8..c2900dd9 100644 Binary files a/Applications/Crossword/Icon.pic and b/Applications/Crossword/Icon.pic differ diff --git a/Applications/DanceFloor/Icon.pic b/Applications/DanceFloor/Icon.pic index 7a37add8..089d190c 100644 Binary files a/Applications/DanceFloor/Icon.pic and b/Applications/DanceFloor/Icon.pic differ diff --git a/Applications/Finder/Icon.pic b/Applications/Finder/Icon.pic index b83363fc..fe7b106c 100644 Binary files a/Applications/Finder/Icon.pic and b/Applications/Finder/Icon.pic differ diff --git a/Applications/FlappyBlock/Icon.pic b/Applications/FlappyBlock/Icon.pic index 1062723b..df34727e 100644 Binary files a/Applications/FlappyBlock/Icon.pic and b/Applications/FlappyBlock/Icon.pic differ diff --git a/Applications/ForceAdmin/Icon.pic b/Applications/ForceAdmin/Icon.pic index b46fdaf2..0a1efaad 100644 Binary files a/Applications/ForceAdmin/Icon.pic and b/Applications/ForceAdmin/Icon.pic differ diff --git a/Applications/FuckTheRain/Icon.pic b/Applications/FuckTheRain/Icon.pic index 4b66581c..c2297554 100644 Binary files a/Applications/FuckTheRain/Icon.pic and b/Applications/FuckTheRain/Icon.pic differ diff --git a/Applications/Geoscan/Icon.pic b/Applications/Geoscan/Icon.pic index 93c06947..20c99931 100644 Binary files a/Applications/Geoscan/Icon.pic and b/Applications/Geoscan/Icon.pic differ diff --git a/Applications/GuessWord/Icon.pic b/Applications/GuessWord/Icon.pic index 8c550a88..63f7b86d 100644 Binary files a/Applications/GuessWord/Icon.pic and b/Applications/GuessWord/Icon.pic differ diff --git a/Applications/HEX/Icon.pic b/Applications/HEX/Icon.pic index 21115289..6f0095a2 100644 Binary files a/Applications/HEX/Icon.pic and b/Applications/HEX/Icon.pic differ diff --git a/Applications/Highlight/Icon.pic b/Applications/Highlight/Icon.pic index 7e5c69d1..c5e3a622 100644 Binary files a/Applications/Highlight/Icon.pic and b/Applications/Highlight/Icon.pic differ diff --git a/Applications/HoloClock/Icon.pic b/Applications/HoloClock/Icon.pic index 64753653..1ad1b671 100644 Binary files a/Applications/HoloClock/Icon.pic and b/Applications/HoloClock/Icon.pic differ diff --git a/Applications/HoloEdit/Icon.pic b/Applications/HoloEdit/Icon.pic index 20bbfcb1..cdfeef8e 100644 Binary files a/Applications/HoloEdit/Icon.pic and b/Applications/HoloEdit/Icon.pic differ diff --git a/Applications/InfoPanel/Icon.pic b/Applications/InfoPanel/Icon.pic index da2acf0d..258d8684 100644 Binary files a/Applications/InfoPanel/Icon.pic and b/Applications/InfoPanel/Icon.pic differ diff --git a/Applications/Keyboard/Icon.pic b/Applications/Keyboard/Icon.pic index 2940533d..15c1fff9 100644 Binary files a/Applications/Keyboard/Icon.pic and b/Applications/Keyboard/Icon.pic differ diff --git a/Applications/Matrix/Icon.pic b/Applications/Matrix/Icon.pic index a90998f0..e504b54c 100644 Binary files a/Applications/Matrix/Icon.pic and b/Applications/Matrix/Icon.pic differ diff --git a/Applications/MineSweeper/Icon.pic b/Applications/MineSweeper/Icon.pic index fced71eb..732c3185 100644 Binary files a/Applications/MineSweeper/Icon.pic and b/Applications/MineSweeper/Icon.pic differ diff --git a/Applications/Nano/Icon.pic b/Applications/Nano/Icon.pic index 21c55e72..c93426f3 100644 Binary files a/Applications/Nano/Icon.pic and b/Applications/Nano/Icon.pic differ diff --git a/Applications/Pastebin/Icon.pic b/Applications/Pastebin/Icon.pic index 4cc5a277..3fbd2647 100644 Binary files a/Applications/Pastebin/Icon.pic and b/Applications/Pastebin/Icon.pic differ diff --git a/Applications/Photoshop/Icon.pic b/Applications/Photoshop/Icon.pic index 317b1adc..19d002bf 100644 Binary files a/Applications/Photoshop/Icon.pic and b/Applications/Photoshop/Icon.pic differ diff --git a/Applications/Photoshop/Photoshop.lua b/Applications/Photoshop/Photoshop.lua index 581cd05f..073977dc 100644 --- a/Applications/Photoshop/Photoshop.lua +++ b/Applications/Photoshop/Photoshop.lua @@ -724,21 +724,19 @@ while true do new() elseif action == "Сохранить как" then - local data = ecs.universalWindow("auto", "auto", 30, ecs.windowColors.background, true, {"EmptyLine"}, {"CenterText", 0x262626, "Сохранить как"}, {"EmptyLine"}, {"Input", 0x262626, 0x880000, "Путь"}, {"Selector", 0x262626, 0x880000, "OCIF3", "OCIF2", "OCIF1", "RAW"}, {"CenterText", 0x262626, "Рекомендуется использовать"}, {"CenterText", 0x262626, "метод кодирования OCIF3"}, {"EmptyLine"}, {"Button", {0x888888, 0xffffff, "OK"}, {0xaaaaaa, 0xffffff, "Отмена"}}) + local data = ecs.universalWindow("auto", "auto", 30, ecs.windowColors.background, true, {"EmptyLine"}, {"CenterText", 0x262626, "Сохранить как"}, {"EmptyLine"}, {"Input", 0x262626, 0x880000, "Путь"}, {"Selector", 0x262626, 0x880000, "OCIF4", "OCIF1", "RAW"}, {"CenterText", 0x262626, "Рекомендуется использовать"}, {"CenterText", 0x262626, "метод кодирования OCIF4"}, {"EmptyLine"}, {"Button", {0x888888, 0xffffff, "OK"}, {0xaaaaaa, 0xffffff, "Отмена"}}) if data[3] == "OK" then data[1] = data[1] or "Untitled" - data[2] = data[2] or "OCIF3" + data[2] = data[2] or "OCIF4" if data[2] == "RAW" then data[2] = 0 elseif data[2] == "OCIF1" then data[2] = 1 - elseif data[2] == "OCIF1" then - data[2] = 2 - elseif data[2] == "OCIF1" then - data[2] = 3 + elseif data[2] == "OCIF4" then + data[2] = 4 else - data[2] = 3 + data[2] = 4 end local filename = data[1] .. ".pic" diff --git a/Applications/Piano/Icon.pic b/Applications/Piano/Icon.pic index b4281f48..cef5c6d7 100644 Binary files a/Applications/Piano/Icon.pic and b/Applications/Piano/Icon.pic differ diff --git a/Applications/QuantumCube/Icon.pic b/Applications/QuantumCube/Icon.pic index 07de54f6..d9d4b85f 100644 Binary files a/Applications/QuantumCube/Icon.pic and b/Applications/QuantumCube/Icon.pic differ diff --git a/Applications/Radio/Icon.pic b/Applications/Radio/Icon.pic index 5beb682d..ee54526b 100644 Binary files a/Applications/Radio/Icon.pic and b/Applications/Radio/Icon.pic differ diff --git a/Applications/RunningString/Icon.pic b/Applications/RunningString/Icon.pic index 46b7284f..5e6c8c71 100644 Binary files a/Applications/RunningString/Icon.pic and b/Applications/RunningString/Icon.pic differ diff --git a/Applications/Shooting/Icon.pic b/Applications/Shooting/Icon.pic index 7d821065..9ecfd340 100644 Binary files a/Applications/Shooting/Icon.pic and b/Applications/Shooting/Icon.pic differ diff --git a/Applications/Shop/Icon.pic b/Applications/Shop/Icon.pic index bbb2ba7b..8b4708e3 100644 Binary files a/Applications/Shop/Icon.pic and b/Applications/Shop/Icon.pic differ diff --git a/Applications/Snake/Icon.pic b/Applications/Snake/Icon.pic index 2d024a54..792a89ae 100644 Binary files a/Applications/Snake/Icon.pic and b/Applications/Snake/Icon.pic differ diff --git a/MineOS/Icons/3DModel.pic b/MineOS/Icons/3DModel.pic index 3efc9db7..b8175a10 100644 Binary files a/MineOS/Icons/3DModel.pic and b/MineOS/Icons/3DModel.pic differ diff --git a/MineOS/Icons/Archive.pic b/MineOS/Icons/Archive.pic index 515e356e..6ef24be0 100644 Binary files a/MineOS/Icons/Archive.pic and b/MineOS/Icons/Archive.pic differ diff --git a/MineOS/Icons/Computer.pic b/MineOS/Icons/Computer.pic index ac88051e..4e9fec95 100644 Binary files a/MineOS/Icons/Computer.pic and b/MineOS/Icons/Computer.pic differ diff --git a/MineOS/Icons/Config.pic b/MineOS/Icons/Config.pic index 88d4edc7..52537f16 100644 Binary files a/MineOS/Icons/Config.pic and b/MineOS/Icons/Config.pic differ diff --git a/MineOS/Icons/Downloading.pic b/MineOS/Icons/Downloading.pic index c72d9c50..471cdf77 100644 Binary files a/MineOS/Icons/Downloading.pic and b/MineOS/Icons/Downloading.pic differ diff --git a/MineOS/Icons/FileNotExists.pic b/MineOS/Icons/FileNotExists.pic index 93dd3591..e021276a 100644 Binary files a/MineOS/Icons/FileNotExists.pic and b/MineOS/Icons/FileNotExists.pic differ diff --git a/MineOS/Icons/Finger.pic b/MineOS/Icons/Finger.pic index 151c9e61..d5ae6129 100644 Binary files a/MineOS/Icons/Finger.pic and b/MineOS/Icons/Finger.pic differ diff --git a/MineOS/Icons/Floppy.pic b/MineOS/Icons/Floppy.pic index 582d7f30..2d73cb49 100644 Binary files a/MineOS/Icons/Floppy.pic and b/MineOS/Icons/Floppy.pic differ diff --git a/MineOS/Icons/Folder.pic b/MineOS/Icons/Folder.pic index efc8e26c..a99c78c1 100644 Binary files a/MineOS/Icons/Folder.pic and b/MineOS/Icons/Folder.pic differ diff --git a/MineOS/Icons/HDD.pic b/MineOS/Icons/HDD.pic index 85aafb00..a42f0fea 100644 Binary files a/MineOS/Icons/HDD.pic and b/MineOS/Icons/HDD.pic differ diff --git a/MineOS/Icons/Image.pic b/MineOS/Icons/Image.pic index b4bbdc89..b7eca799 100644 Binary files a/MineOS/Icons/Image.pic and b/MineOS/Icons/Image.pic differ diff --git a/MineOS/Icons/Languages.pic b/MineOS/Icons/Languages.pic index 84923e73..9db56e75 100644 Binary files a/MineOS/Icons/Languages.pic and b/MineOS/Icons/Languages.pic differ diff --git a/MineOS/Icons/Love.pic b/MineOS/Icons/Love.pic index 624dea84..6429fea8 100644 Binary files a/MineOS/Icons/Love.pic and b/MineOS/Icons/Love.pic differ diff --git a/MineOS/Icons/Lua.pic b/MineOS/Icons/Lua.pic index d402bfff..d435166c 100644 Binary files a/MineOS/Icons/Lua.pic and b/MineOS/Icons/Lua.pic differ diff --git a/MineOS/Icons/OK.pic b/MineOS/Icons/OK.pic index 14e51a67..669be952 100644 Binary files a/MineOS/Icons/OK.pic and b/MineOS/Icons/OK.pic differ diff --git a/MineOS/Icons/OS_Logo.pic b/MineOS/Icons/OS_Logo.pic index 99169bef..894d2283 100644 Binary files a/MineOS/Icons/OS_Logo.pic and b/MineOS/Icons/OS_Logo.pic differ diff --git a/MineOS/Icons/Pastebin.pic b/MineOS/Icons/Pastebin.pic index 38789dae..709eb08b 100644 Binary files a/MineOS/Icons/Pastebin.pic and b/MineOS/Icons/Pastebin.pic differ diff --git a/MineOS/Icons/RawImage.pic b/MineOS/Icons/RawImage.pic index 4725f4f4..e3fbeaa4 100644 Binary files a/MineOS/Icons/RawImage.pic and b/MineOS/Icons/RawImage.pic differ diff --git a/MineOS/Icons/Robot.pic b/MineOS/Icons/Robot.pic index a6d853e3..f4175286 100644 Binary files a/MineOS/Icons/Robot.pic and b/MineOS/Icons/Robot.pic differ diff --git a/MineOS/Icons/SampleIcon.pic b/MineOS/Icons/SampleIcon.pic index 552be471..e1aee29b 100644 Binary files a/MineOS/Icons/SampleIcon.pic and b/MineOS/Icons/SampleIcon.pic differ diff --git a/MineOS/Icons/Script.pic b/MineOS/Icons/Script.pic index 404c5ebf..b7a4156f 100644 Binary files a/MineOS/Icons/Script.pic and b/MineOS/Icons/Script.pic differ diff --git a/MineOS/Icons/Security.pic b/MineOS/Icons/Security.pic index 9f377527..d1b4722c 100644 Binary files a/MineOS/Icons/Security.pic and b/MineOS/Icons/Security.pic differ diff --git a/MineOS/Icons/Steve.pic b/MineOS/Icons/Steve.pic index 0f37db3c..72d28dd3 100644 Binary files a/MineOS/Icons/Steve.pic and b/MineOS/Icons/Steve.pic differ diff --git a/MineOS/Icons/Tablet.pic b/MineOS/Icons/Tablet.pic index c8d56016..ef53dee0 100644 Binary files a/MineOS/Icons/Tablet.pic and b/MineOS/Icons/Tablet.pic differ diff --git a/MineOS/Icons/Text.pic b/MineOS/Icons/Text.pic index b76d59e8..493c3052 100644 Binary files a/MineOS/Icons/Text.pic and b/MineOS/Icons/Text.pic differ diff --git a/MineOS/Icons/Update.pic b/MineOS/Icons/Update.pic index 997b463e..9f797d95 100644 Binary files a/MineOS/Icons/Update.pic and b/MineOS/Icons/Update.pic differ diff --git a/MineOS/Wallpapers/AhsokaTano.pic b/MineOS/Wallpapers/AhsokaTano.pic index e70019e9..293f0c22 100644 Binary files a/MineOS/Wallpapers/AhsokaTano.pic and b/MineOS/Wallpapers/AhsokaTano.pic differ diff --git a/MineOS/Wallpapers/ChristmasTree.pic b/MineOS/Wallpapers/ChristmasTree.pic index 61df17c8..f0649507 100644 Binary files a/MineOS/Wallpapers/ChristmasTree.pic and b/MineOS/Wallpapers/ChristmasTree.pic differ diff --git a/MineOS/Wallpapers/Ciri.pic b/MineOS/Wallpapers/Ciri.pic index 810013da..a7c94057 100644 Binary files a/MineOS/Wallpapers/Ciri.pic and b/MineOS/Wallpapers/Ciri.pic differ diff --git a/MineOS/Wallpapers/Girl.pic b/MineOS/Wallpapers/Girl.pic index 70a41bf4..d5dfabcb 100644 Binary files a/MineOS/Wallpapers/Girl.pic and b/MineOS/Wallpapers/Girl.pic differ diff --git a/MineOS/Wallpapers/GrammarNazi.pic b/MineOS/Wallpapers/GrammarNazi.pic index 88f9ff0e..1de9f2da 100644 Binary files a/MineOS/Wallpapers/GrammarNazi.pic and b/MineOS/Wallpapers/GrammarNazi.pic differ diff --git a/MineOS/Wallpapers/Invoker.pic b/MineOS/Wallpapers/Invoker.pic index 7e7b3571..18556fdd 100644 Binary files a/MineOS/Wallpapers/Invoker.pic and b/MineOS/Wallpapers/Invoker.pic differ diff --git a/MineOS/Wallpapers/Jodie.pic b/MineOS/Wallpapers/Jodie.pic index 533368a6..bf89b8d2 100644 Binary files a/MineOS/Wallpapers/Jodie.pic and b/MineOS/Wallpapers/Jodie.pic differ diff --git a/MineOS/Wallpapers/Liara.pic b/MineOS/Wallpapers/Liara.pic index 00fcd9d5..afc5bc4b 100644 Binary files a/MineOS/Wallpapers/Liara.pic and b/MineOS/Wallpapers/Liara.pic differ diff --git a/MineOS/Wallpapers/Lina.pic b/MineOS/Wallpapers/Lina.pic index c91f2c33..030bdfab 100644 Binary files a/MineOS/Wallpapers/Lina.pic and b/MineOS/Wallpapers/Lina.pic differ diff --git a/MineOS/Wallpapers/Luna.pic b/MineOS/Wallpapers/Luna.pic index d3cb9fd1..a200c838 100644 Binary files a/MineOS/Wallpapers/Luna.pic and b/MineOS/Wallpapers/Luna.pic differ diff --git a/MineOS/Wallpapers/StarWars.pic b/MineOS/Wallpapers/StarWars.pic index a1293688..d1f183d8 100644 Binary files a/MineOS/Wallpapers/StarWars.pic and b/MineOS/Wallpapers/StarWars.pic differ diff --git a/MineOS/Wallpapers/TemplarAssassin.pic b/MineOS/Wallpapers/TemplarAssassin.pic index ff085fea..a87dfddd 100644 Binary files a/MineOS/Wallpapers/TemplarAssassin.pic and b/MineOS/Wallpapers/TemplarAssassin.pic differ diff --git a/MineOS/Wallpapers/Test.png b/MineOS/Wallpapers/Test.png deleted file mode 100644 index e692ad64..00000000 Binary files a/MineOS/Wallpapers/Test.png and /dev/null differ diff --git a/lib/image.lua b/lib/image.lua index 8b55a01a..1b0829ea 100644 --- a/lib/image.lua +++ b/lib/image.lua @@ -436,13 +436,20 @@ local function saveOCIF2(file, picture, compressColors) else file:write(convertBytesToString(extractBytesFromNumber(background, 3))) end - - --Записываем координаты - for i = 1, #grouppedPucture[alpha][symbol][foreground][background], 2 do + + --Перебираем координаты + for y in pairs(grouppedPucture[alpha][symbol][foreground][background]) do + --Записываем заголовок координат, размер массива y и само значение y file:write( - string.char(grouppedPucture[alpha][symbol][foreground][background][i]), - string.char(grouppedPucture[alpha][symbol][foreground][background][i + 1]) + "Y", + string.char(getArraySize(grouppedPucture[alpha][symbol][foreground][background][y])), + string.char(y) ) + --Записываем ИКСЫЫЫ + --Ы + for i = 1, #grouppedPucture[alpha][symbol][foreground][background][y] do + file:write(string.char(grouppedPucture[alpha][symbol][foreground][background][y][i])) + end end end end @@ -452,7 +459,7 @@ local function saveOCIF2(file, picture, compressColors) file:close() end -local function loadOCIF2(file, decompressColors) +local function loadOCIF2(file, decompressColors, useOCIF4) local picture = {} --Читаем размер изображения @@ -461,7 +468,7 @@ local function loadOCIF2(file, decompressColors) picture.width = readedWidth picture.height = readedHeight - local header, alpha, symbol, foreground, background, alphaSize, symbolSize, foregroundSize, backgroundSize = "" + local header, alpha, symbol, foreground, background, y, alphaSize, symbolSize, foregroundSize, backgroundSize, ySize = "" while true do header = file:read(1) if not header then break end @@ -507,10 +514,31 @@ local function loadOCIF2(file, decompressColors) -- print("Размер массива координат: " .. backgroundSize) -- print("Цвет фона: " .. background) - --Читаем координаты - for i = 1, backgroundSize, 2 do + --Поддержка загрузки формата OCIF3 + if not useOCIF4 then + --Читаем координаты + for i = 1, backgroundSize, 2 do + local x = string.byte(file:read(1)) + local y = string.byte(file:read(1)) + local index = convertCoordsToIndex(x, y, readedWidth) + -- print("Координата: " .. x .. "x" .. y .. ", индекс: "..index) + + picture[index] = background + picture[index + 1] = foreground + picture[index + 2] = alpha + picture[index + 3] = symbol + end + end + + --Новый формат OCIF4 + elseif header == "Y" and useOCIF4 then + ySize = string.byte(file:read(1)) + y = string.byte(file:read(1)) + -- print("Размер массива Y: " .. ySize) + -- print("Текущий Y: " .. y) + + for i = 1, ySize do local x = string.byte(file:read(1)) - local y = string.byte(file:read(1)) local index = convertCoordsToIndex(x, y, readedWidth) -- print("Координата: " .. x .. "x" .. y .. ", индекс: "..index) @@ -518,9 +546,9 @@ local function loadOCIF2(file, decompressColors) picture[index + 1] = foreground picture[index + 2] = alpha picture[index + 3] = symbol - end + end else - error("Ошибка чтения формата OCIF: неизвестный тип заголовка (" .. header .. ")") + error("Error while reading OCIF format: unknown Header type (" .. header .. ")") end end @@ -637,9 +665,9 @@ function image.convertToGroupedImage(picture) optimizedPicture[alpha][symbol] = optimizedPicture[alpha][symbol] or {} optimizedPicture[alpha][symbol][foreground] = optimizedPicture[alpha][symbol][foreground] or {} optimizedPicture[alpha][symbol][foreground][background] = optimizedPicture[alpha][symbol][foreground][background] or {} + optimizedPicture[alpha][symbol][foreground][background][yPos] = optimizedPicture[alpha][symbol][foreground][background][yPos] or {} - table.insert(optimizedPicture[alpha][symbol][foreground][background], xPos) - table.insert(optimizedPicture[alpha][symbol][foreground][background], yPos) + table.insert(optimizedPicture[alpha][symbol][foreground][background][yPos], xPos) --Если xPos достигает width изображения, то сбросить на 1, иначе xPos++ xPos = (xPos == picture.width) and 1 or xPos + 1 --Если xPos равняется 1, то yPos++, а если нет, то похуй @@ -939,7 +967,7 @@ end --Сохранить изображение любого поддерживаемого формата function image.save(path, picture, encodingMethod) - encodingMethod = encodingMethod or 3 + encodingMethod = encodingMethod or 4 --Создать папку под файл, если ее нет fs.makeDirectory(fs.path(path)) --Получаем формат указанного файла @@ -962,6 +990,8 @@ function image.save(path, picture, encodingMethod) file:write(string.char(encodingMethod)) saveOCIF2(file, picture) elseif encodingMethod == 3 or string.lower(encodingMethod) == "ocif3" then + error("Encoding method 3 is deprecated and no longer supported. Use method 4 instead of it.") + elseif encodingMethod == 4 or string.lower(encodingMethod) == "ocif4" then file:write(string.char(encodingMethod)) picture = convertImageColorsTo8Bit(picture) saveOCIF2(file, picture, true) @@ -999,15 +1029,17 @@ function image.load(path) return loadOCIF2(file) elseif encodingMethod == 3 then return loadOCIF2(file, true) + elseif encodingMethod == 4 then + return loadOCIF2(file, true, true) else file:close() - error("Unsupported encoding method.\n") + error("Unsupported encoding method: " .. encodingMethod .. "\n") end --Поддержка ПНГ-формата elseif fileFormat == constants.pngFileFormat then return image.loadPng(path) else - error("Unsupported file format.\n") + error("Unsupported file format: " .. fileFormat .. "\n") end end @@ -1026,26 +1058,29 @@ function image.draw(x, y, picture) for background in pairs(picture[alpha][symbol][foreground]) do if gpu.getBackground ~= background then gpu.setBackground(background) end currentBackground = background - for i = 1, #picture[alpha][symbol][foreground][background], 2 do - xPos, yPos = x + picture[alpha][symbol][foreground][background][i], y + picture[alpha][symbol][foreground][background][i + 1] - - --Если альфа имеется, но она не совсем прозрачна - if (alpha > 0x00 and alpha < 0xFF) or (alpha == 0xFF and symbol ~= " ")then - _, _, currentBackground = gpu.get(xPos, yPos) - currentBackground = colorlib.alphaBlend(currentBackground, background, alpha) - gpu.setBackground(currentBackground) - gpu.set(xPos, yPos, symbol) - - elseif alpha == 0x00 then - if currentBackground ~= background then - currentBackground = background + for yArray in pairs(picture[alpha][symbol][foreground][background]) do + for xArray = 1, #picture[alpha][symbol][foreground][background][yArray] do + xPos, yPos = x + picture[alpha][symbol][foreground][background][yArray][xArray], y + yArray + + --Если альфа имеется, но она не совсем прозрачна + if (alpha > 0x00 and alpha < 0xFF) or (alpha == 0xFF and symbol ~= " ")then + _, _, currentBackground = gpu.get(xPos, yPos) + currentBackground = colorlib.alphaBlend(currentBackground, background, alpha) gpu.setBackground(currentBackground) - end - gpu.set(xPos, yPos, symbol) + gpu.set(xPos, yPos, symbol) + + elseif alpha == 0x00 then + if currentBackground ~= background then + currentBackground = background + gpu.setBackground(currentBackground) + end + + gpu.set(xPos, yPos, symbol) + end + --ecs.wait() end - --ecs.wait() end end end @@ -1056,33 +1091,29 @@ end local function createSaveAndLoadFiles() ecs.prepareToExit() ecs.error("Создаю/загружаю изображение") - local cyka = image.load("MineOS/System/OS/Icons/Love.pic") - --local cyka = image.createImage(4, 4) + -- local cyka = image.load("MineOS/System/OS/Icons/Love.pic") + local cyka = image.createImage(4, 4) ecs.error("Рисую загруженное изображение") image.draw(2, 2, cyka) ecs.error("Сохраняю его в 4 форматах") image.save("0.pic", cyka, 0) image.save("1.pic", cyka, 1) - image.save("2.pic", cyka, 2) - image.save("3.pic", cyka, 3) + image.save("4.pic", cyka, 4) ecs.prepareToExit() ecs.error("Загружаю все 4 формата и рисую их") local cyka0 = image.load("0.pic") image.draw(2, 2, cyka0) local cyka1 = image.load("1.pic") image.draw(10, 2, cyka1) - local cyka2 = image.load("2.pic") - image.draw(18, 2, cyka2) - local cyka3 = image.load("3.pic") - image.draw(26, 2, cyka3) - ecs.error("Рисую все 3 формата") + local cyka4 = image.load("4.pic") + image.draw(34, 2, cyka4) end ------------------------------------------ Место для баловства ------------------------------------------------ -- ecs.prepareToExit() --- local cyka = image.load("MineOS/Applications/Piano.app/Resources/Icon.pic") +-- local cyka = image.load("3.pic") -- image.draw(2, 2, cyka) -- ecs.error(HEXtoSTRING(cyka[1], 6, true)) -- image.draw(8, 2, cyka)