|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectSimplePicture
Picture
A class that represents a picture. This class inherits from SimplePicture and allows the student to add functionality to the Picture class.
Constructor Summary | |
Picture()
Constructor that takes no arguments |
|
Picture(int width,
int height)
Constructor that takes the width and height |
|
Picture(String fileName)
Constructor that takes a file name and creates the picture |
Method Summary | |
void |
addHorizontalLines()
Method to add a horizontal line every 5 pixels in the current picture |
void |
addLines()
Method to add vertical and horizontal lines to the current picture |
void |
addVerticalLines()
Method to add a vertical line every 5 pixels in the current picture |
static Picture |
blendPictures()
Method to blend pictures of Katie and Jenny |
void |
bluescreen(Picture target,
int targetx,
int targety)
Method to do chromakey assuming blue background for background at a given point. |
void |
blur(int numPixels)
Method to blur the pixels |
void |
blurCopy(int numPixels)
Method to blur the pixels using a copy of the original as the source for the average |
void |
chromakey(Picture newBg)
Method to do chromakey using a blue background |
void |
chromakey(Picture target,
Color bgcolor,
int threshold,
int targetx,
int targety)
Method to do chromakey using an input color for background at a given point. |
void |
chromakeyBlue(Picture newBg)
Method to do chromakey using a blue background |
void |
chromakeyRed(Picture newBg)
Method to do chromakey using a red background |
void |
clearBlue()
Method to clear the blue from the picture (set the blue to 0 for all pixels) |
void |
complex1()
Complex manipulation |
void |
compose(Picture target,
int targetx,
int targety)
Method to compose this picture onto target at a given point. |
Picture |
copy()
A method create a copy of the current picture and return it |
void |
copy(Picture sourcePicture,
int startX,
int startY,
int endX,
int endY,
int targetStartX,
int targetStartY)
Method to copy from the passed source picture to current picture object The copying will start at startX, startY, and end at endX and endY The copy will be placed starting at targetStartX, targetStartY |
static Picture |
copyFlowerLarger()
Method to copy a flower but scaled to 2x normal size |
static Picture |
copyFlowerSmaller()
Method to copy the flower but smaller (half as big) |
static Picture |
copyKatie()
Method to copy the picture of Katie to the canvas |
static Picture |
copyKatieLeftRotation()
Method to copy Katie rotated to the left 90 degrees |
static Picture |
copyKatieMidway()
Method to copy the picture of Katie to 100, 100 in the canvas |
static Picture |
copyKatieRightRotation()
Method to copy Katie rotated to the left 90 degrees |
static Picture |
copyKatiesFace()
Method to copy just Katie's face to the canvas |
void |
copyPictureTo(Picture sourcePicture,
int xStart)
Method that will copy all of the passed source picture into the current picture object starting with the left corner given by xStart |
int |
countWhite()
Method to count teh number of white pixels in a picture |
static Picture |
createCollage()
Method to create a collage from the flower pictures. |
static Picture |
createCollageBetter()
Method to create a collage of flowers with a better method |
static Picture |
createFlowerCollage()
Method to create a flower collage |
void |
darken()
Method to darken the color in the picture |
void |
decreaseRed()
Method to decrease the red by half in the current picture |
void |
decreaseRed(double amount)
Method to decrease the red by an amount |
static Picture |
drawExample()
Method to show using drawing on a picture |
static Picture |
drawFilledRectangles()
Method to draw a picture with a succession of filled rectangles with the top left corner the darkest and the bottom right the lightest |
static Picture |
drawGrayEffect()
Method to draw a gray effect picture |
static Picture |
drawRectangles()
Method to draw a picture with a succession of rectangles |
void |
fakeSunset()
Method to fake a sunset by reducing the blue and green in a picture by 30% |
Picture |
flip()
Method to flip an image left-to-right |
void |
grayscale()
Method to change the picture to gray scale |
void |
grayscaleWithLuminance()
Method to change the picture to gray scale with luminance |
void |
increaseRed()
|
void |
increaseRed2()
Method to increase the amount of red by 1.3 |
void |
increaseRed3()
Method to increase the amount of red by 1.3 |
void |
lighten()
Method to lighten the colors in the picture |
void |
lightenNested()
Method to lighten the colors using a nested for loop |
void |
lightenWhileNested()
Method to lighten the colors using a nested for loop |
void |
makeSunset()
Method to make a picture look like it was taken at sunset by reducing the blue and green to make it look more red |
static void |
makeSunset(String fileName)
Method to simulate a sunset by reducing the green and blue |
void |
methodA()
|
void |
methodB()
|
void |
methodC()
|
void |
mirrorHorizontal()
Method to mirror around a horizontal line in the middle based on the height. |
void |
mirrorHorizontalBottomToTop()
Method to mirror around a horiztonal line in the middle based on the height of the picture. |
static Picture |
mirrorTemple()
Method to mirror the piedmont of the temple |
void |
mirrorVertical()
Method to mirror around a vertical line in the middle of the picture based on the width |
void |
myStupidMethod()
My function that shifts r, g, b -- Mark Guzdial |
void |
negate()
Method to negate the picture |
static Picture |
pickAndShow()
Class method to let the user pick a file name and then create the picture and show it |
void |
posterize()
Method to posterize (reduce the number of colors) in the picture The number of reds, greens, and blues will be 4 |
void |
posterize(int numLevels)
Method to posterize (reduce the number of colors) in the picture |
void |
reduceBlue()
Method to reduce the blue in the picture by 30% |
static Picture |
reduceBlue(String fileName)
Method to create a picture and reduce the blue in it |
void |
reduceBlueIncreaseGreen()
Method to reduce blue by 25% and increase green by 50% |
void |
reduceGreen()
Method to reduce the green in the picture by 30% |
static Picture |
reduceGreen(String fileName)
Method to create a picture from the passed file name and reduce the green in it |
void |
removeRedEye(int startX,
int startY,
int endX,
int endY,
Color newColor)
Method to remove red eye from the current picture object in the rectange define by startX, startY, endX, endY. |
Picture |
scale(double factor)
Method to scale the picture by a factor, and return the result |
Picture |
scale2x()
A method to scale the current picture object 2 x regular size |
void |
sepiaTint()
Method to change the current picture to a sepia tint (modify the middle colors to a light brown and the light colors to a light yellow and make the shadows darker |
static Picture |
showNamed(String fileName)
Class method to create a picture object from the passed file name and then show it |
void |
sunsetize()
Method to make a picture look sunset-like |
void |
swapBackground(Picture oldBackground,
Picture newBackground)
Method to replace the background in the current picture with the background from another picture |
void |
swapBackgroundForThreshold(Picture oldBackground,
Picture newBackground,
double threshold)
Method to replace the background in the current picture with the background from another picture for pixels that have a color distance to the old background of under the passed threshold |
Picture |
topQuarter()
|
String |
toString()
Method to return a string with information about this picture. |
static Picture |
turnKatieRedHead()
Method to turn to turn Katie into a red head |
static Picture |
turnKatieRedHeadInRange()
Method to turn to turn Katie into a red head using a range |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Picture()
public Picture(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 pictureMethod Detail |
public String toString()
toString
in class SimplePicture
public static Picture pickAndShow()
public static Picture showNamed(String fileName)
fileName
- the name of the file that has a picture in it
public void decreaseRed()
public void increaseRed()
public void decreaseRed(double amount)
amount
- the amount to change the red bypublic void increaseRed2()
public void increaseRed3()
public void clearBlue()
public void sunsetize()
public void lighten()
public void lightenNested()
public void lightenWhileNested()
public void darken()
public void negate()
public void grayscale()
public void grayscaleWithLuminance()
public void reduceGreen()
public void reduceBlue()
public static Picture reduceGreen(String fileName)
fileName
- the name of the file to create the picture from
public static Picture reduceBlue(String fileName)
fileName
- the name of the file to use to create the picture
public void makeSunset()
public static void makeSunset(String fileName)
fileName
- the name of the file to usepublic void fakeSunset()
public void mirrorVertical()
public void mirrorHorizontal()
public void mirrorHorizontalBottomToTop()
public static Picture mirrorTemple()
public static Picture copyKatieMidway()
public static Picture copyKatie()
public static Picture copyKatieRightRotation()
public static Picture copyKatieLeftRotation()
public void copy(Picture sourcePicture, int startX, int startY, int endX, int endY, int targetStartX, int targetStartY)
sourcePicture
- the source picture to copy fromstartX
- the starting x value in the source picturestartY
- the starting y value in the source pictureendX
- the ending x value in the source pictureendY
- the ending y value in the source picturetargetStartX
- the starting x value in the current picturetargetStartY
- the starting y value in the current picturepublic static Picture copyKatiesFace()
public static Picture createFlowerCollage()
public static Picture createCollage()
public void copyPictureTo(Picture sourcePicture, int xStart)
sourcePicture
- the picture object to copyxStart
- the x position to start the copy intopublic static Picture createCollageBetter()
public static Picture blendPictures()
public static Picture copyFlowerSmaller()
public Picture scale2x()
public Picture copy()
public static Picture copyFlowerLarger()
public static Picture turnKatieRedHead()
public static Picture turnKatieRedHeadInRange()
public void removeRedEye(int startX, int startY, int endX, int endY, Color newColor)
startX
- the top left corner x value of a rectanglestartY
- the top left corner y value of a rectangleendX
- the bottom right corner x value of a rectangleendY
- the bottom right corner y value of a rectanglenewColor
- the new color to usepublic void sepiaTint()
public void posterize(int numLevels)
numLevels
- the number of color levels to usepublic void posterize()
public void blur(int numPixels)
numPixels
- the number of pixels to average in all directions so if the
numPixels is 2 then we will average all pixels in the rectange defined by 2 before
the current pixel to 2 after the current pixelpublic void blurCopy(int numPixels)
numPixels
- the number of pixels to average in either direction so if the
numPixels is 2 then we will average all pixels in the rectange defined by 2 before
current to 2 after currentpublic void swapBackground(Picture oldBackground, Picture newBackground)
oldBackground
- a picture with the old background to replacenewBackground
- a picture with the new background to usepublic void swapBackgroundForThreshold(Picture oldBackground, Picture newBackground, double threshold)
oldBackground
- a picture with the old background to replacenewBackground
- a picture with the new background to usethreshold
- the distance from the old background color to use
to figure out which pixels to swap with the new backgroundpublic void chromakey(Picture newBg)
newBg
- the new background image to use to replace
the blue from the current picturepublic void chromakeyBlue(Picture newBg)
newBg
- the new background image to use to replace
the blue from the current picturepublic void chromakeyRed(Picture newBg)
newBg
- the new background image to use to replace
the blue from the current picturepublic void addLines()
public void addHorizontalLines()
public void addVerticalLines()
public static Picture drawExample()
public static Picture drawGrayEffect()
public static Picture drawFilledRectangles()
public static Picture drawRectangles()
public int countWhite()
public Picture scale(double factor)
factor
- factor to scale by (1.0 stays the same, 0.5 decreases each side by 0.5, 2.0 doubles each side)
public void chromakey(Picture target, Color bgcolor, int threshold, int targetx, int targety)
target
- the picture onto which we chromakey this picturebgcolor
- the color to make transparentthreshold
- within this distance from bgcolor, make transparenttargetx
- target X position to start attargety
- target Y position to start atpublic void bluescreen(Picture target, int targetx, int targety)
target
- the picture onto which we chromakey this picturetargetx
- target X position to start attargety
- target Y position to start atpublic void compose(Picture target, int targetx, int targety)
target
- the picture onto which we chromakey this picturetargetx
- target X position to start attargety
- target Y position to start atpublic Picture flip()
public void reduceBlueIncreaseGreen()
public void methodA()
public void methodB()
public void methodC()
public void myStupidMethod()
public Picture topQuarter()
public void complex1()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |