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

Graphics Unit 1 Notes

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Graphics Unit 1 Notes

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 22

COMPUTER GRAPHICS – 18CSE338J

18CSE338J COMPUTER GRAPHICS

UNIT 1
1. Computer Graphics Applications

Computer graphics deals with creation, manipulation and storage of different type of
images and objects. Some of the applications of computer graphics are:
1. Computer Art:
Using computer graphics we can create fine and commercial art which include
animation packages, paint packages. These packages provide facilities for designing
object shapes and specifying object motion. Cartoon drawing, paintings, logo design
can also be done.
2. Computer Aided Drawing:
Designing of buildings, automobile, aircraft is done with the help of computer aided
drawing, this helps in providing minute details to the drawing and producing more
accurate and sharp drawings with better specifications.
3. Presentation Graphics:
For the preparation of reports or summarising the financial, statistical, mathematical,
scientific, economic data for research reports, managerial reports, moreover creation
of bar graphs, pie charts, time chart, can be done using the tools present in computer
graphics.
4. Entertainment:
Computer graphics finds a major part of its utility in the movie industry and game
industry. Used for creating motion pictures, music video, television shows, cartoon
animation films. In the game industry where focus and interactivity are the key
players, computer graphics helps in providing such features in the efficient way.
5. Education:
Computer generated models are extremely useful for teaching huge number of
concepts and fundamentals in an easy to understand and learn manner. Using computer
graphics many educational models can be created through which more interest can be
generated among the students regarding the subject.
6. Training:
Specialised system for training like simulators can be used for training the candidates
in a way that can be grasped in a short span of time with better understanding.
Creation of training modules using computer graphics is simple and very useful.
7. Visualisation:
Today the need of visualise things have increased drastically, the need of visualisation
can be seen in many advance technologies , data visualisation helps in finding insights
of the data , to check and study the behaviour of processes around us we need
appropriate visualisation which can be achieved through proper usage of computer
graphics
8. Image Processing:
Various kinds of photographs or images require editing in order to be used in different
places. Processing of existing images into refined ones for better interpretation is one
of the many applications of computer graphics.
9. Machine Drawing:
Computer graphics is very frequently used for designing, modifying and creation of
various parts of machine and the whole machine itself, the main reason behind using

College Name
computer graphics for this purpose is the precision and clarity we get from such
drawing is ultimate and extremely desired for the safe manufacturing of machine using
these drawings.
10. Graphical User Interface:
The use of pictures, images, icons, pop-up menus, graphical objects helps in creating a
user friendly environment where working is easy and pleasant, using computer
graphics we can create such an atmosphere where everything can be automated and
anyone can get the desired action performed in an easy fashion.
These are some of the applications of computer graphics due to which it’s popularity has
increased to a huge extend and will keep on increasing with the progress in technology.

2. Graphics System Overview


A graphics system is a computer system that focuses on the creation, manipulation, and
display of visual images and graphics. It involves both hardware and software components
working together to produce graphical output. Here's an overview of the key components of a
graphics system:

1. Graphics Hardware:
 Graphics Processing Unit (GPU): The GPU is a specialized processor designed to
handle graphics-related tasks. It accelerates the rendering of images and performs
complex mathematical calculations required for graphics processing.
 Video Card/Graphics Card: This hardware component houses the GPU and often
includes dedicated video memory (VRAM) for storing graphical data. It connects to
the motherboard and is responsible for rendering images on the display.
 Monitor/Display: The display device, such as a monitor or screen, where the
graphical output is presented. Displays can vary in resolution, refresh rate, and color
depth.
 Input Devices: Devices like a graphics tablet, stylus, or touch-sensitive screens
enable users to interact with and input graphical information into the system.
 Frame Buffer: VRAM serves as a frame buffer, holding the pixel data that is sent to
the display. The frame buffer is crucial for rendering images and ensuring smooth
animation.
 Rasterization Engine: Converts graphical primitives (lines, polygons, etc.) into
pixels, which can be displayed on the screen.
 Shader Units: These programmable units within the GPU are responsible for
executing shaders, which are small programs that control various aspects of the
graphics pipeline, such as vertex and pixel processing.
2. Graphics Software:
 Graphics Drivers: Software that facilitates communication between the operating
system and graphics hardware. It translates higher-level graphical commands from
applications into instructions that the GPU can understand.
 Graphics APIs (Application Programming Interfaces): Interfaces that enable
software developers to interact with the graphics hardware. Examples include
OpenGL, DirectX, Vulkan, and Metal.
 3D Modeling and Animation Software: Tools like Blender, Autodesk Maya, and
3ds Max are used for creating 3D models and animations.
 Graphics Libraries: Libraries like OpenGL and DirectX provide pre-written
functions and routines for graphics programming.

College Name
 Image Editing Software: Applications like Adobe Photoshop and GIMP allow for
the creation and manipulation of images.
 Game Engines: Platforms like Unity and Unreal Engine provide a framework for
developing and rendering graphics in video games.
3. Rendering Pipeline:
 Vertex Processing: Transformation of 3D coordinates of objects into 2D screen
space.
 Rasterization: Conversion of graphical primitives into pixels.
 Fragment Processing (Pixel Shader): Calculation of color and other attributes for
each pixel.
 Geometry Shader (optional): Performs operations on geometric primitives.
 Texture Mapping: Applying textures to surfaces to enhance realism.
 Rendering Output: Final display of the processed image on the monitor.
4. Graphics Standards:
 Open Standards: Standards like OpenGL and Vulkan are open and cross-platform,
allowing for widespread adoption.
 Proprietary Standards: DirectX is a proprietary API developed by Microsoft for
Windows-based systems.

3. Raster Scan System and Random Scan System

Random Scan Display:

Random Scan System uses an electron beam which operates like a pencil to create a line
image on the CRT screen. The picture is constructed out of a sequence of straight-line
segments. Each line segment is drawn on the screen by directing the beam to move from one
point on the screen to the next, where its x & y coordinates define each point. After drawing
the picture. The system cycles back to the first line and design all the lines of the image 30 to
60 time each second. The process is shown in fig:

Random-scan monitors are also known as vector displays or


stroke-writing displays or calligraphic displays.

Advantages:

1. A CRT has the electron beam directed only to the parts of the screen where an image
is to be drawn.
2. Produce smooth line drawings.
3. High Resolution

Disadvantages:

College Name
1. Random-Scan monitors cannot display realistic shades scenes.

Raster Scan Display:

A Raster Scan Display is based on intensity control of pixels in the form of a rectangular box
called Raster on the screen. Information of on and off pixels is stored in refresh buffer or
Frame buffer. Televisions in our house are based on Raster Scan Method. The raster scan
system can store information of each pixel position, so it is suitable for realistic display of
objects. Raster Scan provides a refresh rate of 60 to 80 frames per second.

Frame Buffer is also known as Raster or bit map. In Frame Buffer the positions are called
picture elements or pixels. Beam refreshing is of two types. First is horizontal retracing and
second is vertical retracing. When the beam starts from the top left corner and reaches the
bottom right scale, it will again return to the top left side called at vertical retrace. Then it will
again more horizontally from top to bottom call as horizontal retracing shown in fig:

Types of Scanning or travelling of beam in Raster Scan

1. Interlaced Scanning

2. Non-Interlaced Scanning

In Interlaced scanning, each horizontal line of the screen is traced from top to bottom. Due to
which fading of display of object may occur. This problem can be solved by Non-Interlaced
scanning. In this first of all odd numbered lines are traced or visited by an electron beam,
then in the next circle, even number of lines are located.

For non-interlaced display refresh rate of 30 frames per second used. But it gives flickers. For
interlaced display refresh rate of 60 frames per second is used.

Advantages:
1. Realistic image
2. Million Different colors to be generated
3. Shadow Scenes are possible.
Disadvantages:
1. Low Resolution
2. Expensive
Differentiate between Random and Raster Scan Display:

College Name
Random Scan Raster Scan

1. It has high Resolution 1. Its resolution is low.

2. It is more expensive 2. It is less expensive

3. Any modification if needed is easy 3.Modification is tough

4. Solid pattern is tough to fill 4.Solid pattern is easy to fill

5. Refresh rate depends or resolution 5. Refresh rate does not depend on the picture.

6. Only screen with view on an area is displayed. 6. Whole screen is scanned.

7. Beam Penetration technology come under it. 7. Shadow mark technology came under this.

8. It does not use interlacing method. 8. It uses interlacing

9. It is restricted to line drawing applications 9. It is suitable for realistic display.

4. Input and Output Devices

Input Devices

1. Keyboard:

The most commonly used input device is a keyboard. The data is entered by pressing the set
of keys. All keys are labeled. A keyboard with 101 keys is called a QWERTY keyboard.
The keyboard has alphabetic as well as numeric keys. Some special keys are also available.
1. Numeric Keys: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
2. Alphabetic keys: a to z (lower case), A to Z (upper case)
3. Special Control keys: Ctrl, Shift, Alt
4. Special Symbol Keys: ; , " ? @ ~ ? :
5. Cursor Control Keys: ↑ → ← ↓
6. Function Keys: F1 F2 F3....F9.
7. Numeric Keyboard: It is on the right-hand side of the keyboard and used for fast
entry of numeric data.

Function of Keyboard:

1. Alphanumeric Keyboards are used in CAD. (Computer Aided Drafting)


2. Keyboards are available with special features line screen co-ordinates entry, Menu
selection or graphics functions, etc.

College Name
3. Special purpose keyboards are available having buttons, dials, and switches. Dials are
used to enter scalar values. Dials also enter real numbers. Buttons and switches are
used to enter predefined function values.

Advantage:
1. Suitable for entering numeric data.
2. Function keys are a fast and effective method of using commands, with fewer errors.
Disadvantage:
1. Keyboard is not suitable for graphics input.

2. Mouse:
A Mouse is a pointing device and used to position the pointer on the screen. It is a small palm
size box. There are two or three depression switches on the top. The movement of the mouse
along the x-axis helps in the horizontal movement of the cursor and the movement along the
y-axis helps in the vertical movement of the cursor on the screen. The mouse cannot be used
to enter text. Therefore, they are used in conjunction with a keyboard.

Advantage:
1. Easy to use
2. Not very expensive

3. Trackball

It is a pointing device. It is similar to a mouse. This is mainly used in notebook or laptop


computer, instead of a mouse. This is a ball which is half inserted, and by changing fingers on
the ball, the pointer can be moved.

Advantage:
1. Trackball is stationary, so it does not require much space to use it.
2. Compact Size

4. Spaceball:

College Name
It is similar to trackball, but it can move in six directions where trackball can move in two
directions only. The movement is recorded by the strain gauge. Strain gauge is applied with
pressure. It can be pushed and pulled in various directions. The ball has a diameter around 7.5
cm. The ball is mounted in the base using rollers. One-third of the ball is an inside box, the
rest is outside.

Applications:

1. It is used for three-dimensional positioning of the object.


2. It is used to select various functions in the field of virtual reality.
3. It is applicable in CAD applications.
4. Animation is also done using spaceball.
5. It is used in the area of simulation and modeling.

5 Joystick:

A Joystick is also a pointing device which is used to change cursor position on a monitor
screen. Joystick is a stick having a spherical ball as its both lower and upper ends as shown in
fig. The lower spherical ball moves in a socket. The joystick can be changed in all four
directions. The function of a joystick is similar to that of the mouse. It is mainly used in
Computer Aided Designing (CAD) and playing computer games.

Output Devices
It is an electromechanical device, which accepts data from a computer and translates them
into form understand by users.

Following are Output Devices:

1. Printers
2. Plotters

1. Printers:

Printer is the most important output device, which is used to print data on paper.

Types of Printers: There are many types of printers which are classified on various criteria
as shown in fig:

College Name
1. Impact Printers: The printers that print the characters by striking against the ribbon and
onto the papers are known as Impact Printers.

These Printers are of two types:


1. Character Printers
2. Line Printers

2. Non-Impact Printers: The printers that print the characters without striking against the
ribbon and onto the papers are called Non-Impact Printers. These printers print a complete
page at a time, therefore, also known as Page Printers.

Page Printers are of two types:

1. Laser Printers
2. Inkjet Printers

Dot Matrix Printers:

Dot matrix has printed in the form of dots. A printer has a head which contains nine pins. The
nine pins are arranged one below other. Each pin can be activated independently. All or only
the same needles are activated at a time. When needless is not activated, and then the tip of
needle stay in the head. When pin work, it comes out of the print head. In nine pin printer,
pins are arranged in 5 * 7 matrixes.

College Name
Advantage:

1. Dot Matrix Printers prints output as dots, so it can print any shape of the character.
This allows the printer to print special character, charts, graphs, etc.
2. Dot Matrix Printers come under the category of impact printers. The printing is done
when the hammer pin strikes the inked ribbon. The impressions are printed on paper.
By placing multiple copies of carbon, multiple copies of output can be produced.
3. It is suitable for printing of invoices of companies.

5 DDA Line drawing algorithm computer graphics

The DDA (Digital Differential Analyzer) algorithm is a simple and efficient method for
drawing a line between two given points in computer graphics. It is an incremental method
that calculates the coordinates of the points along the line using the rate of change of the
coordinates (slope). Here is a step-by-step explanation of the DDA line drawing algorithm:

DDA (Digital Differential Analyzer) is a line drawing algorithm used in computer graphics
to generate a line segment between two specified endpoints. It is a simple and efficient
algorithm that works by using the incremental difference between the x-coordinates and y-
coordinates of the two endpoints to plot the line.

The steps involved in DDA line generation algorithm are:

1. Input the two endpoints of the line segment, (x1,y1) and (x2,y2).
2. Calculate the difference between the x-coordinates and y-coordinates of the endpoints
as dx and dy respectively.
3. Calculate the slope of the line as m = dy/dx.
4. Set the initial point of the line as (x1,y1).
5. Loop through the x-coordinates of the line, incrementing by one each time, and
calculate the corresponding y-coordinate using the equation y = y1 + m(x – x1).
6. Plot the pixel at the calculated (x,y) coordinate.
7. Repeat steps 5 and 6 until the endpoint (x2,y2) is reached.

College Name
DDA algorithm is relatively easy to implement and is computationally efficient, making it
suitable for real-time applications. However, it has some limitations, such as the inability to
handle vertical lines and the need for floating-point arithmetic, which can be slow on some
systems. Nonetheless, it remains a popular choice for generating lines in computer graphics.
In any 2-Dimensional plane, if we connect two points (x0, y0) and (x1, y1), we get a line
segment. But in the case of computer graphics, we can not directly join any two coordinate

College Name
points, for that, we should calculate intermediate points’ coordinates and put a pixel for
each intermediate point, of the desired color with the help of functions like putpixel(x, y, K)
in C, where (x,y) is our co-ordinate and K denotes some color.

Advantages of DDA Algorithm:


 It is a simple and easy-to-implement algorithm.
 It avoids using multiple operations which have high time complexities.
 It is faster than the direct use of the line equation because it does not use any floating
point multiplication and it calculates points on the line.
Disadvantages of DDA Algorithm:
 It deals with the rounding off operation and floating point arithmetic so it has high
time complexity.
 As it is orientation-dependent, so it has poor endpoint accuracy.
 Due to the limited precision in the floating point representation, it produces a
cumulative error.

College Name
6. Bresenham’s Line Generation Algorithm

College Name
This algorithm is used for scan converting a line. It was developed
by Bresenham. It is an efficient method because it involves only
integer addition, subtractions, and multiplication operations. These
operations can be performed very rapidly so lines can be generated
quickly.

Given the coordinate of two points A(x1, y1) and B(x2, y2). The task is
to find all the intermediate points required for drawing line AB on the
computer screen of pixels. Note that every pixel has integer
coordinates.

In this method, next pixel selected is that one who has the least
distance from true line.

College Name
Differentiate between DDA Algorithm and Bresenham's Line Algorithm:

DDA Algorithm Bresenham's Line Algorithm

1. DDA Algorithm use floating point, i.e., 1. Bresenham's Line Algorithm use fixed point, i.e.,
Real Arithmetic. Integer Arithmetic

2. DDA Algorithms uses multiplication & 2.Bresenham's Line Algorithm uses only subtraction
division its operation and addition its operation

3. DDA Algorithm is slowly than 3. Bresenham's Algorithm is faster than DDA


Bresenham's Line Algorithm in line drawing Algorithm in line because it involves only addition &
because it uses real arithmetic (Floating Point subtraction in its calculation and uses only integer
operation) arithmetic.

4. DDA Algorithm is not accurate and 4. Bresenham's Line Algorithm is more accurate and
efficient as Bresenham's Line Algorithm. efficient at DDA Algorithm.

5.DDA Algorithm can draw circle and curves 5. Bresenham's Line Algorithm can draw circle and
but are not accurate as Bresenham's Line curves with more accurate than DDA Algorithm.

College Name
Algorithm

7. Mid-point circle drawing algorithm

The mid-point circle drawing algorithm is an algorithm used to determine the points
needed for rasterizing a circle. We use the mid-point algorithm to calculate all the
perimeter points of the circle in the first octant and then print them along with their mirror
points in the other octants. This will work because a circle is symmetric about its centre.

The algorithm is very similar to the Mid-Point Line Generation Algorithm . Here, only the
boundary condition is different.

College Name
8. Pixel addressing

In computer graphics, pixel addressing is the process of determining the address of a pixel
in an image. Object geometry is the study of the shape and size of objects in an image. In
this article, we will discuss both topics in detail, with examples to illustrate each concept.

Pixel addressing is used to determine the location of a particular pixel in an image. The
address can be represented in two ways: by its coordinates (x,y) or by its index (i). The
coordinate system is used when referring to the position of a pixel on an image, while the
index system is used when working with pixels in memory.

College Name
The first step in pixel addressing is to identify the origin point. The origin can be either the
top-left or bottom-left corner of the image. Once the origin has been identified, the x-
coordinate represents how far horizontally from the origin point a given pixel lies, while
the y-coordinate represents how far vertically from the origin point a given pixel lies. For
example, consider an 8×8 image with its origin at the top-left corner:

The x-coordinates range from 0 to 7 (inclusive), while the y-coordinates range from 0 to 7
(inclusive). Thus, we can say that the top-leftmost pixel has coordinates (0,0), while the
bottom-rightmost pixel has coordinates (7,7).

The index system is used when working with pixels in memory.

Key Terms:
Pixel addressing is a process of determining the address or coordinates of a pixel in an
image. This can be done by using the row and column values of the pixel, or by using the x
and y coordinates.

Object geometry is the study of the shape, size, and position of objects in space. This can
be done by using mathematical models, such as points, lines, and planes.

To understand pixel addressing and object geometry in computer graphics, it is first


necessary to have a firm grasp of the concept of a raster. A raster is a rectangular array of
cells, with each cell having a unique address. This addressing scheme is used to represent
two-dimensional images such as bitmaps.

Each cell in a raster contains a certain amount of information, typically represented as an


8-bit value. This value can be used to store the intensity of the color at that location, or it
can be used to store other information such as transparency or depth.

The way that pixels are addressed can have a significant impact on the way that objects are
drawn on the screen. For example, if pixels are addressed in row-major order, then objects
will tend to be drawn from left to right and top to bottom. On the other hand, if pixels are
addressed in column-major order, then objects will tend to be drawn from top to bottom
and left to right.

There are several different ways to address pixels in a raster, but the most common
methods are linear addressing and coordinate indexing. Linear addressing is simply a
matter of assigning each pixel a consecutive address starting from 0. Coordinate indexing
involves assigning each pixel an (x,y) coordinate pair that corresponds to its position
within the raster.

Once the pixels have been addressed, the next step is to determine how those pixels will be
used to draw objects on the screen.

Applications
There are many potential applications for the concepts of pixel addressing and object
geometry in computer graphics. For example, these concepts can be used to create more
realistic images or animations, to improve the efficiency of image processing algorithms,
or to develop new methods for manipulating and interactively viewing digital images.
Additionally, by understanding how pixel addressing and object geometry work together,
computer graphics designers can create more intuitive and user-friendly interfaces for their
products.

College Name
Advantages
One advantage of pixel addressing and object geometry in computer graphics is that they
can help create more realistic images. By understanding how pixels are addressed and how
objects are positioned in relation to each other, computer graphic designers can create
images that more accurately reflect the real world.

Another advantage of pixel addressing and object geometry is that it can help improve the
performance of computer graphics applications. By understanding how pixels are
addressed and how objects are positioned in relation to each other, computer graphic
designers can create algorithms that better utilize the resources of the system, resulting in
faster rendering times and smoother animations.

Finally, pixel addressing and object geometry can also help create more user-friendly
interfaces. By understanding how pixels are addressed and how objects are positioned in
relation to each other, computer graphic designers can create interfaces that are easier to
use and navigate.

Disadvantages
Computer graphics uses pixels for representation. Pixels are part of a grid that is mapped
to the monitor, which can display images on the screen. This mapping is called pixel
addressing and is mostly used due to its low-cost, high-quality resolution.

Pixel addressing has a few disadvantages. One of them is that it offers no intrinsic
geometric properties at the pixel level which is important in some applications. For
example, when computing with pixels one cannot easily determine the slope or area of an
object in an image without computing across many pixels and knowing the size of each
pixel.

9. Filled Area Primitives

Filled Area primitives are used to filling solid colors to an area or image or polygon.
Filling the polygon means highlighting its pixel with different solid colors. Following are
two filled area primitives:

1. Seed Fill Algorithm


2. Scan Fill Algorithm
Seed Fill Algorithm:
In this seed fill algorithm, we select a starting point called seed inside the boundary of the
polygon. The seed algorithm can be further classified into two algorithms: Flood Fill and
Boundary filled.

Flood Fill Algorithm:


In this flood-fill algorithm, a seed point is taken inside the polygon. The flood fill
algorithm is used when the polygon has multiple color boundaries. In this method, the
related pixels are replaced with the selected color using fill color. The selected pixel
values before are reassigned with the selected color value. This can be done using two
approaches either 4-connected or 8-connected.

College Name
Algorithm:
Function floodfill(x, y, fillcolor, previouscolor)

if (getpixel (x, y) = previouscolor)

setpixel (x, y, fillcolor);

floodfill( x+1, y, fillcolor,previouscolor);

floodfill( x-1, y, fillcolor,previouscolor);

floodfill( x, y+1, fillcolor,previouscolor);

floodfill( x, y-1, fillcolor,previouscolor);

getpixel() - The color of specified pixel.

setpixel() - Sets the pixel to specified color.

Advantages:
 This method is easy to fill colors in computer graphics.
 It fills the same color inside the boundary.
Disadvantages:
 Fails with large area polygons.
 It is a slow method to fill the area.

Boundary Fill Algorithm:
The boundary fill algorithm uses polygon boundaries. It is also called an edge fill
algorithm. In this method, a seed point is taken in the polygon boundary and checks
whether the adjacent or neighboring pixel is colored or not. If the adjacent pixel is not
colored then, fill it. This can be done using two approaches: 4-connected or 8-connected.

College Name
Algorithm:
Function boundaryfill(x, y, color, color1)

int c;

c = getpixel(x ,y);

if (c! =color) & (c!=color1)

setpixel (x, y, color);


boundaryfill( x+1, y, color, color1);
boundaryfill( x-1, y, color, color1);
boundaryfill( x, y+1, color, color1);
boundaryfill( x, y-1, color, color1);
}

Advantages:
 The boundary fill algorithm is used to create attractive paintings.
Disadvantages:
 In the 4-connected approach, it does not color corners.

Scan Fill Algorithm:

Scan fill algorithm is an area-filling algorithm that fill colors by scanning horizontal lines.
These horizontal lines intersect the boundaries of the polygon and fill colors between the
intersection points. Its main purpose is to fill colors in the interior pixels of the polygon.

Scan Line Algorithm


Advantages:
 Scan fill algorithm fills the polygon in the same order as rendering.
 It takes advantage of coherence thus, a fast algorithm.

College Name
Disadvantages:
 The intensity of the pixels is unequal.
 Staircase-like appearance when scan line converted to circles.

10.Boundary Filling Algorithm

C Implementation for Boundary Filling Algorithm


#include <graphics.h>

// Function for 8 connected Pixels


void boundaryFill8(int x, int y, int fill_color,int boundary_color)
{
if(getpixel(x, y) != boundary_color &&
getpixel(x, y) != fill_color)
{
putpixel(x, y, fill_color);
boundaryFill8(x + 1, y, fill_color, boundary_color);
boundaryFill8(x, y + 1, fill_color, boundary_color);
boundaryFill8(x - 1, y, fill_color, boundary_color);
boundaryFill8(x, y - 1, fill_color, boundary_color);
boundaryFill8(x - 1, y - 1, fill_color, boundary_color);
boundaryFill8(x - 1, y + 1, fill_color, boundary_color);
boundaryFill8(x + 1, y - 1, fill_color, boundary_color);
boundaryFill8(x + 1, y + 1, fill_color, boundary_color);
}
}

//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, "");

// Rectangle function
rectangle(50, 50, 100, 100);

// Function calling
boundaryFill8(55, 55, 4, 15);

College Name
delay(10000);
getch();

// closegraph function closes the


// graphics mode and deallocates
// all memory allocated by
// graphics system .
closegraph();

return 0;
}

Output

College Name

You might also like