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
- 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.
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.
To clone and run this application, you'll need Git, CMake, Chocolatey (in order to execute Make) and a C++ compiler installed on your computer. From your command line:
# 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.