Hi Martin,
Hi Jon,
Hi folks,

This week I modified my little demo program according my TODO list and
your advises.

Of course I had various troubles when I updated to the Git head. (from
1.0 API)
The 1.1 API seems more elegant, a little more complex too. I'll give you
below the details of which troubles I had, especially on Windows where
the project was not compiling at all (at least, on my computer).

The demo program (should I say mypaint 0.0.1 ;-) show the brushes
(ordered), allow to change the color and few brush settings (radius and
opacity). Good enough for a demo software.

Once can draw on the surface (with few brushes, see below) using the
mouse or a tablet pen.

I checked on Linux (Ubuntu 12.04 32 bits) and Windows 7 32 bits. It runs
"fine" on these 2 systems (not tested on Mac)

To make it easy on windows, json-c source code is bundled. (when you
compile on Linux, the binary is linked to the system libjson instead)

As Martin advised me, I'm now calling mypaint_brush_stroke_to all the
time, including when the user is not pressing the mouse button (or the
tablet on the devise). The pressure is simply 0. (but I do not
understand why they are so costly operation when I'm just moving the
cursor over the surface...)

The zip package does no longer include libMyPaint code itself. You
should decompress it and copy it into your /mypaint/brushlib Git
repository. Project file will use the files from brushlib dir in ".."
and the program will search for the brushes using the relative path.
(however, before you compile, you should copy the files from
'modifiedFiles' dir to brushlib dir ; hopefully, if my fixes are fine,
you will commit them on main tree). Here is the zip file :

http://sebastienleon.com/info/libmypaint/demoQt4.zip

Regarding the troubles, the most surprising one is that only few brushes
works fine (nearly fine, should I say, like classic/blend+paint).
Most of them have a really weird behavior :
- when I use them to draw, nothing is visible. (actually the
SurfaceTileRequestStartFunction callback is NEVER called)
- but what is really weird is if I select a brush which is working fine
and move it over the surface, then everything I draw previously  become
visible (tile by tile)

My conclusion is libmypaint keeps an internal cache of the surface (!?)
and I may not properly initialize the call backs... (??)
The other conclusion is when I move my mouse over the surface with a
"ok" brush, the call back TiledSurfaceTileRequestEndFunction is called
with readonly == false, despite a 0 pressure, which is annoying. (I
repaint my tiles only if readonly is returned false)

It must be some obvious misuse of the lib, but I do not see it...

The rest is more traditional :

1 - it is impossible to use scons to build mypaint or just libmypaint on
Windows

  - the following command is not recognized on windows (shell dependent)
    "rm -f libmypaint-tests.so libmypaint.so libmypaintlib.so"
   (an easy turn-around is to write it with 2 shell syntax)

  - some UTF8 / ASCII issue. Unfortunately I know nothing of Python and
Scons to fix that:
    scons: *** Error 1
    UnicodeDecodeError: 'ascii' codec can't decode byte 0x82 in position
87: ordinal not in range(128):
    File "C:\Users\seb\Desktop\FTP\mypaint\mypaint\SConstruct", line 177:
    brushlib = SConscript('./brushlib/SConscript')
    (my system is in french but none of my path of files contains
accents and so on)
    (never had such issue with CMake, qmake or others)

My turn around for trouble 1 was : ...to install xubuntu on another
computer and compile libmypaint on it.
Once done, I was able to get the 3 generated files (brushsettings-gen.h,
mypaint-brush-settings-gen.h...) and I copied them on my Windows
directory. I tried to generate them using directly the python script but
I had no clue on how to do that...

2 - The C files can not be compiled correctly with msvc. The compiler
complains about no plain C (like declaring variables not at the
beginning of the functions).

My previous fix had been to rename them as *.cpp files (instead of *.c
files).
This time I searched longer and finally found some turn-around :
I add /TP to msvc flags or add -std=c99 to GCC flags and they are both
happy. (in demoQt4.pro)

3 - Cast issues. Once it has been turned in C++ mode (see issue 2) the
msvc compiler refuses to do some unobvious cast. (like :  struct fifo
*ret = malloc(sizeof(struct fifo));  )
I fixed them in several files.

4 - non-portable call. (isfinite(), roundf(), #include libintl.h, etc...)

5 - gettext call. It's a real issue to link accross this lib with msvc.
BTW, Qt has his own translation system and they are plenty of other
ones... So, for now, I put some conditional code with the define
NO_GETTEXT and add it to my project file. Code has been modified like
below :
#ifdef NO_GETTEXT
  // ignore gettext
#else
  // do normal stuff
#endif

6 - not optimal include. The following generate some troubles :
#include <json.h>    (in mypaint-brush.c)
I think it is :
#include <json/json.h>
(I did not modified the c file. I just added the hard coded path to the
include /usr/include/json but I think it is the dirty way to fix it)
BTW, json-c compiles and links fine on windows now. The problem I had
last week was because of an older version of json-c.

7 - I have some important questions/notes about how to use libMyPaint API.
You may find them all in MypaintView.cpp

Something which is not relative to my code :
In file mypaint_tiled_surface.c, function get_color, once wrote :
    int tiles_n = (tx2 - tx1) * (ty2 - ty1);
May (tx2 - tx1 + 1) *... could be more appropriate...

You feed-back is again very welcome ! I hope that the next step will
allow to commit this demo file to the main tree. For now they is still
some work to do (and some explanations to give about the API logic)

PS : my plan was to come at FOSDEM. Unfortunately, for personal reasons
I had to cancel :-( And I may not be reachable at all the next week...
(traveling) I will reply to any answer in 8 days. I wish you a cool
event in Bruxelles !

Best regards.

Sebastien

_______________________________________________
Mypaint-discuss mailing list
Mypaint-discuss@gna.org
https://mail.gna.org/listinfo/mypaint-discuss

Reply via email to