|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjpview.Utils
public class Utils
The Utils class provides static convenience methods
| Constructor Summary | |
|---|---|
Utils()
|
|
| Method Summary | |
|---|---|
static java.lang.String |
asString(double[] a)
Return a string representation of a double array |
static java.lang.String |
asString(float[] a)
Returns a string representation of an array of floats |
static java.lang.String |
asString(int[] a)
Returns a string representation of an array of ints |
static java.awt.image.BufferedImage |
blurImageSimple(java.awt.image.BufferedImage image,
int kSize)
Applies a simple blur to an image |
static int |
clamp(int i)
clamp to 8-bit int |
static java.awt.image.BufferedImage |
createBufferedImage(int[] pixels,
int scanline)
Creates a buffered image from an array of pixels |
static java.awt.image.BufferedImage |
createBufferedImage(Vec3f[] pixels,
int scanline)
Creates a buffered image from an array of Vec3f objects |
static double |
dot3(double[] a,
double[] b)
Calulates the dot product of two 3 element double arrays |
static float |
dot3(float[] a,
float[] b)
Calulates the dot product of two 3 element float arrays |
static java.awt.image.BufferedImage |
gaussianBlur(java.awt.image.BufferedImage image,
int kSize,
float sigma)
Applies a gaussian blur to a buffered image |
static int[] |
grabPixels(java.awt.image.BufferedImage image)
Returns a reference to the data buffer for the buffered image |
static int |
indexOfMax(double[] a)
Finds the element in an array with the maximum value |
static Vec3f[] |
intToVec(int[] a)
Creates an array of Vec3f (rgb) values from a pixel buffer |
static void |
main(java.lang.String[] args)
Main method for testing |
static float[] |
normalize(float x,
float y,
float z)
normalize three float values - divide by euclidean length |
static double[] |
normalize3(double[] a)
normalize an array of three doubles - divide by euclidean length |
static float[] |
normalize3(float[] a)
normalize an array of three floats - divide by euclidean length |
static java.awt.image.BufferedImage |
readUnbuffered(java.io.InputStream is)
Reads an input stream into a byte array without any buffering. |
static double[] |
reflect(double[] normal,
double[] incedent)
Calculates the reflection vector based on the input normal and incedent |
static float[] |
reflect(float[] normal,
float[] incedent)
Calculates the reflection vector based on the input normal and incedent |
static double[] |
scalarMult3(double[] a,
double s)
Multiplies a vector of 3 doubles by a scalar value |
static float[] |
scalarMult3(float[] a,
float s)
Multiplies a vector of 3 floats by a scalar value |
static int |
unsignedByteToInt(byte b)
create an integer representation of an unsigned byte |
static double[] |
vecSum3(double[] a,
double[] b)
Returns the sum of two 3 component double vectors |
static float[] |
vecSum3(float[] a,
float[] b)
Returns the sum of two 3 component float vectors |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Utils()
| Method Detail |
|---|
public static int indexOfMax(double[] a)
a - The array to search
public static int clamp(int i)
i - the integer to clamp
public static float[] normalize3(float[] a)
a - the array of floats
public static double[] normalize3(double[] a)
a - the array of three doubles (x, y, z)
public static float[] normalize(float x,
float y,
float z)
x - value for xy - value for yz - value for z
public static java.lang.String asString(double[] a)
a - the array of doubles
public static java.lang.String asString(float[] a)
a - the array of floats for input
public static java.lang.String asString(int[] a)
a - the array of ints for input
public static int unsignedByteToInt(byte b)
b - the unsigned byte
public static float[] reflect(float[] normal,
float[] incedent)
normal - the normal vectorincedent - the incedenct vector
public static double[] reflect(double[] normal,
double[] incedent)
normal - the normal vectorincedent - the incedent vector
public static float[] vecSum3(float[] a,
float[] b)
a - the first vectorb - the second vector
public static double[] vecSum3(double[] a,
double[] b)
a - the first vectorb - the second vector
public static float[] scalarMult3(float[] a,
float s)
a - the vector of three floatss - the scalar value
public static double[] scalarMult3(double[] a,
double s)
a - the vector of 3 doubless - the scalar value
public static float dot3(float[] a,
float[] b)
a - the first float arrayb - the second float array
public static double dot3(double[] a,
double[] b)
a - the first double arrayb - the second double array
public static java.awt.image.BufferedImage readUnbuffered(java.io.InputStream is)
throws java.io.IOException
is - the input stream to read
java.io.IOException - if the input stream can not be readpublic static int[] grabPixels(java.awt.image.BufferedImage image)
image - the buffered image source
public static java.awt.image.BufferedImage gaussianBlur(java.awt.image.BufferedImage image,
int kSize,
float sigma)
image - the image sourcekSize - the kernel sizesigma - the sigma value for the blur procedure
public static java.awt.image.BufferedImage blurImageSimple(java.awt.image.BufferedImage image,
int kSize)
image - the input imagekSize - the kernel size
public static java.awt.image.BufferedImage createBufferedImage(int[] pixels,
int scanline)
pixels - the array of pixelsscanline - the size of the scanline (width)
public static java.awt.image.BufferedImage createBufferedImage(Vec3f[] pixels,
int scanline)
pixels - the input arrayscanline - the scanline size (width)
public static Vec3f[] intToVec(int[] a)
a - the pixel buffer
public static void main(java.lang.String[] args)
args - user defined
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||