12.07.2015 Views

williams-et-al-1983-apple-ii-computer-graphics

williams-et-al-1983-apple-ii-computer-graphics

williams-et-al-1983-apple-ii-computer-graphics

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

94 APPLE II COMPUTER GRAPHICS50 HGR60 FOR Cl = 1 TO 770 FOH C2 = 1 TO 780 FOR Y = 0 TO SZ STEP 290 HCOLOR = Cl100 HPLOT 0 ,Y TO SZ,Y110 HCOLOR = C2120 HPLOT 0, Y + 1 TO SZ , Y + 1130 NEXT Y140 FOR I = 1 TO DLAY : NEXT I150 NEXT C2160 NEXT Cl170 ENDListing 9-4. Dithering.You should see a rectangle in the upper left corner of the screen whichcontinu<strong>al</strong>ly changes color, and in the process takes on some shades otherthan the basic six. You may change the speed by <strong>al</strong>tering the v<strong>al</strong>ue ofOLAY in line 30, and the size of the rectangle is d<strong>et</strong>ermi ned by the v<strong>al</strong>ueof SZ in line 40.All the program does is plot pairs of horizont<strong>al</strong> lines in two <strong>al</strong>ternatingcolors (C1 and C2), then change one or both colors and do it again. As theroutine cycles, you can see the basic colors-green, blue, viol<strong>et</strong>, orange,black, and white-but <strong>al</strong>so some other colors such as light green and hotpink. The extra colors are generated by two colors blurring tog<strong>et</strong>her toform a mixture, for instance white and green blurring to form light green.There are a great many variations used to produce other shades. Forexample, you might mix the colors orange and black, by <strong>al</strong>ternating themin a checkerboard pattern to produce dark orange, or perhaps by drawinga pure orange line fo llowed by a line which <strong>al</strong>ternates orange and black.The possibil ities are limited only by your imagination.There are a few considerations, however. For instance, if you tried to<strong>al</strong>ternate green and viol<strong>et</strong> dots across the screen, as in the following shortprogram, you would run into severe problems.10 HGR20 Cl = 2: C2 = 130 FOR X = 0 TO 278 STEP 240 HCOLOR = Cl : HPLOT X , Y: REM VIOLET50 GOSUB 10060 HCOLOR = C2 : HPLOT X + 1, Y: REM GREEN70 GOSUB 10080 NEXT X90 END100 FOR I 1 TO 200 : NEXT I: RETURNListing 9-5.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!