What simple C graphics library would you recommend? [closed] - c

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed last year.
Improve this question
I'm learning C and I would like to start graphics programming, but start it simple, without spending hours just to understand what functions will I need.
I would like something to draw pixels, squares, maybe sprites, simple stuff, like in BASIC.
I tried SDL and got overwhelmed very quickly. Same with Allegro, it's hard to get it to work on Xcode 4 and documentation is lacking.
Maybe there is some custom one? Also would be nice if it works on Mac OS.
Any book recommendations are welcome, like simple C graphics programming or game programming, whatever.

If SDL is overwhelming, perhaps graphics programming is not the place to start in C. If you want to get familiar with the concepts involved in coding up graphics, try it in a higher level language like Python (with pygame or pyglet.) Most high-level languages have good bindings to graphics libraries. If you really want to learn C by writing games, maybe something more text-oriented (ncurses-based?) is appropriate.
Once you understand the fundamental idioms of graphics programming, applying them to different languages becomes much easier. You'll be able to go from pygame to SDL in C without too much extra pain beyond that inherent in going from Python to C.

I'd go for QuickCG. Here you can find sources and some tuts.

The best you can use at least which is both portable and now almost an industry standard, simple graphics can be done using OpenCV. This is not limited to just drawing lines or primitives, or should I say simple graphics, I have used it for industry standard image processing products and computer vision problem solving. This will be fun if you start learning it. OpenGL is also another place to start. It might well suit what you want. Mostly related to graphics, rather than computer vision or image processing

Another option would be to investigate the Postscript language to get a feel for the stencil/paint image model. And then you could more easily get started with Cairo which implements the same model. A big advantage to the stencil/paint model is device independence. With Cairo you can perform the same drawing commands to output to a window, an in-memory pixmap, or a pdf file writer.

"g2 graphics library" is the most simple. The programming language is C. But does not support "only" 64 bit systems (it supports 32 bit like Mac OS Mojave, and Ubuntu, have not checked up with Windows MSYS MinGw). To create User Interfaces i recommend FLTK (Fast Light Toolkit) with the UI-builder Fluid.
https://sourceforge.net/projects/g2gl/
https://www.fltk.org/software.php

Related

GUI-Library for microcontroller [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I want to create a GUI driven application for a micro-controller (Atmel XMEGA) that is connected to a 128x64 dots graphics LCD (EA DOGL128-6) and 4 buttons for navigation.
Controlling the display itself (e.g. drawing pixels and characters) is no problem but in order to prevent me from reinventing the wheel I was googling for a GUI-Library/-Toolkit that is written in c, includes its source code, will run on a 32 MHz 8-bit micro-controller and provides at least the following controls:
panel (to group elements)
menu (scrollable)
icon
label
button
line-graph (optional)
But I didn't find any thing useful. Does anyone know (or better uses) such a library(preferably for free)?
I would consider rolling your own "immediate mode" GUI. Jari Komppa has a good tutorial about them. It's a lot easier than you may think, and you'll probably find most GUI libraries--even those targeting embedded systems--are a bit heavy-weight for your system.
If you insist on using a third-party library, below are a few I found. I've never used any of them and they are probably fairly expensive.
emWin
C/PEG
easyGUI
I personally used PEG (at work), but it is not for free. You just need to write a small layer of adaptation and use it. You can also look at Qt or minigui.
I also wrote a library which supports nearly any display technology: µGUI
http://www.embeddedlightning.com/ugui/
µGUI is a free and open source graphic library for embedded systems. It is platform-independent and can be easily ported to almost every micro-controller system. As long as the display is capable of showing graphics, µGUI is not restricted to a certain display technology. Therefore display technologies such as LCD, TFT, E-Paper, LED or OLED are supported. The whole module consists of two files: ugui.c and ugui.h.
This might be helpful as well
You should take a look at Contiki [wikipedia.org]
Besides being a small and elegant operating system for many 8/16/32-bit microcontrollers, it also features a GUI toolkit. It runs on the Atmel AVR!
For your convenience, here is a direct link to the The Contiki Toolkit (CTK) source code.
In addition to Judge Maygarden's list RAMTEX provide libraries specifically aimed at small graphic LCDs. Again not free, but is this is for commercial use, remember that if you did it yourself, it may take many man hours to achieve a polished product, so consider that before building your own.
At the rates my company accounts for my time (as opposed to my pay rate), if it took more than five hours, I'd be better off buying the Ramtex library (about two days if you only take my pay rate into account). If however you have the time and inclination, it is not a difficult task, and probably fun.
Rich Quinnell mentions
"... I saw a demonstration of Java applications running on an STM32-F3 MCU..."
http://www.microcontrollercentral.com/author.asp?section_id=1741&doc_id=253618
I guess it is what you are looking for?
Atmel (now owned by Microchip) actually makes a GUI library targeted at their microcontrollers.
This is part of the now called Microchip® Advanced Software Framework.
You may want to have a look at the Nano-X framework (formerly known as Microwindows): http://www.microwindows.org/
It claims to support down to a 16-bit DOS system, so I'm not sure if it's suitable for an 8-bit, but maybe the library can be pared down to just what you need.
I haven't used it, but at one point was considering looking into using it for some simple display UI (though on a 32-bit ARM system). Unfortunately, the project shifted gears before I actually did anything with it. I'd be interested in what your take on it is (or how well it works if you decide to try to use it).
We've started using easyGui and it seems good. You design the screens in a PC app then it generates the source code - making the design stage really easy.
It does most of the things on the list. Line graphs are coming soon. You can make up buttons pretty easily as reusable structures.
It comes with template drivers for lots of displays - depending on how closely the template matches your display (colour depth & interface are the biggest issues) you might be able to use the code unmodified or change it to suit.
I have been working on a similar project. Closest thing I could find are in the following links, but I doubt you will find a library with all the features you desire. These will only setup basic drawing functions, but it's a start. There are also some useful tools for bitmap converting and font creators if you dig around.
http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/glcd_dcf77/index.html
http://en.radzio.dxp.pl/
Almost everything else I have seen here is way overkill for what the poster seems to be asking for.
The CodeVisionAVR development environment now has graphical libraries for XMEGA.
The CodeVisionAVR C Compiler features a powerful graphic library for
LCDs with resolutions from 84x48 up to 800x480 pixels.
However, it is not free.
You can use the "Microchip Graphics Library" for free.
This includes GUI tool "Graphics Display Designer X" for designing screens and this outputs the "C" files for your designed screen.
I am using this tool which is very user friendly, but some of the widgets what you are looking you may not find.
Here is the link for GUI tool:
Click here!
NuttX is a real-time operating system for microcontrollers. The author has starting a developing some gui primitives for LCD displays for it.

Cross Platform C library for GUI Apps? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
The community reviewed whether to reopen this question 8 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
Free of charge, simple to learn/use, Cross Platform C library for GUI Apps? Am I looking for Qt?
Bonus question: Can I develop with the said library/toolkit on Mac then recompile on PC/Linux?
Super Bonus Question: Link to tutorial and/or download of said library.
The truth is that I'm in the process of catching up on the C family (coming from web development - XHTML/PHP/MySQL) to learn iPhone development.
I do understand that C is not C++ or ObjectiveC but I want to keep the learning curve as simple as possible. Not to get too off topic, but I am also on the lookout for good starter books and websites. I've found this so far.
I'm trying to kill many birds with one stone here. I don understand that there are platform specific extensions, but I will try to avoid those for porting purposes
The idea is that I want to write the code on one machine and just compile thrice. (Mac/Win/Linux) If Objective C will compile on Windows and Linux as well as OS X then that's good. If I must use C++, that's also fine.
If you are looking for a C++ library, then Qt basically does what you are looking for. If you want to stick to pure C, then Qt is not an option.
As a C framework you could use GTK+, it works on Linux, Windows and OS X.
Take a look at the IUP Toolkit. It is written largely in C, and is also easily bound to Lua.
To complete this post Allegro has to be here =)
http://www.talula.demon.co.uk/allegro/
Allegro Game Library, have many graphics functions and a basic GUI library
And an explicit gui (and very simple) Allegro based library
http://cgui.sourceforge.net/index.html
Both multi-platform
Another option is Tk, which is a GUI library written in C. It comes with Tcl, a scripting language also written in C. These were designed from the ground up to be embedded in C programs.
One that I have considered using was the EFL, as it's quite fast, simple, small, but powerful. I would recommend diving into Elementary, their simplest GUI toolkit, and then later on, once you get comfortable with it, move to EDJE, which is not as simple, but much more powerful.
Qt is a C++ library. Other cross platform libraries that you might consider are wxWidgets (C++), and GTK (C).
All three of the presented libraries are fully cross platform. You can also look at Tcl/Tk, but that's a toolkit :).
You tagged this question about qt, which is a tag I follow. However, you are also asking with regards to c programming.
If for some strange (or domain-enforced) reason you feel you must use C and not C++, then Qt is not for you. It was designed from the ground-up as a C++ library.
Yet I'd strongly suggest questioning why your project would need to be in C. There are many benefits to C++, and the idea that C performs intrinsically better is mostly a myth. For some hard data on that, check out Bjarne Stroustrup's Learning C++ as a New Language.
If you must stick to C then there's always GTK. The underlying API of GTK+ is C, but bindings also exist for C++ called GTKmm. I'm not a big fan of it from a design perspective, but historically powered the Gnome desktop (Ubuntu's default)...and Google chose it for their version of Chrome for Linux. So it has some cred and support there.
But do note that Ubuntu is choosing Qt5 to implement their next version of "Unity" in the desktop:
https://askubuntu.com/questions/281092/why-is-canonical-choosing-qt-over-gtk-for-unitys-next-generation
EDIT: You added:
If I must use C++, that's also fine.
"Must" is a strong word, but there is practically no comparison between C++/Qt vs. C/GTK. And the latter is becoming a thing of history.
Take a look at the Ecere SDK. It offers a cross-platform GUI toolkit, and gives you eC, an object-oriented language derived from C (with all of its functionality) that is just great for building GUIs.

A Simple, 2d cross-platform graphics library for c or c++? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
As in title, i need a 2d graphics library that is cross-platform, and provides simple functions, like in Basic; essentially, i only need to paint a pixel a certain color-I do not need hardware acceleration, or any kind of 3d support. I've found a couple ones, but they're not cross-platform.
Anyone knows a solution for me?
What about SDL?
Perhaps it's a bit too complex for your needs, but it's certainly cross-platform.
Am I missing something to wonder why noone suggests OpenGL? To use it for 2d would be very simple. The OP only wants to color a pixel. It doesn't get simpler than glBegin/glColor/glVertex/glEnd.
Qt 5
GTK+
Cairo
and many many more ...
[In no particular order.] However, if you have any other requirements, let us know. BTW: I am not just posting results of a Google query here, I have used all of these (and SDL -- wrote my first few games in SDL :) and I'd say without a set of requirements, it's very difficult to choose among the ones listed.
Heavy-weight:
GTK
QT
WxWidgets
Lightweight:
FLTK
Fox
Tk
Lua IUP
Ultimate++
dlib
Drawing frameworks without GUI widgets:
SDL
Cairo
http://www.allegro.cc/
http://en.wikipedia.org/wiki/Allegro_library
One neat engine I came across is Angel-Engine. Info from the project site:
Cross-Platform functionality (Windows and Mac)
Actors (game objects with color, shape, responses, attributes,
etc.)
Texturing with Transparency
"Animations" (texture swapping at defined intervals)
Rigid-Body Physics
A clever programmer can do soft-body physics with it
Sound
Text Rendering with multiple fonts
Particle Systems
Some basic AI (state machine and pathfinding)
Config File Processing
Logging
Input from a mouse, keyboard, or Xbox 360 controller
Binding inputs from a config file
Python Scripting
In-Game Console
Some users (including me) have succesfully (without any major problems) compiled it under linux.
I would recommend DISLIN. It's cross platform, has support for many languages, and has very intuitive naming of routines.
Also, just noticed that nobody mentioned PLPLOT, also cross platform, multi lingual ...
Picasso graphic library you can used: cross platform
https://code.google.com/p/picasso-graphic/
A cross platform 2D graphics library for .Net is The Little Vector Library
You could use it in conjunction with Unity 3D (recommended) or Xamarin, for example, to create 2D graphics on a variety of platforms.

Where can I find a simple graphics C library for writing directly onto a frame? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I need a simple graphics C library to use on a device where I will be writing directly to the frame.
The frame is located in regular memory.
There is no graphics acceleration hardware.
Nothing fancy. I just want to be able to draw lines, circles, OSD stuff like strings as well.
It would be nice to have functions that use good, lean algorithms (my CPU is an ARM9 running at 400MHz).
What are some recommendations for this?
For very simple needs (lines, circles, polygons, text) I have always just made my own. Check out bresenham's algorithm for lines and circles, Wu's modifications for antialiasing on circles and lines.
Gimp will output C code for images, which is what I do for fonts, and drawing them is pretty easy. I have used anti-aliasing (gimp --> grayscale, use the grayscale value as the alpha), but haven't done proportional fonts. They aren't much harder, and can make the display a bit nicer, but I haven't needed them yet.
Polygons are simply multiple lines, and filled polygons are quite fun to implement.
It's not a lot of work, and you'll grow from the experience.
If, however, you decide you want to render SVG or some other complex vector language, then a library is in order. But for simple things, this isn't complex.
-Adam
I'd like to second OpenGL, especially the OpenGL|ES variant.
Here is a link to a Software based OpenGL-Renderer: http://sourceforge.net/projects/ogl-es
I've spend the last three years writing commercial software rasterization codes on ARM9 and similar processors, so I think I can comment on use of cairo and other high level APIs:
They work very well and are incredible powerfull, but on a target as limited as an ARM9 you will never be happy with the performance. The graphic libs are written with your typical Desktop PC in mind, and they trade precision for performance. This is nice for high quality SVG rendering, but to slow on a humble ARM.
The Vincent OpenGL|ES I've suggested above has a on the fly dynamic code generation engine for ARM-CPUs in place, so you get almost the performance of hand-optimized assembler code.
If you can limit yourself to just one bitmap-format, just two blend-modes and a hand full of rendering primitives you may get better performance by writing a dozen of render-routines yourself. Depending on your experience and requirements that can take anything from two days to a month though..
Cairo is pretty powerful and easy to use. I think Mozilla uses it as the basis for the <canvas> element and the SVG renderer.
From your requirements it appears you need something like an embedded framebuffer library (or whatever it is called). I played around with some of the following a few years back for an embedded browser (which didn't make it to the market). Unfortunately, I can't remember much to give you any analysis. Have a look:
DirectFB
GTK/X (or a port using directFB)
Cairo (as another poster has suggested -- this is very powerful)
Also, this article may be of interest.
Try SDL. From the web page:
Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer. It is used by MPEG playback software, emulators, and many popular games, including the award winning Linux port of "Civilization: Call To Power."
OPenGL has a set of 2d functions, not sure if it is too bloated for you or if it can be trimmed down. It is written in C, at least.
I found the Adafruit GFX library to my liking.
Very very simple and basic:
https://github.com/adafruit/Adafruit-GFX-Library

Best way to get started with programming other things than your computer? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
What is the best way to get started with programming things outside of your computer?
I don't mean mainstream things like cell phones with APIs.
Please assume working knowledge of C/C++
I vote for the Nintendo DS:
Nice hardware : 2 CPUs, 2 screens, touchscreen, mic, speakers, wireless, 2D and 3D acceleration
No OS to speak of
Freedom to talk to the bare metal without restriction
Well-documented
Very active dev community
Enthusiastic audience for anything cool you create
Cheap (shockingly so if you go for 1st-gen units)
All-in-all it's really excellent fun to play with.
To get started:
Get a DS
Get a SLOT1 flash-cart (I've got a DS-X, but there are plenty of others)
Get devkitpro
Go here for help or advice
Brian, you might find the Arduino interesting. It is inexpensive and pretty popular. I started playing around with micro controller boards and such a few years back and that lead to an interest in robots. Kind of interesting, at least to me.
If one is interested in a .NET-flavored development environment, there is an analog to the arduino call netduino that is worth a look.
Embedded programming is fun.
You can start with things like the Basic stamp or PIC, or since you know c/c++ you can use a real microcrontroller like an Atmel AVR. look at the Butterfly or Arduino kit
The Arduino has an amazing community of projects and info behind it.
It's not a microcontroller, but the Lego Minstorm is a good place to start learning the ins and outs of embedded programming.
I recently heard about the BUG which calls itself "open source hardware development". Is this the sort of thing you're looking for?
Buy yourself an HP 10C Calculator, and then program all those "programming 101" math algorithms using its insanely small but practical calculator language. Reminds me of assembler, but it's not.
I'd strongly recommend to find an open-source project next to one of your leisure occupations.
First, open-source because the support is mostly very friendly, then open-source because other contributors will have at least one comparable hobby, and then favorite pastime occupation so you can see a need for tools etc.
Two projects I have been playing around with very successfully:
Music: Rockbox, a firmware replacement for many mp3-players and portable media players.
Photography: CHDK, a firmware addition to numerous Canon compact still cameras.
Give SparkFun a shot. For me, servos are what I love to hack around with.
You can try with BeagleBoard, though its kind of mainstream, nonetheless very impressive performance to speak off at just 149$.
I'd look into stuff like (unofficial) GBA development or the like, sure there are "Libraries" but you can go digging and just stick bits into specific addresses and make stuff happen. You can't get more "No API" then raw memory-mapped hardware access.
Maybe start with small microcontroller projects.
This may be helpful: http://www.kmitl.ac.th/~kswichit%20/
What sort of things do you want to program?
Sounds like you might be interested in MAKE magazine, and some of their compilations, such as Making Things Talk. With a little bit of experience with basic electronics, you can follow their recipes to do all sorts of odd and interesting things. When you get more comfortable, you can start modding their designs.
Good luck, :)
I have personal experience and would recommend using these products to program PICs:
Programming board
GCBasic (Open Source Basic)
The PICs are cheap ($2 bucks or so) and the board will cost you around $120.
Recently, I have been impressed with TIs wireless USB chips/programmers. You can get 2 chips and a programmer for $50 bucks. It also comes with a free C compiler. By default it comes with a sample remote temperature program.
TI wireless target board
I think it's fun to hack old iPods. You can get a fourth generation iPod (or any of a number of supported devices), run Rockbox on it, then get the source and help hack on it.
I would also recommend AVR (8-bit) and Butterfly or DB101 kit. The main advantage is that there is a GCC compiler available and that you can program them through the Serial Port, without the need of a tool. Inexpensive programming and debugging tools are also available. There is a very strong AVR community in AVRFreaks
Another alternative is ARM7 and ARM9 microcontrollers (32bit). If you are interested in using an OS (ucLinux/FreeRTOS for ARM7, Linux for ARM9), you should go that way. There is of course a free GCC compiler. You can buy kits and tools at Olimex
If you would like to create a cool gadget using a microcontroller as a learning experience, you can look at the starter kits from Rabbit (website). They have a variety of low-cost kits with 8-bit microcontrollers to get started with a particular technology.
There are a lot of programmable robots around. In fact, even some of the Roombas (automated vacuums) can be programmed. This is particularly good if you want to teach kids how to program.
If you have a Nintendo Wii, you can crack it using Twilight Princess. You don't even have to buy it. I just rented it for a couple days. Go to WiiBrew.org and check out some of the projects that are available there. Most if not all are open source, and should give you a good starting point. Lots of ports of existing stuff, along with some original programs written specifically for the Wii. You would of course do the programming on your computer, and transfer the compiled binaries to the Wii. I haven't looked into how hard it is to get a development environment set up and having it build for the Wii, but if you email they project maintainers from wiibrew.org, they may be able to set you up.
[EDIT]
Just browsing around, I found DevkitPro, which seems to be the toolkit of choice for developing on many different console and handheld systems, including the Wii.
To ease yourself into embedded programming, you may want to try using XNA for either the Xbox or the Zune. You won't be doing memory management, but you'll get used to the constrained hardware if you do it on the Zune. Admittedly, it's using C#; but you could always do the programming itself using CIL.

Resources