|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsquint.SImage
public class SImage
An SImage is a representation of an image. SImages can be created either using image data from a file, by providing arrays of brightness or color values that describe the image. It is also possible to obtain arrays of values that describes an SImage using methods provided by the class.
Field Summary | |
---|---|
static int |
BLUE
Value used to identify the blue component of an image |
static int |
CHANNELS
Number of distinct colors used in an image |
static int |
GRAY
Value used to identify the grayness of an image |
static int |
GREEN
Value used to identify the green component of an image |
static int |
RED
Value used to identify the red component of an image |
Constructor Summary | |
---|---|
SImage(java.awt.Image original)
Construct a new SImage from a representation of the image as an object of Java's Image class. |
|
SImage(int[][] pixArray)
Construct a new SImage from a single array of pixel values. |
|
SImage(int[][][] pixelArrays)
Construct a new SImage from a three dimensional array of values describing the redness, blueness and greenness of the image's pixels. |
|
SImage(int[][] reds,
int[][] greens,
int[][] blues)
Construct a new SImage from a three arrays of values describing the redness, blueness, and greenness of the image's pixels. |
|
SImage(int channel,
int[][] pixelArray)
Construct a new SImage from a two dimensional array of pixel values describing the brightness values for just one color channel. |
|
SImage(int width,
int height,
java.awt.Color shade)
Construct a new, monotone SImage of a given width and height. |
|
SImage(int width,
int height,
int brightness)
Construct a new, monotone, grayscale SImage of a given width and height. |
|
SImage(java.lang.String pathName)
Construct a new SImage given a String that identifies a file containing the data describing the image. |
Method Summary | |
---|---|
int[][] |
getBluePixelArray()
Get an array describing the blueness values of this SImage's pixels |
java.awt.Color |
getColor(int x,
int y)
Access the Color associated with a particular pixel of an SImage. |
int[][] |
getGreenPixelArray()
Get an array describing the greenness values of this SImage's pixels |
int |
getHeight()
Get this SImage's height. |
int |
getIconHeight()
Get this SImage's height. |
int |
getIconWidth()
Get this SImage's width. |
java.awt.Image |
getImage()
Get a representation of this SImage as an Image object. |
int[][] |
getPixelArray()
Get a pixel array describing the brightness values of this SImage's pixels. |
int[][] |
getPixelArray(int channel)
Get a pixel array describing the amount of one of the three primary colors (red, green, and blue) in each of this image's pixels. |
int[][][] |
getPixelArrays()
Get a three dimensional array describing the redness, greenness, and blueness values of this SImage's pixels |
int[][] |
getRedPixelArray()
Get an array describing the redness values of this SImage's pixels |
int |
getWidth()
Get this SImage's width. |
void |
paintIcon(java.awt.Component c,
java.awt.Graphics g,
int x,
int y)
Draw this image using the specified graphics context. |
void |
saveAs(java.lang.String pathName)
Save the image in a PNG format file |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int GRAY
public static final int RED
public static final int GREEN
public static final int BLUE
public static final int CHANNELS
Constructor Detail |
---|
public SImage(int width, int height, int brightness)
width
- the width of the desired SImageheight
- the height of the desired SImagebrightness
- the brightness of the desired SImagepublic SImage(int width, int height, java.awt.Color shade)
width
- the width of the desired SImageheight
- the height of the desired SImageshade
- the color of the desired SImagepublic SImage(java.awt.Image original)
original
- the Image object whose contents describe the desired SImagepublic SImage(java.lang.String pathName)
pathName
- a URL or file pathname describing where the image data can be foundpublic SImage(int[][] pixArray)
pixArray
- an array describing the brightness of each of the image's pixelspublic SImage(int[][] reds, int[][] greens, int[][] blues)
reds
- an array describing the amount of red in each of the image's pixelsgreens
- an array describing the amount of green in each of the image's pixelsblues
- an array describing the amount of blue in each of the image's pixelspublic SImage(int[][][] pixelArrays)
pixelArrays
- an array describing the amount of red, green, and blue
in each of the image's pixelspublic SImage(int channel, int[][] pixelArray)
channel
- the color whose brightness values are specified by the second parameterpixelArray
- an array describing the brightness values of the specified channelMethod Detail |
---|
public java.awt.Color getColor(int x, int y)
x
- the x coordinate of the desired pixely
- the y coordinate of the desired pixel
public int[][] getPixelArray()
public int[][] getPixelArray(int channel)
channel
- a value identifying which color values are desired. This parameter's value
must be either SImage.RED (=0), SImage.GREEN (=1), or SImage.BLUE (=2).
public int[][] getRedPixelArray()
public int[][] getGreenPixelArray()
public int[][] getBluePixelArray()
public int[][][] getPixelArrays()
public int getHeight()
public int getIconHeight()
getIconHeight
in interface javax.swing.Icon
public int getWidth()
public int getIconWidth()
getIconWidth
in interface javax.swing.Icon
public java.awt.Image getImage()
public void saveAs(java.lang.String pathName)
pathName
- the pathname under which the image should be savedpublic void paintIcon(java.awt.Component c, java.awt.Graphics g, int x, int y)
paintIcon
in interface javax.swing.Icon
c
- the component to be used as the observerg
- the graphics contextx
- coordinate where the image should be drawny
- coordinate where the image should be drawn
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |