Write a general scaleUp function that takes in any picture and creates and returns a new picture twice as big using makeEmptyPicture(width,height).

What will be an ideal response?


```
def scaleUp (src):
w = getWidth(src)
h = getHeight(src)
canvas = makeEmptyPicture(w*2,h*2)
sourceX = 0.0
for targetX in range(0, w*2):
sourceY = 0.0
for targetY in range(0,h*2):
px = getPixel(src,int(sourceX),int(sourceY))
color = getColor(px)
setColor(getPixel(canvas ,int(targetX) ,int(targetY)), color)
sourceY = sourceY + 0.5
sourceX = sourceX + 0.5
return canvas
```

Computer Science & Information Technology

You might also like to view...

Concatenating with Strings is done with:

a) reserved words. b) method calls. c) operator overloading. d) operator overloading and method calls.

Computer Science & Information Technology

The ListIterator method that replaces an existing element with a new element is

A) set B) replace C) overwrite D) add

Computer Science & Information Technology

Indexes are created and used to decrease performance

Indicate whether the statement is true or false

Computer Science & Information Technology

A bitmap graphic is composed of a grid of tiny rectangular cells.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology