Extras din laborator
Scopul lucrării: Obţinerea cunoştinţelor practice în sinteza figurilor grafice
Listingul
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <alloc.h>
int main(void)
{
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
int xmax,ymax;
/* initialize graphics and local variables */
initgraph(&gdriver, &gmode, "D:pentru~1tcbgi");
/* read result of initialization */
errorcode = graphresult();
/* an error occurred */
if (errorcode != grOk)
{
printf("Graphics error: %sn", grapherrormsg(errorcode));
printf("Press any key to halt:");
getch();
exit(1);
}
setcolor(getmaxcolor());
xmax = getmaxx();
ymax = getmaxy();
/* draw a diagonal line */
rectangle(0,0,635,475);
line(213,0 ,213,475);
line(426,0,426,475);
line(0,160,635,160);
line(0,320,635,320);
//figura paralelipiped
bar3d(530-50, 90-50, 490+50,100+50, 10, 5);
//figura dreptunghi
setcolor(YELLOW);
setfillstyle(1,YELLOW);
rectangle(30,30,180,120);
floodfill(179,119,YELLOW);
//figure line
setcolor(RED);
line(225,80,400,80);
//figura cerc
setcolor(BLUE);
setfillstyle(1,BLUE);
circle(530,240 ,60);
floodfill(539,239,BLUE);
//figura triunghi
setcolor(GREEN);
setfillstyle(1,GREEN);
line(520,350,450,460);
line(520,350,590,460);
line(450,460,590,460);
//figura elipsa
setcolor(WHITE);
ellipse(100, 400,360,0,60,40);
//figura sector de elipsa
setcolor(CYAN);
setfillstyle(1,CYAN);
sector(300,440, 112, 10, 90,60 );
floodfill(299,439,CYAN);
//figura sector de cerc
setcolor(LIGHTRED);
setfillstyle(1,LIGHTRED);
sector(300, 280, 130, 50, 90, 90);
floodfill(299,279,LIGHTRED);
//figura poligon
setcolor(WHITE);
int poly[24];
poly[0]=30;
poly[1]=240;
poly[2]=30;
poly[3]=240;
poly[4]=70;
poly[5]=200;
poly[6]=120;
poly[7]=200;
poly[8]=120;
poly[9]=200;
poly[10]=155;
poly[11]=240;
poly[12]=155;
poly[13]=240;
poly[14]=120;
poly[15]=290;
poly[16]=120;
poly[17]=290;
poly[18]=70;
poly[19]=290;
poly[20]=65;
poly[21]=290;
poly[22]=30;
poly[23]=240;
drawpoly(12,poly);
char n[8];
char c;
FILE *f;
gets(n);
f=fopen(n,"w");
for(int i=0;i<640;i++)
for(int j=0;j<480;j++)
Preview document
Conținut arhivă zip
- Grafica pe Calculator
- referat 1.doc
- referat 2.doc
- referat 3.doc