You are not logged in.

#1 2015-07-23 23:49:00

young lust
Member
Registered: 2013-06-09
Posts: 9

Choosing the library for working with primitive graphics

Hello everybody.


I work on developing firmware for pos-terminals (device which u could usually find on cachedesks and in which u could put ur credit card).

I write it in plain c. The problem is, when its code is changed even a little bit it is necessary to compile it with special compiler, load to device's memory and start it, waiting while it gets started. It really does take much time! So, i decided to suit its code to be compiled with simple gcc and to run in simple environment, like x86 linux. So it will be kinda emulator of that device.
The most accuracy is needed when i work with LCD display: all the messages should be properly aligned and fit lcd's sizes. Also, to make myself satisfied fully, just for lulz, I would like to make it good-looking. For that, i want to emulate lcd-screen in linux with predefined amount of pixels on it, and probably even buttons of this device.  So, i need some graphic library but don't know where to dig. It can be in balck-white colors and can be very simple.

gdk, xlib, cairo, gtk+ ??


Could anyone advise me smth?

thnx in advance

Last edited by young lust (2015-07-23 23:49:34)

Offline

#2 2015-07-28 22:31:22

hipersayan_x
Member
Registered: 2014-12-09
Posts: 36
Website

Re: Choosing the library for working with primitive graphics

Does your program works in an embedded device? for primitive graphics, near to hardware, you can program the framebuffer, check this.

Offline

#3 2015-07-28 22:41:54

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,532
Website

Re: Choosing the library for working with primitive graphics

xlib would certainly suffice, but cairo would provide a lot more flexibility, and the ability to scale.  For example, with cairo you would create a drawing surface of precisely the size of the LCD monitor of the real device.  Then cairo would handle all the scaling of these device-space coordinates to screen/window coordinates - in otherwords, when the emulator window resized, the simulated display would resize, but your code could remain (mostly) blissfully ignorant of the actual window sizes as you'd still be drawing on a cairo surface with the width and height of the LCD screen.

Of course with cairo, you'd still use xlib or something else to handle events.  But this is very easy with xlib.

If you wanted your emulator to be cross platform, you might consider (free)Glut, SDL, or SFML.  As you are probable not concerned with integrating perfectly with any major DE, one of these might be a good way to go.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2015-09-15 15:16:54

young lust
Member
Registered: 2013-06-09
Posts: 9

Re: Choosing the library for working with primitive graphics

thanks everyone

Offline

Board footer

Powered by FluxBB