0% found this document useful (0 votes)
49 views4 pages

Raport: Tema: Sintezarea Figurilor Grafice

The document is a lab report in Romanian on synthesizing graphic figures in C++. It includes the topic, purpose, and code to draw various shapes like lines, rectangles, triangles, polygons, circles, ellipses, and save/load the image. The code uses graphics functions to draw the shapes with lines and fills, and write/read pixels to/from an image file.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views4 pages

Raport: Tema: Sintezarea Figurilor Grafice

The document is a lab report in Romanian on synthesizing graphic figures in C++. It includes the topic, purpose, and code to draw various shapes like lines, rectangles, triangles, polygons, circles, ellipses, and save/load the image. The code uses graphics functions to draw the shapes with lines and fills, and write/read pixels to/from an image file.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Raport

LUCRARE DE LABORATOR NR. 1


LA DISCIPLINA „Grafica pe calculator’’

Tema: SINTEZAREA FIGURILOR GRAFICE

A efectuat: st. gr. C-162 Gangan Eugeniu


A verificat: pr.univ. Plotnic Constantin

Chişinău 2018
Tema: SINTEZAREA FIGURILOR GRAFICE
Scopul lucrării: Obţinerea cunoştinţelor practice în sinteza figurilor
grafice
Varianta 6
#include <graphics.h>
#include <stdio.h>
#include <conio.h>
#include <fstream>
#include <iostream>
using namespace std;
void salvare(){
int i,j;
ofstream f;
f.open("image.jpg",ios::out);
for(i=0;i<1280;i++)
for(j=0;j<800;j++)
f<<
getpixel(i,j)<<" ";
f.close();
}
void citire(){
int i,j;
unsigned int p;
ifstream r;
r.open("image.jpg",ios::in);
for(i=0;i<1280;i++)
for(j=0;j<800;j++){
r>>p;
putpixel(i,j,p);
}
r.close();
}
int main()
{
int gd = DETECT;
int gm;
initgraph(&gd, &gm, "");

line(100,100,700,100);
line(100,300,700,300);
line(100,500,700,500);
line(100,700,700,700);

line(100,100,100,700);
line(300,100,300,700);
line(500,100,500,700);
line(700,100,700,700);
setcolor(WHITE);//paralelipiped
bar3d(120,280,240,150,40,1);
setfillstyle(2,GREEN);
floodfill(125,279,WHITE);
setcolor(BLUE);//triunghi
setfillstyle(1,BLUE);
int a[6]={320,280,480,280,400,120};
fillpoly(3,a);
setcolor(WHITE);//poligon cu 10 laturi
setfillstyle(1,BLACK);
int
b[20]={560,120,640,120,670,160,680,200,670,240,640,280,560,280,530,240,520,210,530,160};
fillpoly(10,b);
setcolor(WHITE);//cerc
circle(200,400,50);
setfillstyle(1,RED);
floodfill(200,400,WHITE);
setcolor(BROWN);//semi-cerc
setfillstyle(1,BROWN);
pieslice(400,400,0,180,50);
setcolor(WHITE);//dreptunghi
setfillstyle(1,BLACK);
int c[8]={580,320,640,320,640,480,580,480};
fillpoly(4,c);
setcolor(WHITE);//elipsa
ellipse(200,600,0,360,80,40);
setfillstyle(1,GREEN);
floodfill(200,600,WHITE);
setcolor(WHITE);//semi-elipsa
ellipse(400,600,360,181,80,40);
line(320,600,480,600);
setfillstyle(1,RED);
floodfill(400,595,WHITE);
setcolor(WHITE);//Linie
line(520,600,680,600);
getch();
salvare();
cleardevice();
citire();
getch();
closegraph();
return 0;
}

You might also like