Bitmap/Bresenham's line algorithm: Difference between revisions

Content added Content deleted
m (→‎{{header|zkl}}: added image)
Line 3,105: Line 3,105:


=={{header|zkl}}==
=={{header|zkl}}==
[[File:Line.zkl.jpg|200px|thumb]]
Algorithm from Wikipedia.
Algorithm from Wikipedia.
<lang zkl>ppm:=PPM(200,200,0xFF|FF|FF);
<lang zkl>ppm:=PPM(200,200,0xFF|FF|FF);
Line 3,112: Line 3,113:
ppm.line(100,10, 50,100, 0);
ppm.line(100,10, 50,100, 0);


ppm.write(File("foo.ppm","wb"));</lang>
ppm.writeJPGFile("line.jpg");</lang>
<lang zkl>class PPM{ // (0,0) is logically bottom left
<lang zkl>class PPM{ // (0,0) is logically bottom left
fcn init(width,height,rgb=0){
fcn init(width,height,rgb=0){
Line 3,179: Line 3,180:
}
}
}</lang>
}</lang>
{{out}}
Image cribbed from BBC BASIC, minus the ">"

[[File:bresenham_bbc.gif]]


{{omit from|PARI/GP}}
{{omit from|PARI/GP}}