addArc
|
addArc(picture, x, y, width, height, startAngle, arcAngle, color*):
picture: the picture you want to draw the arc on
x: the x-coordinate of the center of
the bounding rectangle of the arc
y: the y-coordinate of the center of
the bounding rectangle of the arc
width: the width of the arc
height: the height of the arc
startAngle: the angle from horizontal at which to start the arc
arcAngle: the angle of the arc, relative to the start angle.
color*: the color you want to draw in
Takes a picture, a starting (x, y) position (two numbers),
a width and height (two more numbers), a start angle and arc angle (two more numbers,
six total) then draws an outline of an arc.
* Note: color parameter is optional. Black is used
when color is not specified.
|
addArcFilled
|
addArcFilled(picture, x, y, width, height, startAngle, arcAngle, color*):
picture: the picture you want to draw the arc on
x: the x-coordinate of the center of
the bounding rectangle of the arc
y: the y-coordinate of the center of
the bounding rectangle of the arc
width: the width of the arc
height: the height of the arc
startAngle: the angle from horizontal at which to start the arc
arcAngle: the angle of the arc, relative to the start angle.
color*: the color you want to draw in
Takes a picture, a starting (x, y) position (two numbers),
a width and height (two more numbers), a start angle and arc angle (two more numbers,
six total) then draws a filled-in arc.
* Note: color parameter is optional. Black is used
when color is not specified.
|
| addLine |
addLine(picture, startX, startY, endX, endY, color*):
picture: the picture you want to draw the line on
startX: the x position you want the line to start
startY: the y position you want the line to start
endX: the x position you want the line to end
endY: the y position you want the line to end
color*: the color you want to draw in
Takes a picture, a starting (x, y) position (two numbers), and an ending
(x, y) position (two more numbers, four total) and draws a line
(black, if color not specified) from the starting point to the ending
point in the picture.
* Note: color parameter is optional. Black is used
when color is not specified.
|
addOval
|
addOval(picture, startX, startY, width, height, color*):
picture: the picture you want to draw the oval on
startX: the x-coordinate of the upper left-hand corner of the
bounding rectangle of the oval
startY: the y-coordinate of the upper left-hand corner of the
bounding rectangle of the oval
width: the width of the oval
height: the height of the oval
color*: the color you want to draw in
Takes a picture, a starting (x, y) position (two numbers), and
a width and height (two more numbers, four total) then draws an
oval in outline of the given width and height with
the position (x, y) as the upper left corner.
* Note: color parameter is optional. Black is used
when color is not specified.
|
addOvalFilled
|
addOvalFilled(picture, startX, startY, width, height, color*):
picture: the picture you want to draw the oval on
startX: the x-coordinate of the upper left-hand corner of
the bounding rectangle of the oval
startY: the y-coordinate of the upper left-hand corner of
the bounding rectangle of the oval
width: the width of the oval
height: the height of the oval
color*: the color you want to draw in
Takes a picture, a starting (x, y) position (two numbers), and
a width and height (two more numbers, four total) then draws a
filled oval of the given width and height with the position (x,
y) as the upper left corner.
* Note: color parameter is optional. Black is used
when color is not specified.
|
addRect
|
addRect(picture, startX, startY, width, height, color*):
picture: the picture you want to draw the rectangle on
startX: the x-coordinate of the upper left-hand corner of the rectangle
startY: the y-coordinate of the upper left-hand corner of the rectangle
width: the width of the rectangle
height: the height of the rectangle
color*: the color you want to draw in
Takes a picture, a starting (x, y) position (two numbers), and
a width and height (two more numbers, four total) then draws a
rectangle in outline of the given width and height with
the position (x, y) as the upper left corner.
* Note: color parameter is optional. Black is used
when color is not specified.
|
| addRectFilled |
addRectFilled(picture, startX, startY, width, height, color*):
picture: the picture you want to draw the rectangle on
startX: the x-coordinate of the upper left-hand corner of the rectangle
startY: the y-coordinate of the upper left-hand corner of the rectangle
width: the width of the rectangle
height: the height of the rectangle
color*: the color you want to draw in
Takes a picture, a starting (x, y) position (two numbers), and a width and
height (two more numbers, four total) then draws a filled rectangle of the
given width, height and color with the position (x, y) as the upper left
corner.
* Note: color parameter is optional. Black is used
when color is not specified.
|
| addText |
addText(picture, xpos, ypos, text, color*):
picture: the picture you want to add the text to
color: the color you want to draw in
xpos: the x-coordinate where you want to start writing the text
ypos: the y-coordinate where you want to start writing the text
text: s string containing the text you want written
color*: the color you want to write in
Takes a picture, an x position and a y position (two numbers),
and some text as a string, which will get drawn into the
picture, in the specified color.
* Note: color parameter is optional. Black is used
when color is not specified.
|
| addTextWithStyle |
addTextWithStyle(picture, xpos, ypos, text, style, color*):
picture: the picture you want to add the text to
xpos: the x-coordinate where you want to start writing the text
ypos: the y-coordinate where you want to start writing the text
text: s string containing the text you want written
style: the font style you want to write in
color*: the color you want to write in
color*: the color you want to write in
Takes a picture, an x position and a y position (two numbers),
and some text as a string, which will get drawn into the
picture, in the specified color and font style.
To create a style, you can use the function
makeStyle(font, emphasis, size) where
font is sansSerif, serif, or mono; emphasis is italic, bold, plain,
or a sum of any of them for combinations; and size is a point size
(e.g., style = makeStyle(serif, bold, 32)).
* Note: color parameter is optional. Black is used
when color is not specified.
|
| copyInto |
copyInto(originalPict, destinationPict, upperLeftX, upperLeftY):
originalPict: the picture you want to copy from
destinationPict: the picture you want to copy into
upperLeftX: the x-coordinate where you want to start copying
in the destination picture
upperLeftY: the y-coordinate where you want to start copying
in the destination picture
Takes two pictures, a x position and a y position as input, and copies as much of the
first picture into the second picture as will fit, starting at the x,y position
in the destination picture.
|
| cropPicture |
cropPicture(picture, upperLeftX, upperLeftY, width, height):
picture: the picture you want to crop from
upperLeftX: the x position to start cropping at
upperLeftY: the y position to start cropping at
width: the width of the section to be cropped
height: the height of the section to be cropped
returns: a new picture, cropped from the original
Takes a picture, an x position, a y position, a width, and a height, and returns
a new picture, which is the specified section of the original picture, starting at
position x,y, width pixels wide, height pixels high.
|
| distance |
distance(color1, color2):
color1: the first color you want compared
color2: the second color you want compared
Takes two Color objects and returns a single number representing the distance between the colors. The red, green, and blue values of the colors are taken as a point in (x, y, z) space, and the cartesian distance is computed.
|
| duplicatePicture |
duplicatePicture(picture):
picture: the picture to be copied
returns: the replicated picture
Takes a picture as input and returns a new picture which is an exact copy.
|
| getColor |
getColor(pixel):
pixel: the pixel you want to extract the color from
returns: a color, the color from the pixel
Takes a Pixel and returns the Color object at that pixel.
|
| getRed |
getRed(pixel):
pixel: the pixel you want to get the amount of red from
returns: the red value of the pixel
Takes a Pixel object and returns the value (between 0 and 255) of the amount of redness in that pixel.
|
| getGreen |
getGreen(pixel):
pixel: the pixel you want to get the amount of green from
returns: the green value of the pixel
Takes a Pixel object and returns the value (between 0 and 255) of the amount of greenness in that pixel.
|
| getBlue |
getBlue(pixel):
pixel: the pixel you want to get the amount of blue from
returns: the blue value of the pixel
Takes a Pixel object and returns the value (between 0 and 255) of the amount of blueness in that pixel.
|
| getHeight |
getHeight(picture):
picture: the picture you want to get the height of
returns: the height of the picture
Takes a picture as input and returns its length in the number of pixels top-to-bottom in the picture.
|
| getPixels |
getPixels(picture):
picture: the picture you want to get the pixels from
returns: a list of all the pixels in the picture
Takes a picture as input and returns the sequence of Pixel objects in the picture.
|
| getAllPixels |
getAllPixels(picture):
picture: the picture you want to get the pixels from
returns: a list of all the pixels in the picture
Takes a picture as input and returns the sequence of Pixel
objects in the picture. This is another name for "getPixels".
|
| getPixel |
getPixel(picture, xpos, ypos):
picture: the picture you want to get the pixel from
xpos: the x-coordinate of the pixel you want
ypos: the y-coordinate of the pixel you want
Takes a picture, an x position and a y position (two numbers), and returns the Pixel object at that point in the picture.
|
| getWidth |
getWidth(picture):
picture: the picture you want to get the width of
returns: the width of the picture
Takes a picture as input and returns its length in the number of pixels left-to-right in the picture.
|
| getX |
getX(pixel):
pixel: the pixel you want to find the x-coordinate of
returns: the x-coordinate of the pixel
Takes in a pixel object and returns the x position of where that pixel is in the picture.
|
| getY |
getY(pixel):
pixel: the pixel you want to find the y-coordinate of
returns: the y-coordinate of the pixel
Takes in a pixel object and returns the y position of where that pixel is in the picture.
|
| makeColor |
makeColor(red, green, blue):
red: the amount of red you want in the color
green: the amount of green you want in the color
blue: the amount of blue you want in the picture
returns: the color made from the inputs
Takes three inputs: For the red, green, and blue components (in order), then returns a color object.
|
| makeDarker |
makeDarker(color):
color: the color you want to darken
returns: the new, darker color
Takes a color and returns a slightly darker version of the original color.
|
| makeLighter |
makeLighter(color):
color: the color you want to lighten
returns: the new, lighter color
Takes a color and returns a slightly lighter version of the original color.
|
| makeEmptyPicture |
makeEmptyPicture(width, height, color):
width: the width of the empty picture
height: height of the empty picture
color(optional): the color of the picture
returns: a new picture object, with all
the pixels set to white, or the specified color
Makes a new "empty" picture and returns it to you. width and
height must be between 0 and 10000.
|
| makePicture |
makePicture(path):
path: the name of the file you want to open as a picture
returns: a picture object made from the file
Takes a filename as input, reads the file, and creates a picture from it. Returns the picture.
|
| pickAColor |
pickAColor():
returns: the color selected in the picker
Takes no input, but puts up a color picker. Find the color you want, and the function will return the Color object of what you picked.
|
| pickAFile |
pickAFile():
returns: a string containing the path to the file selected in the file picker
Lets the user pick a file and returns the complete path name as a string. No input.
|
| repaint |
repaint(picture):
picture: the picture you want to repaint
Repaints the picture if it has been opened in a window from show(picture).
|
| setAllPixelsToAColor |
setAllPixelsToAColor(picture, color):
picture: the picture you want to set the color of
color: the color you want to set the picture to
Takes in a picture and a color, and sets the picture to the provided color.
|
| setColor |
setColor(pixel, color):
pixel: the pixel you want to set the color of
color: the color you want to set the pixel to
Takes in a pixel and a color, and sets the pixel to the provided color.
|
| setRed |
setRed(pixel, redValue):
pixel: the pixel you want to set the red value in.
redValue: a number (0 - 255) for the new red value of the pixel
Takes in a Pixel object and a value (between 0 and 255) and sets the redness of that pixel to the given value.
|
| setGreen |
setGreen(pixel, greenValue):
pixel: the pixel you want to set the green value in.
greenValue: a number (0 - 255) for the new green value of the pixel
Takes in a Pixel object and a value (between 0 and 255) and sets the greenness of that pixel to the given value.
|
| setBlue |
setBlue(pixel, blueValue):
pixel: the pixel you want to set the blue value in.
blueValue: a number (0 - 255) for the new blue value of the pixel
Takes in a Pixel object and a value (between 0 and 255) and sets the blueness of that pixel to the given value.
|
| show |
show(picture):
picture: the picture you want to see
Shows the picture provided as input.
|
| writePictureTo |
writePictureTo(picture, path):
picture: the picture you want to be written out to a file
path: the path to the file you want the picture written to
Takes a picture and a file name (string) as input, then writes the picture to the file as a JPEG. (Be sure to end the filename in ".jpg" for the operating system to understand it well.)
|
|