Draw a rainbow—use what you know about colors, pixels, and drawing operations to draw a rainbow. Is this easier to do with our drawing functions or by manipulating individual pixels? Why?

Without knowing about the addOvalFilled function by checking through the JES helper functions, this problem is much more difficult, as below:


```

def drawRainbow():

canvas = makeEmptyPicture(21,20)



makeArc(canvas,7, 7, red)

makeArc(canvas,7, 8, orange)

makeArc(canvas,7, 9, yellow)

makeArc(canvas,7, 10, green)

makeArc(canvas,7, 11, blue)

makeArc(canvas,7, 12, makeColor(255,0,255))



show(canvas)

return canvas;



def makeArc(src, x, y, color):

setColor(getPixel(src,(x),y),color)

setColor(getPixel(src,(x+1),y-1),color)

setColor(getPixel(src,(x+2),y-2),color)

setColor(getPixel(src,(x+3),y-2),color)

setColor(getPixel(src,(x+4),y-2),color)

setColor(getPixel(src,(x+5),y-1),color)

setColor(getPixel(src,(x+6),y),color)

```



Computer Science & Information Technology

You might also like to view...

What creates new objects?

What will be an ideal response?

Computer Science & Information Technology

When the ________ option is selected, the video will repeat until the presenter moves to the next slide

A) Loop until Stopped B) Fade In C) Start/Automatically D) Rewind after Playing

Computer Science & Information Technology

To check the spelling in a worksheet, click the Review tab on the Ribbon, and then, in the ____ group, click the Spelling button.

A. Editing B. Proofing C. Checking D. Searching

Computer Science & Information Technology

You can edit data directly in a PivotTable.

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

Computer Science & Information Technology