The function copyHorseLarger didn’t really work when we copied the pixel twice. What if we copied it four times? Does that look better?
What will be an ideal response?
No it does not look better, since the picture ends up looking with part of it across the rest.
```
def copyHorseLarger2 ():
# Set up the source and target pictures
src = makePicture("horse.jpg")
w = getWidth(src)
h = getHeight(src)
canvas = makeEmptyPicture(w*2,h*2)
srcPixels = getPixels(src)
trgPixels = getPixels(canvas)
trgIndex = 0
#Now, do the actual copying
for pixel in srcPixels:
color = getColor(pixel)
# Once
trgPixel = trgPixels[trgIndex]
setColor(trgPixel ,color)
trgIndex = trgIndex + 1
# Twice
trgPixel = trgPixels[trgIndex]
setColor(trgPixel ,color)
trgIndex = trgIndex + 1
# Thrice
trgPixel = trgPixels[trgIndex]
setColor(trgPixel ,color)
trgIndex = trgIndex + 1
# Four
trgPixel = trgPixels[trgIndex]
setColor(trgPixel ,color)
trgIndex = trgIndex + 1
show(canvas)
return canvas
```
You might also like to view...
Shorter, simpler handlers are easier to debug and maintain.
Answer the following statement true (T) or false (F)
What color combinations work well for text and background? Which ones should you avoid?
What will be an ideal response?
Gaming PCs need all the following except _______
a. High-end video/Specialized GPU b. Power processor c. Better sound card d. None of the above
Sketch the graph of the following quadratic function using a graphing calculator. State whether the function has a maximum or a minimum. Determine the maximum or minimum value to the nearest tenth. Determine the roots of the quadratic function to the nearest tenth.
What will be an ideal response?