Class GrafixTools
Class GrafixTools
java.lang.Object
|
+----GrafixTools
- public class GrafixTools
- extends Object
GraphixTools - A collection of handy graphics functions
This is a collection of graphics mundanes that I had to cut and
paste one too many times. While laziness on my part I think that
I was doing this stuff enough to warrant packaging up these goodies
into their own proper class. Hopefully this will evolve into something
that's worth releasing.
Feature list:
Array returns (R,G,B).
E-Z Image Producing.
RGB to YUV colorspace conversion.
YUV to RGB colorspave conversion.
Filesize and other information
Free & Used VM Machine Memory Info
You can get the source code here.
- Version:
- 0.9.7 August 20th 1996
- Author:
- Stephen Manley (smanley@nyx.net)
-
imageHeight
- Image height.
-
imageobj
- Here lieth an image.
-
imageWidth
- Image width.
-
GrafixTools(Image)
- Gives GraphixTools a preloaded image object.
-
convertGrayToArray(int[][], boolean)
- This method converts a single array 0..255 range pixel matrix to a
java-compatible array of 32 bit integers.
-
convertRGBtoArray(int[][], int[][], int[][], boolean)
- This method converts a 0..255 range pixel matrix to a java-compatible
array of 32 bit integers.
-
convertRGBtoCb(int[][], int[][], int[][])
- This method converts an RGB colorspace to a YUV colorspace.
-
convertRGBtoCr(int[][], int[][], int[][])
- This method converts an RGB colorspace to a YUV colorspace.
-
convertRGBtoY(int[][], int[][], int[][])
- This method converts an RGB colorspace to a YUV colorspace.
-
convertYCbCrtoB(int[][], int[][], int[][])
- This method converts a YUV (aka YCbCr) colorspace to a RGB colorspace.
-
convertYCbCrtoG(int[][], int[][], int[][])
- This method converts a YUV (aka YCbCr) colorspace to a RGB colorspace.
-
convertYCbCrtoR(int[][], int[][], int[][])
- This method converts a YUV (aka YCbCr) colorspace to a RGB colorspace.
-
getBlueArray()
- This method returns an array[][] of 8-bit blue values.
-
getGreenArray()
- This method returns an array[][] of 8-bit green values.
-
getRedArray()
- This method returns an array[][] of 8-bit red values.
imageobj
public Image imageobj
- Here lieth an image.
imageHeight
public int imageHeight
- Image height.
imageWidth
public int imageWidth
- Image width.
GrafixTools
public GrafixTools(Image image)
- Gives GraphixTools a preloaded image object. Image must be
pre-loaded with the MediaTracker or bad things will happen.
The constructor calculates all the image parameters from this
passed image. (Dimensions, size, etc.)
- Parameters:
- image - The 100% loaded image
getRedArray
public int[][] getRedArray()
- This method returns an array[][] of 8-bit red values. The dimensions are
the array bounds ex. (320 x 200).
- Returns:
- s An array[][] of red pixel values
getGreenArray
public int[][] getGreenArray()
- This method returns an array[][] of 8-bit green values. The dimensions are
the array bounds ex. (320 x 200).
- Returns:
- s An array[][] of green pixel values.
getBlueArray
public int[][] getBlueArray()
- This method returns an array[][] of 8-bit blue values. The dimensions are
the array bounds, ex. (320 x 200).
- Returns:
- s An array[][] of blue pixel values.
convertRGBtoY
public int[][] convertRGBtoY(int redArray[][],
int greenArray[][],
int blueArray[][])
- This method converts an RGB colorspace to a YUV colorspace. (YUV is more
technically correct when referred to a YCbCr colorspace.) YCbCr was developed
according to recommondation ITU-R BT.601 (Formerly: CCIR 601) to develop
a world-wide digital video standard. It is commonly used in many streaming
video and compression routines, such as MPEG
and H.263.
This routine handles dealing with 0..255 values per pixel, the more common
PC format. The passed arrays should all have the same bounds, corresponding
to the image dimensions.
- Parameters:
- redArray - An array of 0..255 red pixel values.
- greenArray - An array of 0..255 green pixel values.
- blueArray - An array of 0..255 blue pixel values.
- Returns:
- s Y The Y component
convertRGBtoCb
public int[][] convertRGBtoCb(int redArray[][],
int greenArray[][],
int blueArray[][])
- This method converts an RGB colorspace to a YUV colorspace. (YUV is more
technically correct when referred to a YCbCr colorspace.) YCbCr was developed
according to recommondation ITU-R BT.601 (Formerly: CCIR 601) to develop
a world-wide digital video standard. It is commonly used in many streaming
video and compression routines, such as MPEG
and H.263.
This routine handles dealing with 0..255 values per pixel, the more common
PC format. The passed arrays should all have the same bounds, corresponding
to the image dimensions.
- Parameters:
- redArray - An array of 0..255 red pixel values.
- greenArray - An array of 0..255 green pixel values.
- blueArray - An array of 0..255 blue pixel values.
- Returns:
- s Cb The Cb component.
convertRGBtoCr
public int[][] convertRGBtoCr(int redArray[][],
int greenArray[][],
int blueArray[][])
- This method converts an RGB colorspace to a YUV colorspace. (YUV is more
technically correct when referred to a YCbCr colorspace.) YCbCr was developed
according to recommondation ITU-R BT.601 (Formerly: CCIR 601) to develop
a world-wide digital video standard. It is commonly used in many streaming
video and compression routines, such as MPEG
and H.263.
This routine handles dealing with 0..255 values per pixel, the more common
PC format. The passed arrays should all have the same bounds, corresponding
to the image dimensions.
- Parameters:
- redArray - An array of 0..255 red pixel values.
- greenArray - An array of 0..255 green pixel values.
- blueArray - An array of 0..255 blue pixel values.
- Returns:
- s Cr The Cr component.
convertYCbCrtoR
public int[][] convertYCbCrtoR(int Y[][],
int Cb[][],
int Cr[][])
- This method converts a YUV (aka YCbCr) colorspace to a RGB colorspace.
This is handy when trying to reconstruct an image in Java from YCbCr transmitted
data. This routine expects the data to fall in the standard PC 0..255 range
per pixel, with the array dimensions corresponding to the imageWidth and imageHeight.
These variables are either set manually in the case of a null constructor,
or they are automatically calculated from the image parameter constructor.
- Parameters:
- Y - The Y component set.
- Cb - The Cb component set.
- Cr - The Cr component set.
- Returns:
- s R The R component.
convertYCbCrtoG
public int[][] convertYCbCrtoG(int Y[][],
int Cb[][],
int Cr[][])
- This method converts a YUV (aka YCbCr) colorspace to a RGB colorspace.
This is handy when trying to reconstruct an image in Java from YCbCr transmitted
data. This routine expects the data to fall in the standard PC 0..255 range
per pixel, with the array dimensions corresponding to the imageWidth and imageHeight.
These variables are either set manually in the case of a null constructor,
or they are automatically calculated from the image parameter constructor.
- Parameters:
- Y - The Y component set.
- Cb - The Cb component set.
- Cr - The Cr component set.
- Returns:
- s G The G component.
convertYCbCrtoB
public int[][] convertYCbCrtoB(int Y[][],
int Cb[][],
int Cr[][])
- This method converts a YUV (aka YCbCr) colorspace to a RGB colorspace.
This is handy when trying to reconstruct an image in Java from YCbCr transmitted
data. This routine expects the data to fall in the standard PC 0..255 range
per pixel, with the array dimensions corresponding to the imageWidth and imageHeight.
These variables are either set manually in the case of a null constructor,
or they are automatically calculated from the image parameter constructor.
- Parameters:
- Y - The Y component set.
- Cb - The Cb component set.
- Cr - The Cr component set.
- Returns:
- s B The B component.
convertRGBtoArray
public int[] convertRGBtoArray(int R[][],
int G[][],
int B[][],
boolean log)
- This method converts a 0..255 range pixel matrix to a java-compatible
array of 32 bit integers. This method can take a long time to complete
so a reporting feature has been added. The arrays should be the same
dimensions as imageWidth and imageHeight. This array can then be converted
to an image with:
newimage = comp.createImage(new MemoryImageSource(imageWidth,imageHeight,imageArray,0,imageWidth));
- Parameters:
- R - The Red Values.
- G - The Green Values.
- B - The Blue Values.
- log - Enable/disable progress reporting.
- Returns:
- s array A one dimensional image array.
convertGrayToArray
public int[] convertGrayToArray(int R[][],
boolean log)
- This method converts a single array 0..255 range pixel matrix to a
java-compatible array of 32 bit integers. This method can take a long
time to complete so a reporting feature has been added. The arrays
should be the same dimensions as imageWidth and imageHeight. This array
can then be converted to an image with:
newimage = comp.createImage(new MemoryImageSource(imageWidth,imageHeight,imageArray,0,imageWidth));
- Parameters:
- Array - The pixel values
- log - Enable/Disable progress reporting.
- Returns:
- s array A one dimensional image array.