|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectSimplePicture
Picture
public class Picture
A class that represents a picture. This class inherits from
SimplePicture and allows the student to add functionality to
the Picture class. In JES, many "extra" features are already present,
available through OO-notation for the advanced media computation
students.
Copyright Georgia Institute of Technology 2004-2005
Field Summary |
---|
Fields inherited from class SimplePicture |
---|
_PictureIndexOffset |
Constructor Summary | |
---|---|
Picture()
Constructor that takes no arguments |
|
Picture(java.awt.image.BufferedImage image)
Constructor that takes a buffered image |
|
Picture(int width,
int height)
Constructor that takes the width and height |
|
Picture(int width,
int height,
java.awt.Color color)
Constructor that takes the width and height, and a color |
|
Picture(Picture copyPicture)
Constructor that takes a picture and creates a copy of that picture. |
|
Picture(java.lang.String fileName)
Constructor that takes a file name and creates the picture |
Method Summary | |
---|---|
void |
addArc(java.awt.Color acolor,
int x,
int y,
int w,
int h,
int start,
int angle)
Method to draw the outline of an arc on a picture |
void |
addArcFilled(java.awt.Color acolor,
int x,
int y,
int w,
int h,
int start,
int angle)
Method to draw a solid arc on a picture |
void |
addLine(java.awt.Color acolor,
int x1,
int y1,
int x2,
int y2)
Method to draw a line between two points on a picture |
void |
addOval(java.awt.Color acolor,
int x,
int y,
int w,
int h)
Method to draw the outline of an oval on a picture. |
void |
addOvalFilled(java.awt.Color acolor,
int x,
int y,
int w,
int h)
Method to draw a solid oval on a picture. |
void |
addRect(java.awt.Color acolor,
int x,
int y,
int w,
int h)
Method to draw the outline of a rectangle on a picture. |
void |
addRectFilled(java.awt.Color acolor,
int x,
int y,
int w,
int h)
Method to draw a solid rectangle on a picture. |
void |
addText(java.awt.Color acolor,
int x,
int y,
java.lang.String string)
Method to add a line of text to a picture |
void |
addTextWithStyle(java.awt.Color acolor,
int x,
int y,
java.lang.String string,
java.awt.Font style)
Method to add text to a picture withe a particular font style |
void |
copyInto(Picture dest,
int upperLeftX,
int upperLeftY)
Copies all the pixels from this picture to the destination picture, starting with the specified upper-left corner. |
Picture |
crop(int upperLeftX,
int upperLeftY,
int width,
int height)
Returns a cropped version of this picture: copies the pixels in it starting at the specified upper-left corner and taking as many pixels as specified by width and height . |
java.lang.String |
toString()
Method to return a string with information about this picture. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Picture()
public Picture(java.lang.String fileName)
fileName
- the name of the file to create the picture frompublic Picture(int width, int height)
width
- the width of the desired pictureheight
- the height of the desired picturepublic Picture(int width, int height, java.awt.Color color)
width
- the width of the desired pictureheight
- the height of the desired picturecolor
- the color of the desired picturepublic Picture(Picture copyPicture)
copyPicture
- the picture to be copiedpublic Picture(java.awt.image.BufferedImage image)
image
- the buffered image to useMethod Detail |
---|
public java.lang.String toString()
toString
in class SimplePicture
public void addLine(java.awt.Color acolor, int x1, int y1, int x2, int y2)
acolor
- the color of the linex1
- the x-coordinate of the first pointy1
- the y-coordinate of the first pointx2
- the x-coordinate of the second pointy2
- the y-coordinate of the second pointpublic void addText(java.awt.Color acolor, int x, int y, java.lang.String string)
acolor
- the color of the textx
- the x-coordinate of the bottom left corner of the texty
- the y-coordinate of the bottom left corner of the textstring
- the text to be added to the picturepublic void addTextWithStyle(java.awt.Color acolor, int x, int y, java.lang.String string, java.awt.Font style)
acolor
- the color of the textx
- the x-coordinate of the bottom left corner of the texty
- the y-coordinate of the bottom left corner of the textstring
- the text to be added to the picturestyle
- the font style to be usedpublic void addRect(java.awt.Color acolor, int x, int y, int w, int h)
acolor
- the color of the rectanglex
- the x-coordinate of the upper-left corner of the rectangley
- the y-coordinate of the upper-left corner of the rectanglew
- the width of the rectangleh
- the height of the rectanglepublic void addRectFilled(java.awt.Color acolor, int x, int y, int w, int h)
acolor
- the color of the rectanglex
- the x-coordinate of the upper-left corner of the rectangley
- the y-coordinate of the upper-left corner of the rectanglew
- the width of the rectangleh
- the height of the rectanglepublic void addOvalFilled(java.awt.Color acolor, int x, int y, int w, int h)
acolor
- the color of the ovalx
- the x-coordinate of the upper-left corner of the bounding rectangle for the ovaly
- the y-coordinate of the upper-left corner of the bounding rectangle for the ovalw
- the width of the ovalh
- the height of the ovalpublic void addOval(java.awt.Color acolor, int x, int y, int w, int h)
acolor
- the color of the ovalx
- the x-coordinate of the upper-left corner of the bounding rectangle for the ovaly
- the y-coordinate of the upper-left corner of the bounding rectangle for the ovalw
- the width of the ovalh
- the height of the ovalpublic void addArcFilled(java.awt.Color acolor, int x, int y, int w, int h, int start, int angle)
acolor
- the color of the arcx
- the x-coordinate of the center of the arcy
- the y-coordinate of the center of the arcw
- the width of the arch
- the height of the arcstart
- the starting angle at which to draw the arcangle
- the angle of the arc, relative to the start anglepublic void addArc(java.awt.Color acolor, int x, int y, int w, int h, int start, int angle)
acolor
- the color of the arcx
- the x-coordinate of the center of the arcy
- the y-coordinate of the center of the arcw
- the width of the arch
- the height of the arcstart
- the starting angle at which to draw the arcangle
- the angle of the arc, relative to the start anglepublic void copyInto(Picture dest, int upperLeftX, int upperLeftY)
dest
- the picture which to copy intoupperLeftX
- the x-coord for the upper-left cornerupperLeftY
- the y-coord for the upper-left cornerpublic Picture crop(int upperLeftX, int upperLeftY, int width, int height)
width
and height
.
The final cropped picture may be smaller than indicated by the
parameters if the cropping area as specified would go beyond the
bounds of this picture. The cropping area will be 0 x 0
if the specified upper-left corner is not in the bounds of the
destination picture.
upperLeftX
- the x-coord of the upper-left cornerupperLeftY
- the y-coord of the upper-left cornerwidth
- the desired width of the cropped areaheight
- the desired height of the cropped area
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |