Thank you for your advice. 2008/3/13, Martin Nordholts <enselic@xxxxxxxxx>: > In order to make it easier to track changes to the patch, could you > please create an enhancement request about this in Bugzilla? > (bugs.gimp.org) We can still continue discussion on the list but the > patch will be much easier to track in Bugzilla. I submitted this request (Bug 522226 – PaintBrush extension framework .) Should we go bugzilla to discuss the idea ? 2008/3/13, Sven Neumann <sven@xxxxxxxx>: > So far I have not quite understood what your patch does. Nor did I > understand why you haven't discussed the design before starting to > implement it. Perhaps it would be a good idea to explain the ideas of > your approach now. I posted some explanation of the patch at bugzilla. Same description is copied below. Actually, I had studied about the PaintCore and its derived classes, and implemented "hardcoded" blending feature at first. This framework is the result of clean-up work of existing color blending codes. === description start here === The approach is very simple: Brush has some event handler callback chain. The brush calls the callbacks at proper point to change status of brush properties and cursor position. This patch is developed to prove the possibilities to implement extension framework, so all APIs are experimental, and we should keep improvement. In this patch, The following classes and objects are introduced. 1. Sample brush classes to be enhanced. * GimpCustomBrush (/app/paint/gimpcustombrush.{h,c}) - Implementing fundamental brush behavior. - Few event handler chains are defined. (API is not fixed at all.) Event handlers are called from CustomBrush object at proper point of the brush implementation. + init_motion : called when button becomes down. + motion : called when cursor is moved. + register_paste_canvas : called when brush must paint something into tile. This function only register the task list to be applied to the canvas. Registered tasks are applied after all callback functions finished registering tasks. + finish_motion : called when button becomes up. - Event chain callbacks are implemented instances of BrushModifierCore and its derived classes. * GimpCustomBrushOptions (/app/paint/gimpcustombrushoptions.{h,c}) - Manages brush options and persistence. - It can be extended by instances of BrushModifierOptions and its derived classes. * GimpCustomBrushTool (/app/tools/gimpcustombrushtool.{h,c}) - Manages tool info and brush options GUI creation callback. - It can be extended by instances of BrushModifierTool and its derived classes. 2. Intermediate brush state *GimpCustomBrushState This object holds some status which is only valid in one stroke. The status is reset when one stroke is finished. Status contains: - Foreground color - Background color (planned) - canvas masks to be applied (planned) - and so on 3. Modifier classes those implement modification to the brushes Modifier objects are attached to the brush objects listed above, and change their behavior. Several modifiers can be attached to one brushes so that user can use several modifiers at once. These objects has internal status which is required to implementing features (such as history of cursor pointers and so on.) * GimpBrushModifierCore (/app/paint/gimpbrushmodifiercore.{h,c}) - This class and its derived classes defines the callback methods to be called from GimpCustomBrush object. * GimpBrushModifierOptions(/app/paint/gimpbrushmodifiercore.{h,c}) - This class and its derived classes adds new properties to GimpCustomBrushOptions class, and defines the callback methods to be called from set_property/get_property method of GimpCustomBrushOptions. These manage set/get properties introduced by themselves. * GimpBrushModifierTool(/app/tools/gimpbrushmodifiertool.{h,c}) - This class and its derived classes defines the GUI creation functions which are called from the GUI creation functions of GimpCustomBrushTool. 4. Internal PasteCanvas task info GimpPaintMaskInfo and GimpBrushCorePasteCanvasInfo defines the task to be done when canvas_buf and mask region are applied to the drawable. This API is very experimental and should be rewritten in the future. 5. Example Modifiers Blending feature and Line point adjustment feature are implemented as examples of this framework. They extends GimpBrushModifierCore, GimpBrushModifierOptions, and GimpBrushModifierTool, and instances of those classes are attached to Brush objects(See *_load functions in gimpcustombrush*.c .) These modifiers should be loaded dynamically in the future. _______________________________________________ Gimp-developer mailing list Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer