Are there some libraries with C API to draw pictures? - c

Are there some libraries with C API to draw pictures? Just like the library matplotlib in python. I will use it to draw lines, dots, circles and I hope it has detailed documentation and opensource. My platform is gentoo.

The most comprehensive one is probably ImageMagick. They suggest using the MagickWand API.
Other options are cairo, with a image buffer output device, or maybe libgd.

There's no such functionality in the C standard library.

Depends on your needs. Maybe you can use
SDL
SFML also has C bindings
These are game engines (full list of them here - check with C bindings), but you can also use them for drawing plots and etc too.
Also you can check - maybe you can include Python bindings in C, and after that - run Python code (matplotLib) from C ?

One popular choice is SDL. I'm not familiar with matplotlob, it's possible that SDL is (quite a bit) more low-level than you expect.

If you running linux and compiling with gcc, the most obvious choice would be plotutils. It has both a C and a C++ API.

Related

Making a GUI simulator in C

Hello StackOverflow Community,
I am writing a MicroMouse Simulator in C language. And I wanted something to visualize the way the maze is being solved like this -- http://www.youtube.com/watch?v=N9TkDgJNJso
I've been researching a way to accomplish this, but I haven't found anything with enough documentation to accomplish my goal.
I don't want to implement this using ASCII symbols, to me it doesn't look professional.
Is there any good GUI interfaces that I could use in C to help me accomplish this? And if so, how would I use it? I don't mind having to code in another language like Java or Python to accomplish my goal.
I saw the video that you want to make. After watching the video I feel you don't need a GUI library for this simulator program.
Here is a list of libraries that you can use.
1.OpenGL This is a 3D graphics API which also can be used for 2D and can be used with both c/c++
2.SDL This library is easy to understand for a beginner. For your program this library is better and can be used with both c/c++.
3.winBGIm This is same as the graphics.h that you found and can be used both c/c++ but it is only for windows.
If you are looking for GUI library then here's a short list.
1.GTK This is written in c and is a popular GUI library for c. You can find a GUI editor for gtk forms called glade which enables quick & easy development of user interfaces.
2.WxWidgets This is written in c++ so you have to use c++ rather than c.
3.FLTK
There are many more libraries besides these which you can find in google. You said
I do not mind having to code in another language like Java or Python to accomplish my goal.
Then for java you can use swing and If you are windows developer then use the windows form application in visual c++; then development of your program will be very easy.
SDL is one of candidate for C in order to make GUI Simulation. Lazyfoo is one of the best site I found for beginner.
SDL is strongly portable. It's written in C and there're a lot of documentation and tutorials.

Making charting in C

How do I make charts in C language? do I need to learn X11/OpenGL or equivalents and advanced math knowledge either there is a lib to do it for me? the requeriments is be written in C,portable(UNIX/Windows) and allow use in proprietary software not open source.
By assuming doing by X11/OpenGL/Allegro etc how hard is this? I've never touched at such libraries.
Another question that come to my mind now: It's possible do it by using Gtk+?
You could use GNU Plot. It has C API.

What lib is usually to be used to develop a simple game like Tetris?

I am going to develop a Tetris in practice. But I have no idea how to start it, especially the graphic part - how to draw the frame and blocks? how to move them on screen?
Could you please you refer me to some useful libs or tools?
Programming language is c. (if this is done, I am planing to do it again with c++ and python. :) Both Windows or Unix-like is ok. It's better if it is portable.
I know openGL, and DirectX is heavy-weight lib. dose it efficiently fit to a small game like Tetris? Any light-weight? which is better?
I would appreciate if you could refer me to some materials or links for this.
Thanks.
If you'd like to keep your game in a window and not full-screen, then any library that implements some type of paintable canvas widget will work. Cross-platform candidates include Qt, WxWidgets, FLTK, GTK+, etc. If you want to remain on a single platform like Windows, then you can use a lower-level Win32 API like GDI+. As I mentioned in my first sentence, with most of these libraries/API's, you'd be looking to use their paintable canvas widgets, allowing you to draw the characters shapes on the window. You'd also use some type of timer event to periodically update the drawn window at fixed time intervals.
You can use SDL - is simple and many platforms are supported
I would suggest SDL or Allegro. Both provide simple ways of getting input and doing graphics and audio output. And both are multiplatform.

User Interface for C-code

I've written a code in linux OS which produces prog.out as output file.
Now I've to write GUI for the code.
what are best ways to write it?
PS - I wanted to choose between Java Swings and openGL.
Which is best for writing a simple GUI and integrating it with my C- Application
Thanks in advance
OpenGL is a rendering library, not a UI toolkit. Comparing it to Swing doesn't make sense. And you can't choose Swing for a C application, unless you'd rather do the UI in Java and interact with a C "backend".
For a pure C solution, the best choice would probably be the GTK+ toolkit.
Try Anjuta...
http://projects.gnome.org/anjuta/
If you are prepared to use another language (you mention Java) then you may find C++ and Qt to be a good fit. Linking to the existing C code will be trivial and Qt works well on a great many platforms should you ever wish to support other platforms in addition to Linux.

Is there any crossplatform C library for using Pixel Shading filters?

Is there any crossplatform C library for using Pixel Shading filters? to run pixel shader inside your programm, beter as native part of your programm (not like precompiled file), and better for using with abstract data - not only images
Does this do what you want? http://www.khronos.org/opencl/ The question is not very detailed, or clear, but I think OpenCL qualifies as an answer...
OpenCL or CUDA are the closest to what you want.

Resources