Skip to content

Commit

Permalink
mixbox
Browse files Browse the repository at this point in the history
  • Loading branch information
micycle1 committed Jul 28, 2023
1 parent 69c9243 commit 39bf261
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,12 @@
<artifactId>SRPG</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.scrtwpns</groupId>
<artifactId>mixbox</artifactId>
<version>2.0.0</version>
<type>jar</type>
</dependency>
</dependencies>

</project>
14 changes: 14 additions & 0 deletions src/main/java/micycle/pgs/color/RGB.java
Original file line number Diff line number Diff line change
@@ -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).
Expand Down Expand Up @@ -132,4 +134,16 @@ public static int[] hexToColor(String[] colors) {
return out;
}

/**
* Mixes/blends two colors using natural color mixing.
* <p>
* 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);
}

}

0 comments on commit 39bf261

Please sign in to comment.