Quiz 100% Result
  • Cyberian's Gold

    Re: CS602 Assignment 1 Solution and Discussion

    Assignment No. 01
    

    Semester: Fall 2020
    CS602: Computer Graphics
    Total Marks: 20

    Due Date: 4th Dec, 2020

    Objective
    The objective of this assignment is to;
     Learn and practice basic concepts of computer graphics like pixels, lines, circles and rectangles, texts etc using Dev-C++. (You can download Dev-C++ setup from LMS)
     Learn to fill the shapes and patterns by using flood fill algorithm.
    Instructions:
    You have to do the following steps first in order to perform the task.

    1. Install Dev-C++ from your LMS.
    2. Download from LMS and Read out the file “Add graphics in Dev cpp” thoroughly and follow the instructions in the file properly provided to you on your LMS.
      Please read the following instructions carefully before submitting assignment:
    3. You should consult the recommended books, PowerPoint slides, Handouts, and video lectures to clarify your concepts.
    4. You can take any help from your provided labs.
    5. It should be clear that your assignment will not get any credit if:
      • The assignment is submitted after due date.
      • The assignment is copied from Internet or from any other student.
      • The submitted assignment does not open or file is corrupt.
      Submission
      You are required to submit your solution through LMS in word file.
      For any query about the assignment, contact at [email protected]

    TASKS Marks=20

    Question 1) Write a program in Dev C++ to draw a circle. Also, use the flood fill algorithm to fill the circle with different lines of red color. The output of your program should like the below image:
    9162d193-0de3-46fc-a3c3-e1d6bf09d5c8-image.png

    Question 2) Write a program in Dev C++ to fill a rectangle shape using the flood fill algorithm, In which you are required to write a function as floodFill with four parameters as (x,y, pcolor, ncolor) the repeat it until the rectangle is completely filled,

  • Cyberian's Gold

    @zaasmi said in CS602 Assignment 1 Solution and Discussion:

    Question 1) Write a program in Dev C++ to draw a circle. Also, use the flood fill algorithm to fill the circle with different lines of red color. The output of your program should like the below image:

    Solution:

    // C Implementation for setfillstyle 
    // and floodfill function 
    #include <graphics.h> 
    
    // driver code 
    int main() 
    { 
    	// gm is Graphics mode which is 
    	// a computer display mode that 
    	// generates image using pixels. 
    	// DETECT is a macro defined in 
    	// "graphics.h" header file 
    	int gd = DETECT, gm; 
    	
    	// initgraph initializes the 
    	// graphics system by loading 
    	// a graphics driver from disk 
    	initgraph(&gd, &gm, " "); 
    
    	// center and radius of circle 
    	int x_circle = 250; 
    	int y_circle = 250; 
    	int radius=100; 
    	
    	// setting border color 
    	int border_color = WHITE; 
    	
    	
    	// set color and pattern 
    	setfillstyle(HATCH_FILL,RED); 
    	
    	// x and y is a position and 
    	// radius is for radius of circle 
    	circle(x_circle,y_circle,radius); 
    	
    	// fill the color at location 
    	// (x, y) with in border color 
    	floodfill(x_circle,y_circle,border_color); 
    
    	getch(); 
    	
    	// closegraph function closes the 
    	// graphics mode and deallocates 
    	// all memory allocated by 
    	// graphics system 
    	closegraph(); 
    	
    	return 0; 
    }
    
    

50% Off on Your FEE Join US!

Quiz 100% Result If you want to know how you can join us and get 50% Discout on your FEE ask Cyberian in Chat Room! Quiz 100% Result Quiz 100% Result
| |