Package thirdparty.colorthief
Class RGBUtil
- java.lang.Object
-
- thirdparty.colorthief.RGBUtil
-
public class RGBUtil extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description RGBUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
packRGB(int[] rgb)
Packs the RGB array into one int for storing into db or sending via network.static int[]
packRGBArray(int[][] rgbArray)
static int[]
unpackRGB(int packedRgb)
Unpacks RGB array from the given int, e.g.static int[][]
unpackRGBArray(int[] packedRgbArray)
-
-
-
Method Detail
-
packRGB
public static int packRGB(int[] rgb)
Packs the RGB array into one int for storing into db or sending via network.- Parameters:
rgb
- array containing red, green and blue values of the color to encode- Returns:
- packed into int RGB value
- Throws:
java.lang.IllegalArgumentException
- if rgb has not exactly 3 elements
-
unpackRGB
public static int[] unpackRGB(int packedRgb)
Unpacks RGB array from the given int, e.g. received from callingpackRGB(int[])
).- Parameters:
packedRgb
- value containing RGB- Returns:
- array containing red, green and blue values of the color
-
packRGBArray
public static int[] packRGBArray(int[][] rgbArray)
- Parameters:
rgbArray
- the array of arrays containing unpacked RGB values- Returns:
- the array of packed RGB values
- Throws:
java.lang.IllegalArgumentException
- if at least one of rgb has not exactly 3 elements
-
unpackRGBArray
public static int[][] unpackRGBArray(int[] packedRgbArray)
- Parameters:
packedRgbArray
- the array of packed RGB values- Returns:
- the array of arrays containing unpacked RGB values
-
-