lec07-ReturningValuesFromFunctions-after.pdf

A pixel pixel int b pixel array pixel int c pixel

Info icon This preview shows pages 31–40. Sign up to view the full content.

View Full Document Right Arrow Icon
A. Pixel, Pixel, int B. Pixel array, Pixel, int C. Pixel array, Pixel, double D. Pixel, double, int (Which of these store references?)
Image of page 31

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Memory Model Practice Draw the memory model for the following code 1) Solo: (2 min) 2) Discuss: (2 min) int value = 0; Pixel[] pixArray = this.getPixels(); int index = 0; Pixel p1 = pixArray[0]; value = p1.getRed(); value = (int) (value * .5); p1.setRed(value); How does it change with: this
Image of page 32
Pixel arrays and pixels in Pictures How do the two relate to each other…? Picture pic = new Picture(“mypic.jpg”); Pixel[] pixArray = pic.getPixels(); 0 1 2 3 (x) 0 1 2 (y) 0 1 2 3 4 5 6 7 8 9 10 11 (index) pic pixArray Width 4 Height 3 Length 12
Image of page 33

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon