Skip to content

Commit

Permalink
fixed some bugs in copymodes
Browse files Browse the repository at this point in the history
  • Loading branch information
poeticAndroid committed Mar 8, 2020
1 parent 2df5f90 commit d51f3f3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion source/machine.d
Original file line number Diff line number Diff line change
Expand Up @@ -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"!
Expand Down
18 changes: 9 additions & 9 deletions source/pixmap.d
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit d51f3f3

Please sign in to comment.