Skip to content

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.

Notifications You must be signed in to change notification settings

bl33h/fillingAnyPolygon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 

Repository files navigation

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.


pic

FilesFeaturesHow 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, 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.

About

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published