Presentation is loading. Please wait.

Presentation is loading. Please wait.

Georgia Institute of Technology Manipulating Pictures, Arrays, and Loops Barb Ericson Georgia Institute of Technology August 2005.

Similar presentations


Presentation on theme: "Georgia Institute of Technology Manipulating Pictures, Arrays, and Loops Barb Ericson Georgia Institute of Technology August 2005."— Presentation transcript:

1 Georgia Institute of Technology Manipulating Pictures, Arrays, and Loops Barb Ericson Georgia Institute of Technology August 2005

2 Georgia Institute of Technology Learning Goals Understand at a conceptual and practical level –How to manipulate digital images using methods? –What is an array? –What is a loop? While and for loops –What is a package? –How do you import classes? –What is a comment?

3 Georgia Institute of Technology Digital Pictures Represented by pixels –With a red, green, and blue value stored for each pixel Stored in.jpg (JPEG) files –International standard –With lossy compression Lossy means not all data is stored –But what is lost isn’t that important Compression means made smaller Other formats for storing digital pictures are GIFF and BMP

4 Georgia Institute of Technology Pictures have lots of Pixels How can we refer to each pixel? –pixel1, pixel2, pixel3, pixel4, pixel5, … Do we really want to name each one? –There are 640 x 480 = 307,200 pixels How do we deal with lots of data of the same type? –Use an array

5 Georgia Institute of Technology What is an Array? Storage for a sequence of items –Of the same type You can access items by using an index The index starts at 0 –The first item is at index 0 –The last item is at index (length – 1) Arrays know their length (have a public length field) –arrayObj.length 379215 8326 012345 0123

6 Georgia Institute of Technology Manipulating a Picture To manipulate a picture we need to manipulate the pixels that make up the picture –Change the red, green, or blue values at the pixel Pixel is a class that we created at Georgia Tech –Each pixel object has a red, green, and blue value

7 Georgia Institute of Technology What Data does a Picture Object Have? A picture object has an array of pixel objects –That it read from the JPEG file It knows the picture width pictureObj.getWidth() It knows the picture height pictureObj.getHeight() It knows how to return an array of pixels Pixel[] pixelArray = pictureObj.getPixels()

8 Georgia Institute of Technology Picture Exercise Create a picture in DrJava –get the pictures width, height, and number of pixels String fileName = FileChooser.pickAFile(); Picture pictureObj = new Picture(fileName); int width = pictureObj.getWidth(); System.out.println(“The picture width is “ + width); int height = pictureObj.getHeight(); System.out.println(“The picture height is “ + height); Pixel[] pixelArray = pictureObj.getPixels(); System.out.println(pixelArray.length + “ pixels”);

9 Georgia Institute of Technology Pixel Objects Each pixel has a red, green, and blue value –getRed(), getGreen(), getBlue() –setRed(v), setGreen(v), setBlue(v) Each pixel knows the location it was in the picture object –getX(), get(Y) You can also get and set the color at the pixel –getColor(), setColor(color)

10 Georgia Institute of Technology Color Objects There is a class defined in Java that represents color –The Color class in the package java.awt –To use the class you must either import java.awt.Color; Use the full name java.awt.Color You can create a color object by giving the red, green, and blue values for it –Color colorObj = new Color(255,10,125);

11 Georgia Institute of Technology Predefined Colors The Color class has defined class constants for many colors –Color.red, Color.green, Color.blue, Color.black, Color.white, Color.yellow, Color.gray, Color.orange, Color.pink, Color.cyan, Color.magenta –Or you can use all uppercase names Color.RED, Color.BLUE, Color.BLACK, …

12 Georgia Institute of Technology Getting and Setting Pixel Colors To get a pixel’s color as a color object Color color1 = pixelObj.getColor(); int red = color1.getRed(); int green = color1.getGreen(); int blue = color1.getBlue(); To set a pixel’s color using a new color object red = 20; green = 30; blue = 100; Color color2 = new Color(red,green,blue); pixelObj.setColor(color2);

13 Georgia Institute of Technology Using Classes in Packages All classes in the Java language are in packages –You can use any class in java.lang System, Math, Object For classes in other packages you need to import them –import java.awt.Color; –Import java.awt.*; //import all classes in this package To use the short name: Color Or use the fully qualified name –packageName.ClassName –java.awt.Color

14 Georgia Institute of Technology Undefined Class Error If you forget to import a class –Yet, you use the short name for the class –It won’t compile Undefined class error Undefined class errors mean –You need to import the class –Or you misspelled the class –Or used the wrong case

15 Georgia Institute of Technology Pixel Exercise In DrJava –Pick a file and create a picture object –Get the array of pixels from the picture object –Get the 1 st pixel from the array of pixels Pixel pixelObj = pixelArray[0]; // 0 is first one –Get the red, green, and blue value for this pixel –Get the x and y location of this pixel –Get the color of this pixel Get the red, green, and blue values of the color

16 Georgia Institute of Technology Changing Pixel Colors There are two ways to change the color of a pixel in a picture –Set the red, green, and blue values individually pixelObj.setRed(value), pixelObj.setGreen(value), pixelObj.setBlue(value), –Or set the color pixelObj.setColor(colorObj) But, you won’t see any change in the picture –Until you ask it to repaint: pictureObj.repaint();

17 Georgia Institute of Technology Changing a Color The Color class has methods for making a color object –Lighter colorObj.brighter(); –Darker colorObj.darker(); Example > import java.awt.Color; > Color testColor = new Color(168,131,105); > System.out.println(testColor); java.awt.Color[r=168,g=131,b=105] > testColor = testColor.darker(); > System.out.println(testColor); java.awt.Color[r=117,g=91,b=73] > testColor = testColor.brighter(); > System.out.println(testColor); java.awt.Color[r=167,g=130,b=104]

18 Georgia Institute of Technology Rounding Errors Notice that when you made the color darker and then lighter the resulting color was slightly off of the original –The change is calculated in floating point –The result is stored in integer form –The decimal part is lost Rounding errors also occur because of the limited storage for floating point numbers –We can’t store all the digits in some numbers

19 Georgia Institute of Technology Pictures are 2-D Arrays They have columns and rows (x and y) You can get a pixel at a particular x and y location –Pixel pixelObj = picture.getPixel(x,y); The columns and rows –start with index 0 – end with num -1 X Y

20 Georgia Institute of Technology Changing a Picture Exercise > import java.awt.Color; > String fileName = "C:/intro-prog-java/mediasources/caterpillar.jpg"; > Picture pictureObj = new Picture(fileName); > pictureObj.show(); > pictureObj.getPixel(10,100).setColor(Color.black); > pictureObj.getPixel(11,100).setColor(Color.black); > pictureObj.getPixel(12,100).setColor(Color.black); > pictureObj.getPixel(13,100).setColor(Color.black); > pictureObj.getPixel(14,100).setColor(Color.black); > pictureObj.getPixel(15,100).setColor(Color.black); > pictureObj.getPixel(16,100).setColor(Color.black); > pictureObj.getPixel(17,100).setColor(Color.black); > pictureObj.getPixel(18,100).setColor(Color.black); > pictureObj.getPixel(19,100).setColor(Color.black); > pictureObj.repaint();

21 Georgia Institute of Technology How do we Know if it Worked? A very important part of programming is testing the result –Just because code compiles and runs without error doesn’t mean it is correct –There could be an error in the logic –It could fail under certain conditions –It could even return the correct answer but for the wrong reason

22 Georgia Institute of Technology The Picture Explorer Tool that creates a copy of the current picture and lets you explore it –See the color, x, and y values at the cursor To use the tool on a picture object –pictureObj.explore(); Use it to see if the colors have changed

23 Georgia Institute of Technology Changing the Red in a Picture One way to change a picture is to reduce the amount of red in it –What if we want to decrease it by half? If we have a value of 200 what should the new value be? How do we reduce any value by half? –What if we want to increase it by 25%? If we have a value of 100 what should the new value be? How do we increase any value by 25%?

24 Georgia Institute of Technology Changing all the Pixels in a Picture There are 329 * 150 = 49,350 pixels in the caterpillar picture Do we really want to write the code to change each one of these? –Get the current pixel –Get the red value of the current pixel –Change the red value of the current pixel to half the original value (value / 2) –Put the new red value in the current pixel

25 Georgia Institute of Technology We Need a Loop (Iteration) A way to execute a series of statements –With something changing each time the statements are executed Different index of the pixel to change –And some way to tell when we are done with the repetition Some test to see if the loop should stop

26 Georgia Institute of Technology Loop Exercise Ask a person to clap 12 times –How does s/he know when to stop? –What changes each time s/he claps? If you are following a recipe that asks you to stir the ingredients 50 times how would you do this? What if you were trying to break a sit-up record –How would you know if you did break it?

27 Georgia Institute of Technology Loops often need Counters If you want to do something x times you often need a counter –That starts at 0 –And you add 1 to it each time you finish doing the thing you are repeating –When the counter reaches the number you are trying to do you stop the loop What is the value of the counter the last time the statements of the loop are executed?

28 Georgia Institute of Technology While Loops In Java one way to repeat a block of statements while an expression is true is to use a while loop Create a counter and set it to the start value Check that the counter is less then the stop value If it is less than execute the statements in the loop Add one to the counter and go back to check that the counter is less than the stop value

29 Georgia Institute of Technology Total the Numbers from 1 to 100 What if you want to add all the numbers from 1 to 100? –You will need something to hold the total What type should it be? What value should it start out with? –You will need something that counts from 1 to 100 And add that value to the total Stop when you get to 100 What type should it be? What value should it start with?

30 Georgia Institute of Technology While Loop Syntax Adding up the numbers from 1 to 100 int total = 0; int counter = 1; while (counter <= 100) { total = total + counter; counter = counter + 1; } System.out.println(total);

31 Georgia Institute of Technology Decrease Red Algorithm To decrease the red value in a picture by 50% 1.Get the array of pixels from the picture 2.Set up an index to start at 0 3.Check if the index is less than the length of the array 1.If it is go on to step 4 of the loop 2.If it isn’t jump to the first instruction after the loop 4.Get the pixel at the current index from the array of pixels 5.Get the red value at the pixel 6.Divide the red value by 2 7.Set the red value at the pixel to the reduced red value 8.Increment the index and go back to step 3

32 Georgia Institute of Technology What is an Algorithm? An algorithm is a description of the steps needed to do a task –Can be written in English –A recipe is an algorithm A program is an implementation of an algorithm –in a particular computer language

33 Georgia Institute of Technology From Algorithm to Program (code) How do we get the array of pixels from the current picture object? –We have used Pixel[] pixelArray = picture.getPixels(); –But we want to get the array of pixels from the current object So we can use the keyword this Pixel[] pixelArray = this.getPixels(); –Or we can leave off the this Pixel[] pixelArray = getPixels();

34 Georgia Institute of Technology Loop Algorithm to Code How to write (code) the loop? –Use a while loop with a counter for the index starting at 0 int index = 0; –Loop while the index is less than the length of the array while (index < pixelArray.length) –Get the current pixel from the array of pixels for the current index Pixel pixelObj = pixelArray[index];

35 Georgia Institute of Technology Loop Algorithm to Code - Continued –Get the red value at the pixel int value = pixelObj.getRed(); –Divide the red value by 2 value = value / 2; –Set the pixel red value pixel.setRed(value); –Add one to (increment) the index index = index + 1;

36 Georgia Institute of Technology Decrease Red Method public void decreaseRed() { Pixel[] pixelArray = this.getPixels(); Pixel pixelObj = null; int index = 0; // loop through all the pixels while(index < pixelArray.length) { // get the current pixel pixelObj = pixelArray[index]; // get the red value int value = pixelObj.getRed(); // decrease the red value value = value / 2; // set the pixel red pixelObj.setRed(value); // increment the index index = index + 1; }

37 Georgia Institute of Technology Comments Comments are explanations of your code to help people understand your code –They are ignored by the compiler There are several kinds in Java // a comment that lasts to the end of the line /* a comment that can take up several lines until a */ /** a Javadoc comment that is used to create html documentation of your code */

38 Georgia Institute of Technology Using Multiplication by 0.5 You could have also multiplied the red value by 0.5 –value = value * 0.5; Change the line that divided by 2 and try to compile this –In the decreaseRed method

39 Georgia Institute of Technology Loss of Precision If you try the code on the previous slide you will get a compiler error –Possible loss of precision It is complaining about putting a double value into a int variable –Loss of fractional part

40 Georgia Institute of Technology Casting to Solve Loss of Precision Error It will compile if we tell the compiler we know about the possible loss of precision –And that it is intended By using a cast to int value = (int) (value * 0.5); Notice that we cast the result of the multiplication back to an integer Casting is forcing a value into a type (type) expression

41 Georgia Institute of Technology Move Declarations Outside Loops When you need a variable in a loop it is best to declare it before the loop –Otherwise you are declaring a new variable each time through the loop Which is slower than just changing the value associated with the variable In some languages you must declare all variables at the beginning of a method (function) In Java you can declare variables anywhere in a method –As long as you declare them before you use them

42 Georgia Institute of Technology Shortcuts for Common Operations In programming you often need to add one to a value index = index + 1; You may use the shortcut index++; or ++index; If you wanted to subtract 1 instead index = index – 1; index--; or -- index;

43 Georgia Institute of Technology Decrease Red Method Version 2 /** * Method to decrease the red * by 50% in a picture */ public void decreaseRed() { Pixel[] pixelArray = this.getPixels(); Pixel pixelObj = null; int index = 0; int value = 0; // loop through all the pixels while(index < pixelArray.length) { // get the current pixel pixelObj = pixelArray[index]; // get the red value value = pixelObj.getRed(); // decrease the red value value = (int) (value * 0.5); // set the pixel red pixelObj.setRed(value); // increment the index index++; }

44 Georgia Institute of Technology Decrease Red Exercise In DrJava –Add the method decreaseRed() to Picture.java Before the last } which ends the class definition –Compile the method Click the Compile All button –Test it by doing the following in the interactions pane > String fileName = "C:/intro-prog-java/mediasources/caterpillar.jpg"; > Picture picture1 = new Picture(fileName); > picture1.explore(); > picture1.decreaseRed(); > picture1.explore();

45 Georgia Institute of Technology Tracing Code An important skill to develop is the ability to trace code –Also called walking through or stepping through your code –Look at each line and predict what will happen –Show the variables and their values

46 Georgia Institute of Technology Step Through decreaseRed() A picture object was created from the file “caterpillar.jpg” and then was sent the message decreaseRed() The picture object was implicitly passed to the method decreaseRed() and can be referred to by this The array of pixel objects was returned from sending getPixels() to the picture object Pixel[] pixelArray = this.getPixels(); Some variables were declared for later use in the loop Pixel pixelObj = null; int index = 0; int value = 0;

47 Georgia Institute of Technology Step Through decreaseRed() - cont The while loop tests if the index is less than the length of the array while (index < pixelArray.length) { –And if so it executes the statements in the body of the loop {} It sets the variable pixelObj to the pixel at the current index in the array of pixels pixelObj = pixelArray[index]; It gets the red value of that pixel value = pixelObj.getRed(); it sets the value to the integer part of (red value * 0.5) value = (int) (value * 0.5); It sets the pixel’s red to the new value pixelObj.setRed(value); It increments the index value index++;

48 Georgia Institute of Technology Memory Map of decreaseRed() What does memory look like the first time through the loop? How about the 2 nd time through? How about the 3 rd time through? How about the last time through? this pixels R=252, G=254, B=251, X=0, Y=0 R=253, G=255, B=254, X=1, Y=0 R=254, G=254, B=254, X=2, Y=0 pixel value = 252 index = 0 … width=329 height=150 Picture: Class getPixels() … Pixel: Class getRed() setRed()…

49 Georgia Institute of Technology Increase Red What if you want to increase red by 30% –How would you do that? Multiplying by 0.5 reduces the red by 50% –Multiplying by 1.0 would keep the same red value –Multiplying by 1.3 would increase the red by 30% –Multiplying by 1.7 would increase the red by 70%

50 Georgia Institute of Technology Increase Red Algorithm To increase the red value in a picture by 30% 1.Get the array of pixels from the picture 2.Set up an index to start at 0 3.Check if the index is less than the length of the array 1.If it is go on to step 4 of the loop 2.If it isn’t jump to the first instruction after the loop 4.Get the pixel at the current index from the array of pixels 5.Get the red value at the pixel 6.Multiply the red value by 1.3 7.Set the red value at the pixel to the reduced red value 8.Increment the index and go back to step 3

51 Georgia Institute of Technology Increase Red: Algorithm to Code The algorithm for this method is very similar to the algorithm for decrease red –Start with the code for decreaseRed –Change the line of code that multiplied the current red value by 0.5 to 1.3 –Change the name of the method –Change any comments that need changing

52 Georgia Institute of Technology increaseRed Method /** * Method to increase the red by 30% */ public void increaseRed() { Pixel[] pixelArray = this.getPixels(); Pixel pixelObj = null; int value = 0; int index = 0; // loop through all the pixels while (index < pixelArray.length) { // get the current pixel pixelObj = pixelArray[index]; // get the value value = pixelObj.getRed(); // increase value value = (int) (value * 1.3); // set the red value pixelObj.setRed(value); // increment the index index++; }

53 Georgia Institute of Technology Testing increaseRed Underwater pictures look too blue –The water filters out most of the red color To test increase red: –String file = “c:/intro-prog-java/mediasources/water.jpg”; –Picture p = new Picture(file); –p.explore(); –p.increaseRed(); –p.explore();

54 Georgia Institute of Technology Clear the Blue Values What if you want to clear the blue from a picture? –Set all the blue values to 0 for all the pixels The algorithm is similar to decreaseRed() and increaseRed() except –You don’t need to get the value out for blue and multiply it by some value and then set the blue value –Just set the blue value to 0

55 Georgia Institute of Technology Clear Blue Exercise In Picture.java Write the method –public void clearBlue() That sets the blue value to 0 for all pixels in a picture Test with: String fileName = “c:/intro-prog- java/mediasources/caterpillar.jpg”; Picture p = new Picture(fileName); p.explore(); p.clearBlue(); p.explore();

56 Georgia Institute of Technology Faking a Sunset If you want to make an outdoor scene look like it happened during sunset –You might want to increase the red But you can’t increase past 255 –Another idea is to reduce the blue and green To emphasize the red Try to reduce the blue and green by 30%

57 Georgia Institute of Technology Faking a Sunset Algorithm Reduce the blue and green by 30% 1.Get the array of pixels from the picture 2.Set up an index to start at 0 3.Check if the index is less than the length of the array 1.If it is go on to step 4 of the loop 2.If it isn’t jump to the first instruction after the loop 4.Get the pixel at the current index from the array of pixels 5.Set the blue value at the pixel to 0.7 times the original value 6.Set the green value at the pixel to 0.7 times the original value 7.Increment the index and go back to step 3

58 Georgia Institute of Technology Faking a Sunset Method /** * Method to simulate a sunset by * decreasing the green * and blue */ public void makeSunset() { Pixel[] pixelArray = this.getPixels(); Pixel pixelObj = null; int value = 0; int i = 0; // loop through all the pixels while (i < pixelArray.length) { // get the current pixel pixelObj = pixelArray[i]; // change the blue value value = pixelObj.getBlue(); pixelObj.setBlue((int) (value * 0.7)); // change the green value value = pixelObj.getGreen(); pixelObj.setGreen((int) (value * 0.7)); // increment the index i++; }

59 Georgia Institute of Technology Testing makeSunset String file = “c:/intro-prog-java/mediasources/beach.jpg”; Picture pictureObj = new Picture(file); pictureObj.explore(); pictureObj.makeSunset(); pictureObj.explore();

60 Georgia Institute of Technology For Loops Programmers like shortcuts –Especially those that reduce errors –And mean less typing We have been using a while loop with an index –We had to declare the index variable and initialize it before the loop If you forget this there will be a compiler error –We had to increment the index in the loop If you forget this it will be an infinite loop The shortcut for this is a For Loop

61 Georgia Institute of Technology For Loop Syntax for (initialization area; continuation test; change area) –Initialization area Declare variables and initialize them –Continuation test If true do body of loop If false jump to next statement after the loop –Change area Change the loop variables –Increment or decrement them

62 Georgia Institute of Technology Comparison of While and For Loops int index = 0; while (index < pixelArray.length) { statements. index++; } for (int i=0; i < pixelArray.length; i++) { statements. }

63 Georgia Institute of Technology Change clearBlue() to use a For Loop /** * Method to clear the blue (set * the blue to 0 for all pixels) */ public void clearBlue() { Pixel pixelObj = null; // get the array of pixels Pixel[] pixelArray = this.getPixels(); // loop through all the pixels for (int i = 0; i < pixelArray.length; i++) { // get the current pixel pixelObj = pixelArray[i]; // set the blue on the pixel to 0 pixelObj.setBlue(0); } }

64 Georgia Institute of Technology Using System.out.println() in a Loop One way to check what is happening in your program is to add –System.out.println(expression); You might add this to the loop to check the value of ‘i’ during it. –And to verify that the increment happens after the last statement in the loop

65 Georgia Institute of Technology Change to For Loop Exercise Edit makeSunset() and change it from using a while loop to using a for loop –Move the declaration of the index to the for loop initialization area –Move the index increment to the for loop change area –Execute the code to make sure it still works

66 Georgia Institute of Technology Negating an Image How would you turn a picture into a negative? –White should become black 255,255,255 becomes 0,0,0 –Black should become white 0,0,0 becomes 255,255,255

67 Georgia Institute of Technology Negate Algorithm Subtract current value from 255 for red, green, and blue 1.Get the array of pixels from the picture 2.Loop starting an index at 0 and incrementing by 1 3.Check if the index is less than the length of the array 1.If it is go on to step 4 of the loop 2.If it isn’t jump to the first instruction after the loop 4.Get the pixel at the current index from the array of pixels 5.Set the red value to 255 – current red value 6.Set the blue value to 255 – current blue value 7.Set the green value to 255 – current green value 8.Increment the index and go back to step 3

68 Georgia Institute of Technology Negate Method /** * Method to negate the picture */ public void negate() { Pixel[] pixelArray = this.getPixels(); Pixel pixelObj = null; int redValue, blueValue, greenValue = 0; // loop through all the pixels for (int i = 0; i < pixelArray.length; i++) { // get the current pixel pixelObj = pixelArray[i]; // get the values redValue = pixelObj.getRed(); greenValue = pixelObj.getGreen(); blueValue = pixelObj.getBlue(); // set the pixel's color pixelObj.setColor( new Color(255 - redValue, 255 - greenValue, 255 - blueValue)); }

69 Georgia Institute of Technology Changing to Grayscale Grayscale ranges from black to white –The red, green, and blue values are the same How can we change any color to gray? –What number can we use for all three values? The intensity of the color –We can average the colors (red + green + blue) / 3 –Example (15 + 25 + 230) / 3 = 90

70 Georgia Institute of Technology Grayscale Algorithm Set color values to the average of the original values 1.Get the array of pixels from the picture 2.Loop starting an index at 0 3.Check if the index is less than the length of the array 1.If it is go on to step 4 of the loop 2.If it isn’t jump to the first instruction after the loop 4.Get the pixel at the current index from the array of pixels 5.Calculate the average of the current values 1.(redValue + greenValue + blueValue )/ 3 6.Set the red value to the average 7.Set the blue value to the average 8.Set the green value to the average 9.Increment the index and go to step 3

71 Georgia Institute of Technology Grayscale Method /** * Method to change the picture to gray scale */ public void grayscale() { Pixel[] pixelArray = this.getPixels(); Pixel pixelObj = null; int intensity = 0; // loop through all the pixels for (int i = 0; i < pixelArray.length; i++) { // get the current pixel pixelObj = pixelArray[i]; // compute the average intensity intensity = (pixelObj.getRed() + pixelObj.getGreen() + pixelObj.getBlue()) / 3; // set the pixel color pixelObj.setColor(new Color(intensity,intensity,intensity)); }

72 Georgia Institute of Technology Testing Grayscale String file = “c:/intro-prog-java/mediasources/caterpillar.jpg”; Picture pictureObj = new Picture(file); pictureObj.explore(); pictureObj.grayscale(); pictureObj.explore();

73 Georgia Institute of Technology Grayscale Result

74 Georgia Institute of Technology Luminance We perceive blue to be darker than red, and green –Even when the same amount of light is reflected A better grayscale model should take this into account –Weight green the highest (* 0.587) –red less (* 0.299) and –blue the very least (* 0.114)

75 Georgia Institute of Technology Grayscale with Luminance Exercise Create a new method grayscaleWithLuminance Using the new algorithm for calculating intensity intensity = (int) (red * 0.299 + green * 0.587 + blue * 0.114)

76 Georgia Institute of Technology Testing Grayscale with Luminance String file = “c:/intro-prog-java/mediasources/caterpillar.jpg”; Picture pictureObj = new Picture(file); pictureObj.explore(); pictureObj. grayscaleWithLuminance (); pictureObj.explore();

77 Georgia Institute of Technology Summary Pictures have pixels –You can change the picture by changing the color of the pixels –You will need to repaint the picture Arrays let you store and retrieve values of the same type using an index You will need to import classes that you wish to use that aren’t in java.lang Loops allow you to execute a block of statements zero to many times


Download ppt "Georgia Institute of Technology Manipulating Pictures, Arrays, and Loops Barb Ericson Georgia Institute of Technology August 2005."

Similar presentations


Ads by Google