From 77d395c40ea13eaabc00c577cf2b3cc97695bcbc Mon Sep 17 00:00:00 2001 From: IgorTimofeev Date: Fri, 16 Jul 2021 17:59:18 +0700 Subject: [PATCH] =?UTF-8?q?=D0=A2=D0=B0=D0=BA,=20=D0=B1=D0=BB=D1=8F=D0=B4?= =?UTF-8?q?=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Extensions/.rpic/Icon.pic | Bin 216 -> 0 bytes Applications/Picture Edit.app/Main.lua | 4 +- Libraries/Image.lua | 97 +++++------------- 3 files changed, 28 insertions(+), 73 deletions(-) delete mode 100644 Applications/Picture Edit.app/Extensions/.rpic/Icon.pic diff --git a/Applications/Picture Edit.app/Extensions/.rpic/Icon.pic b/Applications/Picture Edit.app/Extensions/.rpic/Icon.pic deleted file mode 100644 index fbd9a37114d17f857ac089878ac4b168dc8042c7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 216 zcmXYrISN8S5Jan&Sz=G{@c>>z5KJ^TH8K8`Y zPba0ie1HydOhl^2jS#g|AdPSi 1 then b = 1 end s = s + saturation; if s < 0 then s = 0 elseif s > 1 then s = 1 end h = h + hue; if h < 0 then h = 0 elseif h > 360 then h = 360 end + return color.HSBToInteger(h, s, b) end for i = 3, #picture, 4 do - picture[i] = calculateBrightnessChanges(picture[i]) - picture[i + 1] = calculateBrightnessChanges(picture[i + 1]) + picture[i] = calculate(picture[i]) + picture[i + 1] = calculate(picture[i + 1]) end return picture @@ -577,18 +535,23 @@ function image.blackAndWhite(picture) end function image.colorBalance(picture, r, g, b) - local function calculateRGBChanges(colr) - local rr, gg, bb = color.integerToRGB(colr) - rr = rr + r; gg = gg + g; bb = bb + b + local function calculate(c) + local rr, gg, bb = color.integerToRGB(c) + + rr = rr + r + gg = gg + g + bb = bb + b + if rr < 0 then rr = 0 elseif rr > 255 then rr = 255 end if gg < 0 then gg = 0 elseif gg > 255 then gg = 255 end if bb < 0 then bb = 0 elseif bb > 255 then bb = 255 end + return color.RGBToInteger(rr, gg, bb) end for i = 3, #picture, 4 do - picture[i] = calculateRGBChanges(picture[i]) - picture[i + 1] = calculateRGBChanges(picture[i + 1]) + picture[i] = calculate(picture[i]) + picture[i + 1] = calculate(picture[i + 1]) end return picture @@ -599,16 +562,8 @@ function image.invert(picture) picture[i] = 0xffffff - picture[i] picture[i + 1] = 0xffffff - picture[i + 1] end - return picture -end -function image.photoFilter(picture, colr, transparency) - if transparency < 0 then transparency = 0 elseif transparency > 1 then transparency = 1 end - for i = 3, #picture, 4 do - picture[i] = color.blend(picture[i], colr, transparency) - picture[i + 1] = color.blend(picture[i + 1], colr, transparency) - end - return picture + return picture end --------------------------------------------------------------------------------