From 39bf261cce638d37e613da295c2816d589135bba Mon Sep 17 00:00:00 2001 From: Michael Carleton Date: Fri, 28 Jul 2023 15:53:15 +0100 Subject: [PATCH] mixbox --- pom.xml | 6 ++++++ src/main/java/micycle/pgs/color/RGB.java | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/pom.xml b/pom.xml index a503ef91..9c3dc965 100644 --- a/pom.xml +++ b/pom.xml @@ -347,6 +347,12 @@ SRPG 1.0 + + com.scrtwpns + mixbox + 2.0.0 + jar + diff --git a/src/main/java/micycle/pgs/color/RGB.java b/src/main/java/micycle/pgs/color/RGB.java index db01ef7e..b9e44695 100644 --- a/src/main/java/micycle/pgs/color/RGB.java +++ b/src/main/java/micycle/pgs/color/RGB.java @@ -1,5 +1,7 @@ package micycle.pgs.color; +import com.scrtwpns.Mixbox; + /** * Provides static methods for Processing color generation (that doesn't require * a PApplet instance). @@ -132,4 +134,16 @@ public static int[] hexToColor(String[] colors) { return out; } + /** + * Mixes/blends two colors using natural color mixing. + *

+ * It produces saturated gradients with hue shifts and natural secondary colors + * during blending. For instance, yellow and blue make green. + * + * @return the new mixed color + */ + public static int pigmentMix(int colorA, int colorB, float t) { + return Mixbox.lerp(colorA, colorB, t); + } + }