0% found this document useful (0 votes)
10 views

Solution CGA - Worksheet - Practical - 1

Bwnsbsdm.ss

Uploaded by

shravaniadsul
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)
10 views

Solution CGA - Worksheet - Practical - 1

Bwnsbsdm.ss

Uploaded by

shravaniadsul
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/ 3

Computer Graphics and Animation

Practical #1
Name Roll Number
Subject/Course: Computer Graphics & Animation / BSc IT
Practical 1 Installation & drawing basic shapes

Drawing Basic Shapes


1. Drawing a line using pre-defined function.

2. Draw a Square using multiple lines function.

3. Draw Circle, rectangle using pre-defined function.

Vidyalankar School of Information Technology


4. Draw a Hut & add the screen shot.

#include <conio.h>
#include <graphics.h>
#include <stdio.h>

int main()
{
int gdriver = DETECT, gmode;

initgraph(&gdriver, &gmode, "C:\\TC\\bgi");


setcolor(15);
circle(500, 70, 20);
line(520, 70, 540, 70);
line(480, 70, 460, 70);
line(500, 50, 500, 30);
line(500, 90, 500, 110);

setcolor(15);

line(100, 100, 150, 50);


line(150, 50, 200, 100);
line(150, 50, 350, 50);
line(350, 50, 400, 100);

rectangle(100, 100, 200, 200);


rectangle(200, 100, 400, 200);
rectangle(130, 130, 170, 200);
rectangle(250, 120, 350, 180);

setfillstyle(2, 7);

//door
floodfill(131, 131, WHITE);

//window
floodfill(251, 121, WHITE);
setfillstyle(1, 3);

//door wall
floodfill(101, 101, WHITE);

//window wall
floodfill(201, 101, WHITE);
setfillstyle(1, 14);
floodfill(501, 72, WHITE);

Vidyalankar School of Information Technology


//triangletop
setfillstyle(8, 4);
floodfill(150, 52, WHITE);

//roof
setfillstyle(11, 4);
floodfill(163, 55, WHITE);
getch();
closegraph();
}

Vidyalankar School of Information Technology

You might also like