Skip to content

San7o/micro-draw.h

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

micro-draw.h
============

Header-only software renderer in C99.

Author:  Giovanni Santini
Mail:    giovanni.santini@proton.me
License: MIT


Features
--------

 - lines
 - rectangles
 - circles
 - triangles
 - grids
 - text
 - color RGBA, Black&White, easily add more formats
 - PPM file reading and writing
 - resize
 - overlap

Usage
-----

Do this:

  #define MICRO_DRAW_IMPLEMENTATION

before you include this file in *one* C or C++ file to create the
implementation.

i.e. it should look like this:

  #include ...
  #include ...
  #include ...
  #define MICRO_DRAW_IMPLEMENTATION
  #include "micro-draw.h"

You can tune the library by #defining certain values. See the
"Config" comments under "Configuration" below.

To enable PPM related functions, you need to #define MIRO_DRAW_PPM.
More info: https://en.wikipedia.org/wiki/Netpbm

The usage is quite straight forward: you supply a data buffer to a
micro-draw.h function which will fill the pixels accordingly. For
example, you can use this buffer to render a frame on screen, or to
save it as an image file, or do whatever you want.

Check out some examples in the `test` directory.


Code
----

The official git repository of micro-draw.h is hosted at:

    https://github.com/San7o/micro-draw.h

This is part of a bigger collection of header-only C99 libraries
called "micro-headers", contributions are welcome:

    https://github.com/San7o/micro-headers


TODO
----

 - Implement micro_draw_from_ppm

About

Header-only software renderer in C99.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages