Skip to content

A simple 2D graphics library in C written on top of X. Its basic interface was written by Prof Douglas Thain, University of Notre Dame. Modified by me to implement some graphics algorithms.

License

Notifications You must be signed in to change notification settings

leonmavr/gfx-v4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A simple 2D graphics library in C written on top of X. Its basic interface was written by Prof Douglas Thain, University of Notre Dame. Modified by me to implement some graphics algorithms.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published