A comprehensive collection of computer graphics programs implemented in C. This repository contains various algorithms such as line, circle, and ellipse drawing (DDA, Bresenham, Midpoint) and polygon filling techniques (Boundary Fill, Flood Fill), along with sample outputs for visualization. Ideal for students and enthusiasts learning graphics programming.
- Introduction
- Programs Included
- Line Drawing using Y = mX + C
- Line Drawing using DDA Algorithm
- Line Drawing using Bresenham’s Algorithm
- Circle Drawing using Midpoint Circle Algorithm
- Circle Drawing using Bresenham’s Algorithm
- Ellipse Drawing using Midpoint Ellipse Algorithm
- Hut Drawing in Computer Graphics
- Polygon Filling using Boundary Fill Algorithm
- Polygon Filling using Flood Fill Algorithm
- How to Compile and Run
- Screenshots
- License
This repository is a curated collection of fundamental computer graphics programs written in C. Each program demonstrates a specific algorithm for rendering graphics on a screen, ranging from basic line drawing to complex polygon filling. The repository also includes screenshots of outputs to help visualize the results.
- Code: y_mx_c_line.c
- Description: Draws a straight line based on the equation
Y = mX + C. - Screenshot:

- Code: dda_line.c
- Description: Implements the Digital Differential Analyzer (DDA) algorithm for line drawing.
- Screenshot:

- Code: bresenham_line.c
- Description: Implements Bresenham's line drawing algorithm for efficient rendering of straight lines.
- Screenshot:

- Code: midpoint_circle.c
- Description: Draws a circle using the Midpoint Circle algorithm.
- Screenshot:

- Code: bresenham_circle.c
- Description: Implements Bresenham's algorithm to draw a circle.
- Screenshot:

- Code: midpoint_ellipse.c
- Description: Draws an ellipse using the Midpoint Ellipse algorithm.
- Screenshot:

- Code: hut_drawing.c
- Description: Draws a simple hut-like structure using graphics primitives.
- Screenshot:

- Code: boundary_fill.c
- Description: Fills a polygon region using the Boundary Fill algorithm.
- Screenshot:

- Code: flood_fill.c
- Description: Fills a polygon region using the Flood Fill algorithm.
- Screenshot:

- Install a C compiler such as GCC and ensure the graphics library (e.g.,
graphics.h) is set up. - Compile a program using:
gcc -o output_program programs/program_name.c -lgraph
- Run the program using:
./output_program
Below are sample outputs of the programs:
This repository is licensed under the MIT License. You are free to use, modify, and distribute the code with proper attribution.
Feel free to fork, star, or contribute to this repository! For any issues or suggestions, please open an issue in the repository.