From 54c9409d5d80bda8210c8daf37d48f5fa44c4da8 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Mon, 7 Oct 2013 16:21:49 -0400 Subject: [PATCH] constrain lerpColor() between 0 and 1 --- core/src/processing/core/PGraphics.java | 3 +++ core/todo.txt | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/core/src/processing/core/PGraphics.java b/core/src/processing/core/PGraphics.java index 037ae6fa8..dc47a2c6c 100644 --- a/core/src/processing/core/PGraphics.java +++ b/core/src/processing/core/PGraphics.java @@ -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; diff --git a/core/todo.txt b/core/todo.txt index fd4b3fc53..41f5106fe 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -14,6 +14,10 @@ X fix image transparency in PDF output X https://github.com/processing/processing/pull/2070 X Java2D images crash after being resized X https://github.com/processing/processing/issues/2113 +X constrain lerpColor() between 0 and 1 + +_ JSONObject/Array.format(-1) not working on embedded JSONObjects +_ https://github.com/processing/processing/issues/2119 opengl X fix inconsistency with P2D and resetMatrix() @@ -28,6 +32,8 @@ X push/popStyle() causes color problems with P2D/P3D X https://github.com/processing/processing/issues/2102 X child SVG elements misplaced when rendering with P2D/P3D X https://github.com/processing/processing/issues/2086 +X SUBTRACT and DIFFERENCE blend modes are swapped +X https://github.com/processing/processing/issues/2075 _ Sort out blending differences with P2D/P3D _ https://github.com/processing/processing/issues/1844