From d51f3f35c5e1672dad7e7721ffb91a04a7207d54 Mon Sep 17 00:00:00 2001 From: poetic android Date: Sun, 8 Mar 2020 20:49:12 +0100 Subject: [PATCH] fixed some bugs in copymodes --- source/machine.d | 2 +- source/pixmap.d | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/source/machine.d b/source/machine.d index 2214b0d..5b35a29 100644 --- a/source/machine.d +++ b/source/machine.d @@ -26,7 +26,7 @@ import pixmap; import image_loader; import network; -const VERSION = "1.3.0"; /// version of the software +const VERSION = "1.3.1"; /// version of the software /** Class representing "the machine"! diff --git a/source/pixmap.d b/source/pixmap.d index 1d5bfda..5f17c74 100644 --- a/source/pixmap.d +++ b/source/pixmap.d @@ -316,9 +316,9 @@ class Pixmap dr - sr), cast(ubyte) max(0, dg - sg), cast(ubyte) max(0, db - sb)); break; case CopyMode.multiplyColor: - d = this.nearestColor(cast(ubyte)(cast(float)(dr / 255) * cast(float)(sr / 255)), - cast(ubyte)(cast(float)(dg / 255) * cast(float)(sg / 255)), - cast(ubyte)(cast(float)(db / 255) * cast(float)(sb / 255)),); + d = this.nearestColor(cast(ubyte)(cast(float)(dr / 255.0) * cast(float)(sr / 255.0) * 255.0), + cast(ubyte)(cast(float)(dg / 255.0) * cast(float)(sg / 255.0) * 255.0), + cast(ubyte)(cast(float)(db / 255.0) * cast(float)(sb / 255.0) * 255.0)); break; case CopyMode.hueColor: const smin = min(sr, sg, sb); @@ -429,21 +429,21 @@ class Pixmap if (dr == dmin) dr = smin; if (dg == dmin) - dg = dmin; + dg = smin; if (db == dmin) - db = dmin; + db = smin; if (dr == dmid) dr = smid; if (dg == dmid) - dg = dmid; + dg = smid; if (db == dmid) - db = dmid; + db = smid; if (dr == dmax) dr = smax; if (dg == dmax) - dg = dmax; + dg = smax; if (db == dmax) - db = dmax; + db = smax; d = this.nearestColor(dr, dg, db); break;