As a beginner I tried to start with cairo on nim.
I did:
I am of course aware that I do not have cairo on my PC, but unfortunately I have no idea how to do this in a proper way.
Can someone please give me a step by step guide on how to get this cleanly on my computer so that the tests in Cairo work properly?
You could also use the Cairo lib provided with the gintro package of course.
But that would not really help you when you have no idea how to install the cairo libs on your windows PC unfortunately.
If you are not really interested in GTK, but only in a drawing App you may also try a pure Nim one: https://github.com/treeform/flippy
The ggplotnim README has a section that deals with this issue (which is windows-specific).
The problem is that libcairo-2.dll needs many dependencies. Possible solutions are:
I think last option is the best one.
Thank you for your quick response
I did this:
Then I run:
I got NOT errors now but there was NO output on the Screen. What is wrong?
That fill_and_stroke.nim just outputs to a PNG:
https://github.com/nim-lang/cairo/blob/master/tests/fill_and_stroke.nim#L27
NO output on the Screen.
You may have to learn what cairo lib really is :-(
Cairo is a 2D vector drawing lib with various backend. Most used backend for examples and test is PNG, so the example creates a PNG image which you may inspect with a tool. On linux we use eog or gimp for that.
If you like screen output, then one solution is the GtkDrawingArea backend. Gintro has some examples for that, but you would have to manage to install GTK on your windows box.
I would expect you desire just another tool. Cairo is generally used with GTK. Maybe you would like SDL2, Skia, Godot or one of the many other libs.
Well... shame on me. I have to learn much more.
Thank you for all your help.
I put this on hold... because I still got no png Output.
I will work a while with fidget. I installed it and it works for me. It is so easy to use
I still got no png Output.
This is likely due to the fact that there is not tests directory from where you are running fill_and_stroke.nim. The possible error for this is not managed in the example file you are using.
Try replacing this:
discard surface.writeToPng("tests/fill_and_stroke.png")
with this
discard surface.writeToPng("fill_and_stroke.png")