Simple Graphics C++

Hello all

Is there any simple graphics library in C++? My requirements(as mentioned below) are very simple, and thats why I dont want to waste 1 month learning MFCs.

1. On a canvas, I should be able to add as many circles as I wish.
2. After adding the circles, I should be able to resize them and move it with mouse cursor. (resizing is not priority, but I should be able to move them preferably with mouse cursor)
3. I would like to export the center point and the radius of all the circles to a text file. (I wish I could do this in MSPaint!)

Providing/linking me with an existing application, exe would be even better. ;)

Thanks for your inputs.
Most graphic libs I've seen don't have circle drawing functions. They're mostly polygon rendering and/or pixel level access.

You're better off with a widgetry lib, since those often include functions for basic shapes like circles. The problem is none of them are simple -- especially not if you've ever made a gui-ish program before.

There are crossplatform options available, like wxWidgets and Qt. Or you can go with something Windows specific, like MFC or WinAPI.

For WinAPI, it looks like drawing a circle can be done with the Arc() function:
http://msdn.microsoft.com/en-us/library/dd183357(VS.85).aspx

From the remarks: "If the starting point and ending point are the same, a complete ellipse is drawn."

So you can just give the bounding rectangle, then give the same start/end point and you'll have a circle.

That isn't so hard, but to make that function work you have to set up your entire program to be WinAPI, which can be a lot of work.
The SDL is simple, but the only primitives it has are pixels and solid rectangles. There are other libraries designed to work with the SDL that do have things like lines and circles, both regular and antialiased.
Is there any simple graphics library in C++?


SDL is a C API, which is perfectly fine and very easy to learn, however if you are looking for an API writen purely in C++ take a look at SFML http://www.sfml-dev.org/ which is comparable.
The function for drawing circles in the windows api is the ellipse function.
I would also recommend you to SDL.
http://lazyfoo.net/SDL_tutorials/

If you are willing to use something other than C++, I recommend you go play with Tcl/Tk.
http://wiki.tcl.tk/
The canvas widget is very powerful and will make it much easier for you to implement this kind of functionality. (Of course, you'll have a bit of a learning curve there.)

Good luck!
You could also use Allegro:
http://www.allegro.cc/manual/

You can make circles (also known as a primitive) with one function call.
I personally find it easier to use allegro than SDL but I supposed it's a preference thing.
Last edited on
Old and depricated... but easy to use and lightweight non the less..
SVGALib

http://en.wikipedia.org/wiki/SVGAlib

Links to the sources are at the bottom of the wiki.
Topic archived. No new replies allowed.