|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.meltingice.caman.util.CamanUtil
public class CamanUtil
Utility class of static methods
Constructor Summary | |
---|---|
CamanUtil()
|
Method Summary | ||
---|---|---|
static int[][] |
buildKernel(Image image,
int kernelSize,
int x,
int y)
Generates a convolution kernel from the given image and location. |
|
static int[] |
channelsToIntArray(java.lang.String chans)
Converts a string of channel characters (r, g, or b) to their appropriate index in the standard rgb array. |
|
static int[] |
clampRGB(double[] drgb)
Clamps an array of doubles and returns an array of integers. |
|
static int |
clampRGB(int val)
Clamps an integer value between 0 and 255 |
|
static int[] |
clampRGB(int[] rgb)
Clamps an array of integers between 0 and 255. |
|
static java.lang.String |
getClassName(java.lang.String input)
Given an input string, format it to produce the class name for a filter. |
|
static double |
randomRange(double min,
double max)
Returns a pseudorandom double within the given range. |
|
static int |
randomRange(int min,
int max)
Returns a pseudorandom int within the given range. |
|
static
|
reverseArray(T[] arr)
Utility function to reverse an array of any type. |
|
static double[] |
toDouble(int[] rgb)
Converts an integer array to a double array. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CamanUtil()
Method Detail |
---|
public static int clampRGB(int val)
val
- The value to clamp
public static int[] clampRGB(int[] rgb)
CamanFilter.process(int[])
rgb
- The array of integers to clamp
public static int[] clampRGB(double[] drgb)
CamanFilter.process(int[])
, and the return must be
an int array. Doubles are converted to ints by simple casting, so the
decimal portion of the double is dropped without rounding.
drgb
- The array of doubles to clamp
public static double[] toDouble(int[] rgb)
rgb
- The integer array to convert
public static java.lang.String getClassName(java.lang.String input)
input
- The filter name
public static double randomRange(double min, double max)
min
- The minimum inclusive valuemax
- The maximum inclusive value
public static int randomRange(int min, int max)
min
- The minimum inclusive valuemax
- The maximum inclusive value
public static int[] channelsToIntArray(java.lang.String chans)
chans
- A string of color channels
public static <T> T[] reverseArray(T[] arr)
T
- Will be automatically determined from the type of object array
givenarr
- The object array to reverse
public static int[][] buildKernel(Image image, int kernelSize, int x, int y)
image
- The image to retrieve the pixel color values from.kernelSize
- The size of the kernel to produce.x
- The x coordinate of the kernel.y
- The y coordinate of the kernel.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |