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;
+6
View File
@@ -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