EricDraw - A simple and tiny C (beta) drawing/painting library

Intended as a much less-sophisticated replacement for libraries like libgd, for applications where a tiny graphics library is useful (for low-footprint CGI graphics generation, or in embedded development).

Requires libjpeg, libtiff and libpng.

Elevation Model Geometry Cessna 182 Epitrochoid

Examples:


Downloads:

Quickstart:

  1. Include the library header:
         #include "ericdraw.h"
         
  2. Declare a pointer to act as the handle for the image canvas:
         struct image *i;
         
  3. Create an image canvas i in memory with draw_create_image(width,height)
         i = draw_create_image(320,240);
         
  4. Draw on the image with draw_line(), etc..
         draw_color(i, black);
         draw_line(i, 160, 30,  120,210);
         draw_line(i, 160, 30,  200,210);
         draw_line(i,  80,120,  240,120);
         draw_box(i, 60,20, 260,220);
         draw_circle(i, 160,120, 70);
         
  5. Write the image to disk with draw_write_png()
         draw_write_png(i, "myimage.png");
         
  6. Clean-up by calling draw_free_image()
         draw_free_image(i);
         
  7. Link against the EricDraw library, libjpeg, libtiff, and libpng (you may also need the math library):
    $ gcc -o myprogram myprogram.c -L. -lericdraw -lm -ljpeg -lpng -ltiff

Function Reference:

Known Bugs:

  1. draw_flood() needs to be re-written with a recursive algorithm. Some shapes aren't currently being filled in fully.
  2. The code currently produces unpredictable results if you try to draw off of the image canvas. This could be more elegant.

All contents on this site are ©Copyright 1994-2010 Eric Shalov, and other respective authors. All rights reserved.
No use without prior written permission is authorized.
This site exists for informational purposes only. No warranty is made about the accuracy of the data provided, nor it's suitability for any particular use. Use at your own risk.
Return to main project directory or to Eric's home page.