Brush dynamic ideas.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've recently compiled GIMP 2.6 on Linux (Debian 4).  It took some work 
compiling some base libraries but overall was pretty simple.  I may 
start looking though the code some to get acquainted with it mainly for 
writing custom plugins to do some things I want.

Anyhow I though about some more ideas for a brush dynamics system, these 
are just some ideas  I doubt I could do much with them myself though but 
I may try to familiarize myself with the code anyhow.

In the brush dynamics system there are input controllers and output 
attributes (just the words I'm using, may not be the official names).  
The current system is a little limited because for any given input the 
same adjustment value applies to any outputs.  It's not possible for 
'pressure' to affect 'opacity' by 0.5 and 'color' by just 0.2 for instance.

First, the brush dynamics could be a separate dialog, or at least a 
button for each tool supporting the dynamics could open up the dialog or 
make it active if it is already opened.  Instead of having mappings 
directly in the dialog, a list would exist supporting add, edit, delete, 
move up, and move down (and maybe save and load)

Each item in this list corresponds to a single input-output pair 
mapping.  It can not modify the values of the input controller, but it 
can modify the values of the brush attribute.  It also contains an 
offset and multiplier such that 'pre_output = inputs[selected_input] * 
multiplier + offset'.  It may also be desired to adjust the final 
attribute in different ways.  Two ways would be addition to the current 
value or multiplication by the current value:

if modify_mode == ADDITION:
    outputs[selected_output] += (inputs[selected_input] * multiplier + 
offset)
elif modify_mode == MULTIPLICATION:
    outputs[selected_output] *= (inputs[selected_input] * multiplier + 
offset)

The available outputs would depend on the selected brush type.  Common 
values include:

opacity
hardness
color
size
jitter (if part of brush dynamics, it could be controlled by any of the 
inputs)
rate
frame (for animated brushes, could be used to select output image from 
the brush)
rotation (the rotation of the brush, could be used for weird calligraphy 
effects of oddly shaped brushes, etc)

It has also been mentioned that curves would be nicer.  This could be 
done and would just replace the offset and multiplier:

if modify_mode == ADDITION:
    outputs[selected_output] += curve[inputs[selected_input]]
elif modify_mode == MULTIPLICATION:
    outputs[selected_output] *= curve[inputs[selected_input]]

Additional input types could also be provided.  The only ones may be 
tilt (for tablets that support them), angle (the angle between the 
previous mouse position and the current mouse position)

The values of the inputs would have to be calculated before processing 
the dynamics list, then the list processing is fairly straight forward:

// assume inputs is array of available input control values and
// outputs is the array of final brush attributes before applying the brush
for(node = first ; node ; node = node->next)
{
    adjustment = inputs[node->selected_input] * node->multiplier + 
node->constant;
    // For curves
    // adjustment = get_curve_value(node->curve, 
inputs[node->selected_input]);

    value = outputs[node->selected_output]

    switch(node->method)
    {
       default:
       case ADDITION:
          value += adjustment;
          break;

       case MULTIPLICATION:
          value *= adjustment;
          break;
    }

    outputs[node->selected_output] = value;
}
// outputs now has the final brush attributes to use



Anyway those are the ideas.  I doubt any of those are compatible with 
the current code though.

Brian Vanderburg II



_______________________________________________
Gimp-developer mailing list
Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux