Fast Vector rendering library for C or Python - graphics

I'm looking for a library like Cairo, just far faster. It has to be a library that works with C or Python. It also would be nice if I could output to PNG, and SVG. I am looking at Qt's arthur, but that's C++, and I'm not a fan.
Any suggestions?
Edit: another precondition is that it has to run under Linux.

Python has aggdraw

I don't know what's fast, but here's a rendering comparison.
Edit: Apparently Xara is supposed to be much faster than Cairo.

Google's Chrome browser and Android platform make use of their Skia vector library.
I heard second-hand that Vladimir Vukicevic has quickly ported Cairo to be able to use Skia. A quick googling seems to confirm it:
http://people.mozilla.com/~vladimir/misc/cairo-skia.patch
Not sure when or if this is mainstream, but I'd anticipate a major speed-up across the board!

OpenGL?
It can do 2D pretty well. :)

Related

Writing a Linux Terminal emulator

I'd like to write a x11 terminal emulator, but I don't know how I should spawn and communicate with the shell, is there any basic (pseudo- or C) code for that? like what sort of PTY to create, how to bind the shell to it, what signals I have to catch or send, etc. don't really feel like sorting through the whole xterm sources.
EDIT: oh and I want to implement a way of communicating with any applications in it, how shall I do the feature discovery? some hidden ansi sequence in the "clients", hoping it's not colliding with other terminal emulators? some environment variable, hoping it's not colliding with the "clients" or removed by the shell?
YAT (yet another terminal) https://github.com/jorgen/yat is suitable for embedding in Qt Quick programs. Contributions for improvement are welcome. (Disclaimer: a friend started that project, and I work on it sometimes.) It takes a mostly correct approach (e.g. it uses a Linux pseudo-terminal properly, something I didn't know about before my friend was explaining that), and has a lot of features; however the parser is written from scratch and is not feature-complete or bug-free yet.
Unfortunately most terminal implementations so far have been starting from scratch, or with a one-off monolithic fork (from rxvt for example), which is a lot of work and results in all of them being incomplete. So I think a better alternative would be to use a reusable logic-only library called libvterm: http://www.leonerd.org.uk/code/libvterm/ or to base your terminal on one which already uses that. That way if you find bugs and fix them, you'll improve the whole ecosystem.
https://github.com/timmoorhouse/imgui-terminal is interesting, and works (at least somewhat) but is a prime candidate to be rewritten with libvterm, IMO. If you are into immediate-mode rendering in OpenGL, it might be a good choice anyway.
http://41j.com/hterm/ does use libvterm, and adds a few features which libvterm doesn't have, for inline graphics rendering (ReGIS and PNG). But the code is not elegant enough or portable enough, IMO, and the graphics rendering "floats" over the text rather than being truly inline. It still might be an adequate starting point for some use cases. In my fork https://github.com/ec1oud/hackterm I got it to build with mostly modern system libraries, however it still depends on an outdated version of SDL, which is included.
OK, if anyone also need this, and is using lua, I found the http://www.tset.de/lpty library works fine. still testing ansi escapes and stuff, but should work.

Haskell `ncurses` library

I would like to use a text-based UI in my Haskell program. I found some bindings for the ncurses library (see also hscurses or ncurses, which one to use?). The hscurses and nanocurses packages are just simple wrappers around the C library, while vty isn't very well documented and a bit ugly (for example mixing snake_case and CamelCase).
The ncurses library on Hackage looks much more pretty and provides API which nicely fits Haskell. The problem is that it doesn't seem to implement some crucial features, like resizing or refreshing the windows.
So my question is:
is there any other Haskell text UI library, either ncurses-based or not, which I missed?
if there isn't anyone, is it possible to extend the ncurses Haskell library to at least support window refreshing and resizing? (this should be probably consulted with the project owner, but I need the solution quickly)
EDIT:
I finally used nscurses without windows (and panels) to avoid the troubles with refreshing them. I had problems with output to bottom-right corner of a window (a very similar issue was reported for Python's ncurses binding). I solved it by not writing there :).
Have you looked at vty-ui? It has a very nice user manual with lots of examples. I believe it's essentially a wrapper around vty.
I've used nanoncurses and hscurses succesfully, my hmp3 app has a binding that was the basis for nanocurses.
No matter what you probably will want a nice high level API. hscurses does have a box abstraction at least.
You'd be fine going with hscurses.
There is another good choice for Text-based user interfaces in haskell;
Brick is written by jtdaugherty, the same person that developed vty-ui which is Deprecated now.
The API is Declarative, which is Better for Presenting a language like Haskell.
also the Documentation was great and complete.

CSG library doing volume difference?

http://en.wikipedia.org/wiki/Constructive_solid_geometry
I'm much interested in doing what the first pictures describe on this article, only that I'm only interested in doing it on parallelepipeds (cube-like shapes), so no sphere or tube or circular shapes whatsoever.
There is this library, http://www.cgal.org/ , but it has a lot of features, and I don't know if it does what I'm looking for, and if yes, what parts could I use ?
Do you know any other library that does what I want ?
C/C++ is preferred over C#/java, but I'm open... The goal being to not reinvent the wheel.
If you need only rendering (no mesh generation), look at this.
If you need to generate new mesh:
UnBBoolean/J3DBool (Java)
J3DBool ported to C++, modified for QT, modified for Ogre
Carve (C++) (it is used in Blender, but I was unable to make it work + obsolete documentation)
GTS Library (C++) (maybe too overkill)
Personaly, I picked Ogre version, rewrote to use STL containers (it use fixed size for face count) and slightly optimized.
A list of libraries can be found here

simple game development on linux

I'd like to develop simple 2d games on linux. Something like one below. The only decent tecnology I've found was PyGame. Is there any other worth taking a look? Is there a possibility to develop flash games on linux?
Thanks in advance.
I will have to agree with previous user , pygame is an amazing powerful and easy to use library.
Now about your flash games, there is a back door.
First forget about flash. Yes I know that this seems a bit out of topic , but no worries you can compensate for this.
Now python has something called Pyjamas, dont laugh its actually a very serious package. What pyjamas does is to convert python code to javascript code, all this happens automatically and you dont need to know a single line of javascript , even though knowing javascript could help as well. Of course the benefits of converting python to javascript means that not only you can run python apps inside any browser and any device supporting a browser including iPad, iphone, and pretty much anything else you can also use javascript libraries. Actually you can use only javascript libraries , so forget about using pygame with pyjamas.
Now HTML5 is the future, its still an ongoing project and far from finished, but YouTube already is using it with alot of success. Html5 together with the new version of javascrip offer features very similar to Flash, with the added advantage unlike Flash which is tied to Adobe , HTML5 is open source and a web standard. That means that borwser support Html5 out of the box with no need to install anything. So you could use HTML5 and Javascript to build your browser games. I think that HTML5 will replace the Flash in the near future. Remember because you will be using pyjama you will writing your code in python only, but of course you could mix it with some javascript code if you wish so.
I will advice for the time being epxlore pygame , because its dead easy to use, and when the right time comes and feel confident with python, take a look at pyjamas and fire away your browser games. The important thing to remember is that unlike other easy to lear language Python is a serious language used for almost anything, so you never run out of option. So do your coding and have fun.
Oh in case you need to check out pyjamas its right here.
Pyjamas Website
Here's a list of some open source game engines in general. You'll want to look at the cross-platform, 2D-oriented engines and see which one best meets your needs as far as programming language and features.
However, PyGame is pretty well-developed, and Python is an exceptionally easy and fun language to do anything in, including game development. I recommend you check out PyGame first, I think it would work well for your task.
As for developing flash games on Linux, there's little chance of that. To develop flash games you need Adobe's suite, and it is only compatible with Windows and Mac. So unless your computer can handle the stress of Adobe software (which is pretty high) in an emulated environment (Wine, which adds considerable hardware overhead), you'd need Windows or Mac OS X to do that. You can still play them, however.
There are flash libraries for games that work in linux. It's a but more of a pain in the ass but maybe all the hassle will teach you a thing or two ?
Here are some usefull links
http://flashgamedojo.com/go/
http://www.flixel.org/download.html (mentions some linux options)

Is there any 2D renderer library with complete fixed point support for embedded linux?

I am working on embedded linux, Is there any open source 2D renderer available which can draw on memory, scanline based, complete fixed-point support.
I work in c or cpp programming language.
I know one with which satisfy my all needs that is, Google Skia which google uses in android and chrome, But I found it without documentation, not straight-forward compilable, not straight-forward usable in 3rd party projects.
Regards, Sunny.
Checkout Cairo. I am not sure what you mean by "complete fixed-point support" but other than that it seems to meet your requirements.
Allegro is a games library which includes extensive software rendering, most of which does not rely on floating point. Additionally it has some trig functions and maths functions which work on fixed-point. It has things like sprite-rotation which don't need floating point.
Don't know if it's what you're looking for, but there's libcrtxy
http://libcrtxy.sourceforge.net/
DirectFB.
If you want hardware acceleration , directFB is the most portable way to go.

Resources