We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More

Assignment No. 02
Semester: Fall 2015

CS602: Computer Graphics

 

Total Marks: 20

 

Due Date:9/12/2015

 

Instructions

Please read the following instructions carefully before submitting assignment:

Read and follow the instructions given in document inside the Help folder attached.

It should be clear that your assignment will not get any credit if:

  • The assignment is submitted after due date.
  • The submitted assignment does not open or file is corrupt.
  • Solution is copied from any other source.

Objective

The objective of this assignment is to;

  • Learn and practice basic concepts of computer graphics using Dev-C++. (you can download Dev-C++ setup from LMS)
  • Learn to draw text, lines and polygons using different polygon filling algorithms and use of graphics library functions.

Assignment

 

In this assignment, you are provided with a small startup code attached with this assignment in folder “Startup_Code”. Your job is to slightly modify this code as desired in this assignment.

First, you need to understand the working of the given code and execute it in Dev-C++. This program essentially draws some text on screen with a line and a rectangle on screen as shown in following screenshot. We refer to the Rectangle as “Window” that is open.

 

Initially, you need to open Assigment2.dev project file in Dev-C++. After successful compilation and execution, you will see the output.

Your Task

Your task is to add new code that fill this rectangle with “Red color” in a way using “boundary fill algorithm” that it appears that first left side of window is closed and then the right side as shown in “Window.exe”. To show the window closing slowly, you need add the “delay” function. This simply requires only few lines of code to modify the x and y coordinates with reference to boundary. You shall add your code in the areas indicated with comments “add your code here”.

Screenshot of the desired  output:

 

 

Submission

You are required to submit your solution through LMS in zip format containing two files.

  • Your Project in zipped form containing both .dev and .cpp file.
  • An MS Word document containing screenshot of your program output/execution and your own Student-ID must be visible in the screenshot

 

+ Click Here To Join also Our facebook study Group.

..How to Join Subject Study Groups & Get Helping Material?..


See Your Saved Posts Timeline

Views: 3630

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

Attachments:

Replies to This Discussion

is main error ha?

Successfully Completed 90% assignment :) only last part is lefting ;)

then plz  tel me  about solution

wheen  yu complt then plzzzzz  give me yur solution

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
#include<stdlib.h>
#include<math.h>
void boundary_fill(int x,int y,int f,int b);

int main()
{
initwindow(600,600);
int x,y,n,i;
int gd=DETECT,gm;
initgraph(&gd,&gm," ");
setcolor(WHITE);

settextstyle(DEFAULT_FONT, HORIZ_DIR, 2);
outtextxy(10, 10, "Welcome to Graphics Programming");
outtextxy(10, 30, "My VU-ID is BS130201411");
line(0,60,getmaxx(),60);
/*- draw object -*/

line (70,70,200,70);
line (200,70,200,300);
line (200,300,70,300);
line (70,300,70,70);

/*- set seed point */
setcolor(RED);
boundary_fill(71,71,4,15);
//Add you code here
boundary_fill(71,71,4,15);



getch();
closegraph();
return 0;
}
void boundary_fill(int x,int y,int f,int b)
{
if(getpixel(x,y)!=b && getpixel(x,y)!=f)
{

putpixel(x,y,f);
delay(10);
boundary_fill(x+1,y-1,f,b);

boundary_fill(x+1,y+1,f,b);
boundary_fill(x-1,y-1,f,b);
boundary_fill(x-1,y+1,f,b);

}
}

See the attached file given below:

Attachments:

error

Attachments:
Day DON GA WAIT :) Just the last step ..

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<dos.h>
#include<stdlib.h>
#include<math.h>
void boundary_fill(int x,int y,int f,int b);

int main()
{
int x,y,n,i;
int gd=DETECT,gm;
initgraph(&gd,&gm," ");
setcolor(WHITE);
floodfill(300, 180, BLACK);

settextstyle(DEFAULT_FONT, HORIZ_DIR, 2);
outtextxy(10, 10, "Welcome to Graphics Programming");
outtextxy(10, 30, "My VU-ID is BC130401285");
line(0,60,getmaxx(),60);
/*- draw object -*/

line (70,70,200,70);
line (200,70,200,300);
line (200,300,70,300);
line (70,300,70,70);

/*- set seed point */

boundary_fill(71,71,4,15);
//Add you code here



getch();
closegraph();
return 0;

}
void boundary_fill(int x,int y,int f,int b)
{
if(getpixel(x,y)!=f && getpixel(x,y)!=b)
{

putpixel(x,y,f);
delay(0);
boundary_fill(x+1,y-0,f,b);
boundary_fill(x+1,y+0,f,b);
boundary_fill(x-0,y-1,f,b);
boundary_fill(x-0,y+1,f,b);

}
}

there is an issue in this solution if we open the window.exe the filling patron is different then this one. is this solution fine?

how to half fill one side and  second part other fill

Yups At Least Successfuly I developed it :) .. But I will share programme source latter after a lot of changings :) . 

This time I can only give you IDEA . That BOUNDARYFILL() is not a part of this programme :) . So Don't use :) . 

Attachments:

RSS

Latest Activity

Today Top Members 

© 2019   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service