Skip to content

Latest commit

 

History

History
39 lines (31 loc) · 1.44 KB

README.md

File metadata and controls

39 lines (31 loc) · 1.44 KB

gfx-v4

About

A simple 2D graphics library in C for educational purposes. It's written on top of the X desktop manager. It's able to draw lines (straight or curvy), circles, and triangles. Originally written by Prof Douglas Thain.

Compared to Prof Thain's original implementation, this library implements the following additions:

  • Bresenham's line drawing algorithm
  • a couple of triangle fills
  • midpoint circle drawing algorithm
  • point translations and rotations
  • Triangle fill by colour smearing from the vertices
  • Bezier curves (by De Chasteljau's algorithm)

Planned for the future:

  • A directory which contains examples that showcase each algo I implemented instead of a central example.c file
  • Unit tests

If some algorithm is not straightforward, the source code is complemented by these notes.

How to compile and run

On Linux, compile with

make

Run with

./example

This should output the following drawing:

Clean generated executables and object files with:

make clean

To change the output on the screen, edit example.c. Below is a more advanced drawing that demonstrates the library's capabilities.