`load bitmap "code128_gif_saved_to_png.png" load bitmap "code128.bmp" ink rgb(255,0,0),0 ink rgb(255,0,0),0 xcord = 0 ycord = 2 `quick test of point and getr,getg,getb routines set cursor 0,100 black=1 for i = 1 to 10 print point(xcord,ycord)," ",getr(point(xcord,ycord))," ",getg(point(xcord,ycord))," ",getb(point(xcord,ycord)) inc xcord next i xcord = 0 ycord = 2 unitthickness=2 WHILE getr(point(xcord,ycord))>128 inc xcord endwhile do currentcolor=getr(point(xcord,ycord)) thick = 0 while currentcolor = getr(point(xcord,ycord)) line xcord,ycord+90,xcord,ycord+100 inc thick ` if xcord>165 then print "xcord=",xcord," getr=",getr(point(xcord,ycord)) if thick > 5 then exit if xcord > 320 then exit `this exit only exits the inner while for i = 1 to unitthickness: inc xcord: next i endwhile `print "xcord=",xcord," thick=",thick," color=",currentcolor inc group printc thick if mod(group,6)=0 then printc " ":printc " >" currentcolor = getr(point(xcord,ycord)) if thick > 20 then print "TOO THICK":exit if xcord > 320 then print "XCORD TOO BIG":exit loop `more testing of our getr,getg,getb routines ink rgb(255,128,2),0 dot xcord,ycord print getr(point(xcord,ycord)) print getg(point(xcord,ycord)) print getb(point(xcord,ycord)) end `mod is seriously messy because of conversions... `0.166666*6 gives you less than one, `int conversion truncates function mod(x,y) x# = x y# = y frac# = (x#/y#) - int(x#/y#) `print frac#,modval modval = frac# * y# modval# = frac# * y# modval = modval#+0.00001 `print "frac=",frac#,"y=",y#,"modval=",modval#,modval,int(frac#*y#) endfunction modval function getbyte(x,bytenum) retval=(x & (255*(256^bytenum)))/(256^bytenum) endfunction retval function getb(x) endfunction getbyte(x,0) function getg(x) endfunction getbyte(x,1) function getr(x) endfunction getbyte(x,2)
No comments:
Post a Comment