From 42d15dd4b4ebcea016ec9bf07d24caa559974474 Mon Sep 17 00:00:00 2001 From: Igor Timofeev Date: Sat, 22 Apr 2017 01:40:33 +0300 Subject: [PATCH] =?UTF-8?q?=D0=90=20=D0=B2=D0=BE=D1=82=20=D0=B8=20=D0=BF?= =?UTF-8?q?=D0=B5=D1=80=D0=B2=D0=BE=D0=B5=20=D0=B4=D0=B5=D1=80=D1=8C=D0=BC?= =?UTF-8?q?=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Applications.txt | 7 +++++++ lib/image.lua | 25 ++++++++++++++++++------- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/Applications.txt b/Applications.txt index 6048da5b..1f316239 100644 --- a/Applications.txt +++ b/Applications.txt @@ -290,6 +290,13 @@ preLoadFile=true, version=1.05, }, + { + name="lib/ImageFormatModules/OCIF.lua", + url="IgorTimofeev/OpenComputers/master/lib/ImageFormatModules/OCIF.lua", + type="Library", + preLoadFile=true, + version=1.00, + }, { name="lib/image.lua", url="IgorTimofeev/OpenComputers/master/lib/image.lua", diff --git a/lib/image.lua b/lib/image.lua index 18805491..bbf7d8b7 100755 --- a/lib/image.lua +++ b/lib/image.lua @@ -66,7 +66,16 @@ function image.draw(x, y, picture) gpu.setForeground(foreground) for yPos in pairs(groupedPicture[alpha][symbol][background][foreground]) do for xPos = 1, #groupedPicture[alpha][symbol][background][foreground][yPos] do - gpu.set(x + groupedPicture[alpha][symbol][background][foreground][yPos][xPos] - 1, y + yPos - 1, symbol) + if alpha > 0x0 then + local oldBackground = background + local _, _, gpuGetBackground = gpu.get(x, y) + + gpu.setBackground(colorlib.alphaBlend(gpuGetBackground, background, alpha / 0xFF)) + gpu.set(x + groupedPicture[alpha][symbol][background][foreground][yPos][xPos] - 1, y + yPos - 1, symbol) + gpu.setBackground(oldBackground) + else + gpu.set(x + groupedPicture[alpha][symbol][background][foreground][yPos][xPos] - 1, y + yPos - 1, symbol) + end end end end @@ -340,13 +349,15 @@ image.loadFormatModule("/lib/ImageFormatModules/OCIF.lua", ".pic") -- recursiveConversion("/MineOS/", "/ConvertedPics/") --- local function clearAndDraw(picture) --- gpu.setBackground(0x2D2D2D) --- gpu.setForeground(0xFFFFFF) --- gpu.fill(1, 1, 160, 50, " ") +local function clearAndDraw(picture) + gpu.setBackground(0x2D2D2D) + gpu.setForeground(0xFFFFFF) + gpu.fill(1, 1, 160, 50, " ") --- image.draw(1, 1, picture) --- end + image.draw(1, 1, picture) +end + +clearAndDraw(image.load("/MineOS/System/OS/Icons/Love.pic")) -- local w, h = 2, 2 -- local picture = image.create(w, h, 0xFF0000, 0xFFFFFF, 0x0, "Q")