On 20 January 2013 19:52, Sebastien Leon <sl...@pointcarre.com> wrote: > You can temporarely download the zip file here : > > http://download.pointcarre.com/mypaint/LibMyPaintDemo.zip > > Note that this is a very first attempt and I really need a lot of help > to provide something useful for anyone who may use libmypaint ! And your > advises are very welcome :-)
Thanks. Looking though it, it seems that you based this code on an older version of libmypaint, before MyPaint 1.1? The API for fetch/update tile is a bit different now, in order to allow multithreading without locking. Also, you seem to have renamed every .c file to .cpp? Why? Some hints for the issues you have listed in the README and in the code. In order for caching and deferred processing to work correctly, you must call mypaint_surface_begin_atomic() before doing mypaint_brush_stroke_to(), and mypaint_surface_end_atomic() when done. With libmypaint 1.1 and git, nothing will happen if you don't as everything is done on end_atomic() To set color, convert RGB to HSV and do (values are float): mypaint_brush_set_base_value(brush, MYPAINT_BRUSH_SETTING_COLOR_H, h); mypaint_brush_set_base_value(brush, MYPAINT_BRUSH_SETTING_COLOR_S, s); mypaint_brush_set_base_value(brush, MYPAINT_BRUSH_SETTING_COLOR_V, v); All other brush settings, from dab size, hardness, opacity to speed filters and alpha-locking are manipulated the same way. Another thing is that the delta-time calculation should normally be done from the input events you get from your windowing system, to not be dependent on CPU load. But it seems Qt does not expose that!? Also, I _believe_ that the correct thing to do is to new_stroke() on button/tablet down to start a stroke, then reset() on button/tablet up to finish it. Martin, does that sound right? If so, perhaps we should rename reset() to end_stroke()? >> It was my intent that this code also would become ISC [...] >> I have now sent an email to all the copyright-holders of these >> files to check whether such relicensing is OK. > > This is good news because the 15 bpp format seems quite required to > render correctly the dab (8 bits format shows a lot of posterization). > So it make sense to provide a basic 15 bpp surface + the draw dab > algorithm with the library. > I'm quite sure I will rewrite it for my own purpose, but for the demo > project it is cool ! Yes, at least one needs more than 8bpc. Floating point would also do fine of course. All in all, the renderer we have in MyPaint is pretty good and I think it would be great if others could just use that instead of having to implement their own. -- Jon Nordby - www.jonnor.com _______________________________________________ Mypaint-discuss mailing list Mypaint-discuss@gna.org https://mail.gna.org/listinfo/mypaint-discuss