Bueno, quiero mis karmas tambien ;D, aqui pongo uno que hace lineas (algoritmo bresenham) y tambien triangulos usando el put_pixel. No he probado el tuyo, así que probad el mio y comprobad si tiene mas rendimineto, le dais al space para generar líneas.
PROGRAM bresenham_lines;
PRIVATE
x0,y0;
colour;
BEGIN
set_mode(320, 240, 8);
repeat
if(key(_space))
x=rand(0,320);
y=rand(0,200);
x0=rand(0,320);
y0=rand(0,200);
colour=rand(0,255);
draw_lines(x,y,x0,y0,colour);
end
frame;
until(key(_esc));
END
PROCESS draw_lines(xp,yp,xq,yq,colour)
PRIVATE
D=0;
dx,dy,c,M,xinc=1,yinc=1;
BEGIN
x=xp;
y=yp;
dx=xq-xp;
dy=yq-yp;
if(dx<0) xinc=-1; dx=-dx; end
if(dy<0) yinc=-1; dy=-dy; end
if(dy < dx)
c=2*dx; M=2*dy;
while(x!=xq)
put_pixel(x,y,colour);
x+=xinc; D+=M;
if(D>dx) y+=yinc; D-=c; end
end
else
c=2*dy; M=2*dx;
while(y!=yq)
put_pixel(x,y,colour);
y+=yinc; D+=M;
if(D>dy) x+=xinc; D-=c; end
end
end
put_pixel(xq,yq,colour);
END
PROCESS draw_box(x,y,x0,y0,colour)
BEGIN
draw_lines(x,y,x+x0,y,colour);
draw_lines(x,y,x,y+y0,colour);
draw_lines(x,y+y0,x+x0,y+y0,colour);
draw_lines(x+x0,y,x+x0,y+y0,colour);
end
PROCESS draw_triangle(x,y,x0,y0,x1,y1,colour)
BEGIN
draw_lines(x,y,x0,y0,colour);
draw_lines(x0,y0,x1,y1,colour);
draw_lines(x1,y1,x,y,colour);
END
EDIT: corregido, splintergu