

This function returns true if the pixel's location is within borderWidth of any of the two vertical borders, and thus on the border. a) function pixelOnVerticalEdge(pixel, image, borderWidth) - This function has three parameters where pixel is a single pixel, image is the complete image, and borderWidth is an integer specifying the thickness of the vertical borders. Be sure to print the image and run your program with different border values for the horizontal and vertical edges. You should write the two boolean functions shown below. Now modify the border program to specify two thicknesses, one for the vertical borders and one for the horizontal borders. This function returns true if the pixel's location is within borderWidth of any of the four borders, and thus on the border. b) function pixelOnEdge(pixel, image, borderWidth) - This function has three parameters where pixel is a single pixel, image is the complete image, and borderWidth is an integer specifying the thickness of the borders. a) function setBlack(pixel) - This function has a parameter pixel that represents a single pixel, and returns a pixel that has been changed to be the color black. Be sure to print the image so you can see it and run the program with different border values.

#Simpleimage code#
You should be able to write these functions without looking at the code from the lesson. Write the complete JavaScript program to put the border around a picture, and include the following functions that are included from the lesson. Run your program on an image to see it get redder. Your program should have a function called moreRed with two parameters, a pixel and a value to increase the red by. Write a JavaScript program to make an image have more red in it, by adding a given value to the red, making sure it doesn't go over 255.

Think about what type of image you should use for testing your function. For some images you may not notice any change. Pick an image, print the image, then apply swapRedGreen to every pixel in the image, and print the new image. This function should swap the red and green values of the pixel. Write a JavaScript program that has a function named swapRedGreen with one parameter pixel.
