Lines and Dots by Mark Garrett29th Jul 2005 6:44
|
---|
Summary Draws a 20 pixel line and 11 dots. Gives a rundown of the rgb values of each pixel. In the left column are seem the resulting line rgb color values of each line pixel. In the right Description Ever wonder why some programs written don't seem to work just right? Like programs dealing with pixels? Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com Rem Project: line and dot experiment Rem Created: 28.7.2005 11:31:54 doagain: cls r1 = rnd(255):g1 = rnd(255):b1 = rnd(255) ink rgb(r1,g1,b1),1 line 50,50,70,50 dot 80,50: dot 85,50: dot 90,50: dot 93,50: dot 100,50 dot 105,50: dot 103,50: dot 200,50: dot 201,50: dot 202,50: dot 203,50 set cursor 10,60 print "original rgb[",r1,",",g1,",",b1,"] " print " " x5 = 49: y5 = 50 ` --------------- print line values -------------------------- for sample = 1 to 20 inc x5 colorval = point(x5,y5) r2=rgbr(colorval) g2=rgbg(colorval) b2=rgbb(colorval) print "line rgb[",r2,",",g2,",",b2,"] ","(",colorval,")", if x5 = 53 then print " " if x5 = 57 then print " " if x5 = 61 then print " " if x5 = 65 then print " " next sample `------------------ do dots ---------------------------- cursory = 60: rem begginning print position a= 80:gosub printdot :a= 90:gosub printdot :a= 93:gosub printdot: a = 100: gosub printdot a= 105:gosub printdot :a= 103:gosub printdot :a= 200:gosub printdot a= 201:gosub printdot :a= 202:gosub printdot :a= 203:gosub printdot cursory = (cursory + 75):set cursor 300,cursory: print "click left mouse button" cursory = (cursory + 15):set cursor 300,cursory: print "for different color" rem dot 85,50: dot 90,50: dot 93,50: dot 100,50 rem dot 105,50: dot 103,50: dot 200,50: dot 201,50 dot 202,50: dot 203,50 do if mouseclick() = 1 then goto doagain loop ` --------------- print dot values ----------------------------- printdot: b = 50: rem y position of dot colorvald = point(a,b) r4=rgbr(colorvald) g4=rgbg(colorvald) b4=rgbb(colorvald) set cursor 300,cursory print "dot rgb[",r4,",",g4,",",b4,"] ","(",colorvald,")", cursory = (cursory + 15) return |