constrain lerpColor() between 0 and 1

This commit is contained in:
Ben Fry
2013-10-07 16:21:49 -04:00
parent 5196601ffc
commit 54c9409d5d
2 changed files with 9 additions and 0 deletions
+3
View File
@@ -7635,6 +7635,9 @@ public class PGraphics extends PImage implements PConstants {
* individual color components of a color supplied as an int value.
*/
static public int lerpColor(int c1, int c2, float amt, int mode) {
if (amt < 0) amt = 0;
if (amt > 1) amt = 1;
if (mode == RGB) {
float a1 = ((c1 >> 24) & 0xff);
float r1 = (c1 >> 16) & 0xff;