Project report on smiling faces
Using computer graphics
Submitted By: Submitted to:
Prem Priy Ranjan Dr. Himanshu Sharma
Omprakash Kumar Singh
Project Report
“Smiling Face Using Computer Graphics”
1. Introduction
Computer Graphics is a vital field in computer science that enables users to create
and manipulate visual content using programming. One of the best ways to begin
learning computer graphics is by working with basic 2D shapes and functions. This
project report presents the design and implementation of a simple smiling face
using fundamental graphics programming techniques. The purpose of this project is
to introduce learners to graphical primitives, coordinate systems, and how they
come together to create recognizable images on the screen.
Creating a smiling face is a beginner-friendly graphics project that uses simple
drawing functions such as circles, arcs, and fill operations. It helps learners gain
confidence in working with graphics libraries and lays the groundwork for more
complex projects like animations, games, and simulations.
2. Objectives
The key objectives of the project are:
- To understand and apply basic computer graphics functions such as `circle()`,
`arc()`, `line()`, and `floodfill()`.
- To develop a 2D visual representation of a smiling face using primitive shapes.
- To introduce the concept of screen coordinates and positioning.
- To enhance programming skills using graphics libraries in C++ or Python.
- To provide a fun and engaging way of learning graphics programming
fundamentals.
3. Tools and Technologies Used
- Programming Language: C++
- Graphics Library: graphics.h (Borland or Turbo C++, or modern IDE with
WinBGIm)
- Alternative Language: Python with Turtle module (optional)
- Platform: Windows OS with Code::Blocks or Turbo C++
4. Project Description
The smiling face is composed of the following basic components:
- Head: A large circle representing the outline of the face.
- Eyes: Two small filled circles for the eyes.
- Smile (Mouth): An arc forming a curved mouth.
- Optional Elements: Nose (small line or triangle), Eyebrows, or Text labels.
Each of these components is drawn by calculating appropriate coordinates and
radii. By using a fixed origin and keeping the design symmetrical, the final output
appears as a simple, cartoon-like smiling face.
This project helps students visually understand how combining basic shapes can
result in a meaningful picture. It also introduces layering and z-ordering concepts in
2D drawing (which object comes on top).
5. Methodology and Program Flow
The logic behind the program is as follows:
1. Initialize the graphics mode and driver.
2. Draw the face using the circle() function.
3. Add eyes using two smaller circle() calls and fill them with white using floodfill().
4. Draw the smile using the arc() function with appropriate angles.
5. Keep the output screen open until the user presses a key.
6. Close the graphics driver and exit.
Sample Code (in C++):
#include <graphics.h>
#include <conio.h>
int main() {
int gd = DETECT, gm;
initgraph(&gd, &gm, "");
// Face outline
circle(250, 250, 100);
// Eyes
circle(220, 220, 10);
circle(280, 220, 10);
floodfill(220, 220, WHITE);
floodfill(280, 220, WHITE);
// Smile
arc(250, 250, 200, 340, 50);
getch();
closegraph();
return 0;
}
6. Output Description
The output of the program is a graphical window displaying a simple smiling face:
- A large circle forms the boundary of the face.
- Two white-filled eyes are placed symmetrically inside the head.
- A curved arc forms the smiling mouth at the bottom of the face.
This provides a minimal but expressive graphic output that is easy to understand
and visually appealing.
7. Applications
While this project is simple, it introduces key principles that are foundational in the
following areas:
- Education: Demonstrates basic graphics programming to students.
- Games: Understanding of 2D drawing for sprite development.
- Simulations: Building blocks for creating cartoon characters or avatars.
- User Interface Design: Drawing elements like icons and buttons using shapes.
- Emojis/Expressions: Can be expanded into a smiley system for chat apps.
8. Limitations
- Static Drawing: The face is not animated or interactive.
- Fixed Coordinates: The drawing is not responsive to window size or resolution.
- No User Input: The face elements are hard-coded and cannot be modified by the
user.
- Outdated Graphics Library: graphics.h is old and not supported in modern systems
without custom setup.
Despite these limitations, it is excellent for foundational learning.
9. Future Scope
This project can be enhanced in several ways:
- Add Animation: Make the face smile or blink using simple frame updates.
- User Interaction: Let the user draw their own face or change expressions.
- Use Modern Libraries: Shift to Pygame (Python), SDL, or OpenGL for higher quality
graphics.
- Mobile App/Browser Version: Create an HTML5 Canvas version for web platforms.
10. Conclusion
The "Smiling Face Using Computer Graphics" project is a beginner-level exercise
that introduces students to graphical programming using basic 2D primitives. It
covers essential drawing functions, teaches about coordinate geometry, and
provides a creative way to learn programming concepts visually. Such projects
foster an interest in visual computing and prepare students for more advanced
areas like animation, game development, and graphical user interface design.
This simple exercise proves that even a few lines of code can generate meaningful
and enjoyable output when working with computer graphics.