mac14

elementi di sintassi per grafica e listati semplici programmi per disegnare


/* gra1 su marino86 */
ese:-
/* lines([(Y1,X1),(Y2,X2)])        traccia linea */
/* box(Y,X,altezza,larghezza)  traccia cornice */
/* circle(Y,X,raggio)                traccia cerchio */
/* fillcircle(Y,X,raggio)           traccia disco pieno */
/* assegnare colore con PENCOL...spessore con DOUBLE */
/* arrow..disegna una freccia */
grafix,
add_pic(pencol(red,lines([(6,6),(50,80)]))),
add_pic(pencol(blue,lines([(50,80),(6,200)]))),
add_pic(pencol(green,box(100,50,80,200))),
add_pic(pencol(yellow,circle(200,200,50))),
add_pic(fillcircle(120,120,60)),
add_pic(pencol(red,fillcircle(150,150,60))),
add_pic(pencol(blue,double(circle(80,80,80)))),
add_pic(pencol(blue,circle(100,100,100))),
add_pic(pencol(red,arrow())).

/* gra2 su marino86 */
/* per MOD scrivere due interi:altezza,larghezza */
/* fillbox(Y,X,altezza,larghezza)   quadrilatero pieno o vuoto  BOX */
/* filloval(Y,X,altezza,larghezza)  ovale pieno o vuoto OVAL */
/* fillbox(Y,X,altezza,larghezza,smussaturaY,smussaturaX) smussato*/
/* arc(Y,X,altezza,larghezza,angoloinizio,angolofine) traccia ARCO */
ese:-
grafix,
add_pic(pencol(red,box(60,80,120,120))),
add_pic(pencol(red,fillbox(0,0,60,60))),
add_pic(pencol(blue,oval(100,100,60,120))),
add_pic(pencol(blue,filloval(100,100,120,60))),
add_pic(pencol(green,box(120,120,200,200,20,20))),
add_pic(pencol(green,fillbox(120,120,140,140,30,40))),
add_pic(pencol(black,arc(30,30,90,220,0,270))),
add_pic(pencol(green,arc(60,60,100,200,90,270))).

/* gra4 su marino86 */
/* PENSIZE(intero,intero)  spessore verticale,orizzontale */
/* con colore penna  PENCOL e tipo pattern  PENPATTERN */
/* pencol(colore)......penpatern(tipo tratteggio)  */
ese:-
grafix,
add_pic(penpattern(diamonds,pensize(10,10,box(50,50,50,50)))),
add_pic(pencol(red,pensize(10,10,box(150,50,50,50)))),
add_pic(penpattern(horiz,pencol(green,pensize(30,30,box(150,150,100,150))))).


/* gra6 su marino86 */
/* tipi di pattern o tratteggi per righe e sfondi */
/* penpattern(tipo)   tratteggio per cornice */
/* fillpattern(tipo)   tratteggio per interno */
/* pencol(colore)      colore per cornice e interno */
ese:-
grafix,
add_pic(penpattern(alpha,pensize(10,10,
fillpattern(diag,fillbox(50,50,50,50))))),
add_pic(penpattern(alpha,pensize(10,10,
fillpattern(horiz,fillbox(50,150,50,50))))),
add_pic(penpattern(alpha,pensize(10,10,
fillpattern(brick,fillbox(50,250,50,50))))),
add_pic(penpattern(alpha,pensize(10,10,
fillpattern(rdiag,fillbox(50,350,50,50))))),
add_pic(pencol(red,penpattern(alpha,pensize(10,10,
fillpattern(diag,fillbox(150,50,50,50)))))).

/* gra8 su marino86 */
/* fillmode(modalita) per penna */
ese:-
grafix,
add_pic(pencol(red,fillbox(10,10,300,400))),
add_pic(pensize(10,10,fillmode(or,fillbox(50,50,50,50)))),
add_pic(pensize(10,10,fillmode(xor,fillbox(80,150,50,50)))),
add_pic(pensize(10,10,fillmode(erase,fillbox(100,250,50,50)))),
add_pic(pensize(10,10,fillmode(nor,fillbox(130,350,50,50)))),
add_pic(penzize(10,10,fillmode(nxor,fillbox(200,50,50,50)))),
add_pic(pensize(10,10,fillmode(nerase,fillbox(200,150,50,50)))),
add_pic(pensize(10,10,fillmode(paint,fillbox(200,250,50,50)))),
add_pic(pensize(10,10,fillmode(npaint,fillbox(200,350,50,50)))).

 /* gra9 su marino86 */
/* penmode(modalita)  penmode(modalita)  per penna */
ese:-
grafix,
add_pic(pencol(blue,fillbox(10,10,300,400))),
add_pic(pensize(10,10,penmode(or,box(50,50,50,50)))),
add_pic(pensize(10,10,penmode(xor,box(80,150,50,50)))),
add_pic(pensize(10,10,penmode(erase,box(100,250,50,50)))),
add_pic(pensize(10,10,penmode(nor,box(130,350,50,50)))),
add_pic(penzize(10,10,penmode(nxor,box(200,50,50,50)))),
add_pic(pensize(10,10,penmode(nerase,box(200,150,50,50)))),
add_pic(pensize(10,10,penmode(paint,box(200,250,50,50)))),
add_pic(pensize(10,10,penmode(npaint,box(200,350,50,50)))).

/* gra10 su marino86 */
/* tipi di penna per disegnare */
/* solidpen...hashpen...thinpen....nilpen..*/
ese:-
grafix,
add_pic(hashpen(box(50,50,100,100))),
add_pic(solidpen(box(50,150,100,100))),
add_pic(pensize(10,10,hashpen(box(150,50,100,100)))),
add_pic(pensize(10,10,solidpen(box(150,150,100,100)))),
add_pic(pencol(red,pensize(10,10,hashpen(box(150,250,100,100))))),
add_pic(nilpen(box(150,350,100,100))),
add_pic(thinpen,box(250,50,100,100)).




/* gra11 su marino86 */
ese:-
grafix,
add_pic(pensize(10,10,penfg(red,penbg(blue,fillfg(yellow,fillbg(green,
fillbox(50,50,250,250))))))).


/* gra12 su marino86 */
/* disegna arco pieno indicando coordinate centro Y,X */
/* altezza e larghezza,inizio e fine angolo */
/* WEDGE invece di ARC */
ese:-
grafix,
add_pic(arc(100,100,100,100,0,180)),
add_pic(wedge(200,100,100,100,0,180)),
add_pic(pencol(red,wedge(100,200,100,100,0,180))).


/* gra13 su marino86 */
/* disegna poligono indicando coordinate vertici */
/* disegna poligono pieno FILLPOLY o  vuoto POLY  */
ese:-
grafix,
add_pic(poly([(10,10),(100,10),(100,100),(10,10)])),
add_pic(pencol(red,pensize(10,5,
poly([(50,50),(100,50),(100,100),(50,150),(50,50)])))),
add_pic(fillpoly([(200,200),(200,300),(250,300),(200,200)])).