CLASS 15
Function
Package
%include
include
GD
%include "/include/gd.sn";
package draw;
function circle(x,y,r)
im=gd_new(width:1000,height:1000,bgcolor:White,truecolor:true);
red = gd_get_color(gd:im, color:Red);
cyan = gd_get_color(gd:im, color:Cyan);
white = gd_get_color(gd:im, color:White);
gd_ellipse(gd:im, cx:x,cy:y, width:r, color:"#0000ff", height:r);
img = gd_write(gd:im,base64: true, format:"jpg",quality:100);
gd_free(im);
return img;
endf
function circle10()
im=gd_new(width:1000,height:1000,bgcolor:White,truecolor:true);
for(i=1; i<=10; ++i) do
c1 = random(min:0,max:255);
c2 = random(min:0,max:255);
c2 = random(min:0,max:255);
c = printf("#%02x%02x%02x", c1, c2, c3);
r = random(min:100,max:200);
x = random(min:0,max:1000);
y = random(min:0,max:1000);
gd_ellipse(gd:im, cx:x,cy:y, width:r, color:c, height:r);
void gd_print(gd:im,x:x,y:y,color: '#000000', str:"Color: " .+ c .+ "\nx=" .+ x .+ "\ny=" .+ y);
endfor
img = gd_write(gd:im,base64: true, format:"jpg",quality:100);
gd_free(im);
return img;
endf
endp