Skip to content

Commit

Permalink
Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
HoldYourWaffle committed Aug 20, 2018
1 parent 1374660 commit 342a145
Showing 1 changed file with 60 additions and 2 deletions.
62 changes: 60 additions & 2 deletions src/main/java/jimbo/pijava/blinkt/BlinktController.java
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,17 @@ public void setGradient(int redStart, int greenStart, int blueStart, int redEnd,
}


/**
* Set the Blinkt to the specified color and brightness array
*
* @param reds The array for the red color components (0-255). Must have a length of 8
* @param greens The array for the green color components (0-255). Must have a length of 8
* @param blues The array for the blue color components (0-255). Must have a length of 8
* @param brightnesses The array for the pixel brightnesses (0-1). Must have a length of 8
*
* @see #push()
* @since 1.3
*/
public void setTo(int[] reds, int[] greens, int[] blues, float[] brightnesses) {
if (!(reds.length == 8 && greens.length == 8 && blues.length == 8 && brightnesses.length == 8))
throw new IllegalArgumentException("Invalid component arrays. All arrays must have a length of 8");
Expand All @@ -403,26 +414,73 @@ public void setTo(int[] reds, int[] greens, int[] blues, float[] brightnesses) {
set(i, reds[i], greens[i], blues[i], brightnesses[i]);
}

/**
* Set the Blinkt to the specified color array with a single brightness
*
* @param reds The array for the red color components (0-255). Must have a length of 8
* @param greens The array for the green color components (0-255). Must have a length of 8
* @param blues The array for the blue color components (0-255). Must have a length of 8
* @param brightness The brightness used (0-1)
*
* @see #push()
* @since 1.3
*/
public void setTo(int[] reds, int[] greens, int[] blues, float brightness) {
setTo(reds, greens, blues, new float[] { brightness, brightness, brightness, brightness, brightness, brightness, brightness });
}

/**
* Set the Blinkt to the specified color array using the set {@link #setBrightness(float) default brightness}
*
* @param reds The array for the red color components (0-255). Must have a length of 8
* @param greens The array for the green color components (0-255). Must have a length of 8
* @param blues The array for the blue color components (0-255). Must have a length of 8
*
* @see #push()
* @since 1.3
*/
public void setTo(int[] reds, int[] greens, int[] blues) {
setTo(reds, greens, blues, brightness);
}

/**
* Set the Blinkt to the specified color and brightness array
*
* @param colors The color array. Must have a length of 8
* @param brightnesses The brightness array (0-1). Must have a length of 8
*
* @see #push()
* @since 1.3
*/
public void setTo(Color[] colors, float[] brightnesses) {
if (colors.length != 8) throw new IllegalArgumentException("Color array should have a length of 8");
if (brightnesses.length != 8) throw new IllegalArgumentException("Brightness array should have a length of 8");
if (colors.length != 8) throw new IllegalArgumentException("Color array must have a length of 8");
if (brightnesses.length != 8) throw new IllegalArgumentException("Brightness array must have a length of 8");

for (int i = 0; i <= 7; i++)
set(i, colors[i], brightnesses[i]);
}

/**
* Set the Blinkt to the specified color array with a single brightness
*
* @param colors The color array. Must have a length of 8
* @param brightnesses The brightness (0-1) used
*
* @see #push()
* @since 1.3
*/
public void setTo(Color[] colors, float brightness) {
setTo(colors, new float[] { brightness, brightness, brightness, brightness, brightness, brightness, brightness });
}

/**
* Set the Blinkt to the specified color array using the set {@link #setBrightness(float) default brightness}
*
* @param colors The color array. Must have a length of 8
*
* @see #push()
* @since 1.3
*/
public void setTo(Color[] colors) {
setTo(colors, brightness);
}
Expand Down

0 comments on commit 342a145

Please sign in to comment.