Books FREE Online Courses
Free Tutorials  Go to Your University  Placement Preparation 
SEO MCQs : SET-1 Gadgets for Engineers
0 like 0 dislike
4.1k views
in AKTU/UPTU B.tech (CSE-VI Sem) COMPUTER GRAPHICS LAB by Goeduhub's Expert (7.6k points)
To draw different shape of hut in computer graphics

1 Answer

0 like 0 dislike
by Goeduhub's Expert (7.6k points)
 
Best answer

To draw different shape of hut

Function Argument Description
initgraph It initializes the graphics system by loading the passed graphics driver then changing the system into graphics mode.
setcolor It changes the current drawing colour. Default colour is white. Each color is assigned a number, like BLACK is 0 and RED is 4. Here we are using colour constants defined inside graphics.h header file.
setfillstyle It sets the current fill pattern and fill color.
rectangle It draws a rectangle on screen. It takes the coordinates of top left and bottom right corners.
line It draws a straight line between two points on screen.
floodfill It is used to fill a closed area with current fill pattern and fill color. It takes any point inside closed area and color of the boundary as input.
closegraph It unloads the graphics drivers and sets the screen back to text mode.

Program

 #include<graphics.h>

#include<conio.h>

#include<stdio.h> 

int main(){

 int gd = DETECT,gm;

    initgraph(&gd, &gm, "X:\\TC\\BGI");

    setcolor(WHITE);

    rectangle(150,180,250,300);

    rectangle(250,180,420,300);

    rectangle(180,250,220,300);

 

    line(200,100,150,180);

    line(200,100,250,180);

    line(200,100,370,100);

    line(370,100,420,180);

    setfillstyle(SOLID_FILL, BROWN);

    floodfill(152, 182, WHITE);

    floodfill(252, 182, WHITE);

    setfillstyle(SOLID_FILL, BLUE);

    floodfill(182, 252, WHITE);

    setfillstyle(SLASH_FILL, GREEN);

    floodfill(200, 105, WHITE);

    floodfill(210, 105, WHITE);     

    getch();

    closegraph();

    return 0;

Output

one


For more AKTU/UPTU CSE-VI Sem Computer Graphics Lab Experiments Click here


3.3k questions

7.1k answers

395 comments

4.5k users

Related questions

 Important Lists:

Important Lists, Exams & Cutoffs Exams after Graduation PSUs

 Goeduhub:

About Us | Contact Us || Terms & Conditions | Privacy Policy || Youtube Channel || Telegram Channel © goeduhub.com Social::   |  | 

 

...