GNOME Bugzilla – Bug 529431
Patch to add velocity dynamic to all paint tools
Last modified: 2008-05-22 16:39:24 UTC
This patch adds all the same functionality as pressure currently has to velocity parameter.
Created attachment 109722 [details] [review] Velocity dynamics patch for paint tools.
Created attachment 109748 [details] [review] Cleaned up patch - follows coding style - fixes small bug in gimp_paintbrush_motion()
Created attachment 109925 [details] [review] Updated patch Applies cleanly against trunk
Modified the latest attached patch a bit again and comitted. Leaving open because Alexia is about to upload another update. 2008-05-10 Michael Natterer <mitch@gimp.org> Applied modified patch from Alexia Death which adds velocity support to paint tools in the spirit of the pressure support we already have. Fixes bug #529431. * app/display/gimpdisplayshell-coords.c (gimp_display_shell_eval_event): tweak velocity calculation to work in screen coordinates. * app/paint/gimppaintoptions.[ch]: add velocity options in the same way as there are pressure options. Add utility functions which return dynamic opatity and dynamic rate according to the the option's settings and some GimpCoords' pressure and velocity. * app/tools/gimppaintoptions-gui.c: add GUI for the velocity options. * app/paint/gimpbrushcore.h: remove PRESSURE_SCALE define, it's now in gimppaintoptions.h. * app/paint/gimpbrushcore.c (gimp_brush_core_interpolate): inerpolate velocity too. (gimp_brush_core_calc_brush_scale): take velocity into account. (gimp_brush_core_get_brush_mask): always pressurize the mask in the GIMP_BRUSH_PRESSURE because there always is velocity (unlike pressure which is only there on tablets). * app/paint/gimpairbrush.c * app/paint/gimpclone.c * app/paint/gimpconvolve.c * app/paint/gimpdodgeburn.c * app/paint/gimperaser.c * app/paint/gimpheal.c * app/paint/gimppaintbrush.c * app/paint/gimpsmudge.c: get opacity and rate from the new paint options utility functions which take both pressure and velocity into account. * app/paint/gimppaintbrush.c: take velocity into account when calculating the gradient color offset. * app/paint/gimpairbrush.c: do some additional fiddling with velocity in the asynchronous airbrush timeout. * app/paint/gimpairbrushoptions.c: override the velocity-size property and have it default to FALSE.
Created attachment 110696 [details] [review] updates to velocity gives airbrush sane defaults, stops brushes with velocity dependency from having these really ugly starting blobs(how is a bit ugly - but I failed to find a less ugly way...), consolidates event mixers to the paint options so adding dynamics can be done completely in one(well, two, because mouse button down stamping needs to get the carryover values for all non-direct dynamics...) place.
Created attachment 111069 [details] [review] Revised patch for prevous updates. Makes cleaner blotch removal. To be applied after vector brushes fix.
Created attachment 111296 [details] [review] velocity fixes and random dynamic Again revised patch, additionally separates hardness calculation(broken in previous versions) and includes random dynamic, that touches all of the same code. (sorry about piling...)
Created attachment 111299 [details] [review] velocity fixes and random dynamic update improved start conditions explanation and handling.
Created attachment 111302 [details] [review] velocity fixes and random dynamic update 2 fixes bork airbrush options ui.
Fixed in SVN: 2008-05-22 Michael Natterer <mitch@gimp.org> Applied slightly modified and fixed patch from Alexia Death which adds a "random" axis to the paint dynamics and fixes some issues in the previous paint dynamics commits. Fixes bug #529431. * app/core/core-types.h: add a "random" axis to GimpCoords. * app/display/gimpdisplayshell-coords.c: set it to a random value. * app/display/gimpdisplayshell-callbacks.c: on button_press, use the dynamics from the last motion event to avoid blotches at the beginning of paint strokes. * app/paint/gimppaintoptions.[ch]: add random properties the same way we do pressure and velocity. Add get_dynamic_size(), get_dynamic_color() and get_dynamic_hardness() functions which look at all dynamic parameters of the passed coords. * app/tools/gimppaintoptions-gui.c: add gui for the random options. * app/paint/gimpbrushcore.[ch]: remove calc_brush_scale() and use gimp_paint_options_get_dynamic_size_instead(). Add "dynamic_hardness" parameters to paste_canvas(), replace_canvas() and get_brush_mask(). * app/paint/gimpairbrushoptions.c * app/paint/gimpclone.c * app/paint/gimpconvolve.c * app/paint/gimpdodgeburn.c * app/paint/gimperaser.c * app/paint/gimpheal.c * app/paint/gimppaintbrush.c * app/paint/gimpsmudge.c: calculate the dynamic hardness and pass it to above brush core functions. Use the get_dynamic_color() to calculate the gradient color.