https://github.com/bl33h/fillinganypolygon
A program that uses a framebuffer to fill any polygon and save the result as a bitmap (BMP) file in the build folder. It supports drawing and filling polygons with custom shape and color.
https://github.com/bl33h/fillinganypolygon
cmake computer-graphics cpp gcc make polygon polygons vector
Last synced: 3 months ago
JSON representation
A program that uses a framebuffer to fill any polygon and save the result as a bitmap (BMP) file in the build folder. It supports drawing and filling polygons with custom shape and color.
- Host: GitHub
- URL: https://github.com/bl33h/fillinganypolygon
- Owner: bl33h
- Created: 2023-07-07T23:25:05.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-13T06:14:43.000Z (over 2 years ago)
- Last Synced: 2025-01-21T15:15:29.397Z (11 months ago)
- Topics: cmake, computer-graphics, cpp, gcc, make, polygon, polygons, vector
- Language: C++
- Homepage:
- Size: 173 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# fillingAnyPolygon
This project implements a solution for filling any polygon using a framebuffer. It provides the ability to draw and fill polygons of arbitrary shape and color. The outcome is saved as a bitmap (BMP) file in the build folder generated by running the app.
Files •
Features •
How To Use
## Files
- src: the file that implements de solution.
- colors.h: defines the Color struct and related functions for manipulating colors.
- framebuffer.h: contains the framebuffer and related functions for drawing and filling polygons.
- point.h: defines the vert struct representing a vertex in a polygon.
- main.cpp: the main program that uses the framebuffer to render polygons and generate the BMP files.
- out.bmp: the bitmap file generated for the teapot polygon.
- out2.bmp: the bitmap file generated for the star polygon.
- out3.bmp: the bitmap file generated for the diamond polygon.
- out4.bmp: the bitmap file generated for the triangle polygon.
- out5.bmp: the bitmap file generated for all the polygons together.
- CMakeLists.txt: the CMake configuration.
## Features
The fillingAnyPolygon project provides the following features:
- Drawing and filling polygons: The project allows you to define polygons using a list of vertices and specify their outline color and fill color.
- Outline rendering: The project can render the outline of a polygon using the Bresenham's line drawing algorithm.
- Polygon filling: The project can fill a polygon using the scanline algorithm to determine the intersection points of the polygon edges with the scanlines.
- Bitmap generation: The project generates a bitmap (BMP) file as the output, representing the rendered polygons.
## How To Use
To clone and run this application, you'll need [Git](https://git-scm.com), [CMake](https://cmake.org/download/), [Chocolatey](https://docs.chocolatey.org/en-us/choco/setup) (in order to execute Make) and a [C++ compiler](https://www.fdi.ucm.es/profesor/luis/fp/devtools/mingw.html) installed on your computer. From your command line:
```bash
# Clone this repository
$ git clone https://github.com/bl33h/fillingAnyPolygon
# Open the folder
$ cd src
# Run and build the app using CMake
$ cmake -G "Unix Makefiles" -S . -B build
$ cd build/
$ make
$ GAME.exe
```
Note: The main branch was created by merging the changes from the following branches: polygon-1, polygon-2, polygon-3, and polygon-4.