Feature #8

Add support for new types of Regions

Added by Leszek Koltunski over 2 years ago. Updated about 2 years ago.

Start date:
Due date:
% Done:



Currently the library only supports masking the area on which a given effect works by a circular region.

Explore possibilities to extend this to other types of shapes like rectangles or at least ellipses.


#1 Updated by Leszek Koltunski about 2 years ago

Proposed improvements:

Completely decouple the Region from the Effect. Provide possibility to set up 'Masks' which, for every point on the Object, return a float describing the 'strength degree' the effect has on this very point.

Current implementation has this fixed: one can define a circle and a point (called the center of effect) and then the 'strength degree' is 1 in the center, linearly going to 0 towards the borders of the circle, and stays 0 outside.

Some effects also cut off the 'strength' at Object boundary (DISTORT) others don't (DEFORM).

The 'MASK' would make all of this generically adjustable for all effects:

1) define if we cut off the effect at:
a) only Region boundaries
b) common part of the Region and Object
c) only Object
d) never (i.e. Mask switched off and 'degree strength' 1 everywhere)
2) define a 'Region' (circle as now, but probably defined with absolute coordinates of the center of the circle, and not as a offset vector from the center of the effect)
3) define a pair of 'translation' functions which would translate the linear (-infinity, 1) 'degree' as returned by the 'degree' functions to actual 'strength degree'.
The first of those functions, F1, would be responsible for translating values outside of the Region (negative degrees), the second, F2 - inside (the (0,1) degrees).

In order to do 3) above, we'd first need to rewrite the 'degree_region' and 'degree_bitmap' so that they return (negative) degrees when point is outside the (respectively) Region or Object, and not like now - cut off outside and always return 0.

Currently the 'translation pair' is - in Vertex effects - implicitly fixed at: F1 = 0, F2 = x; in case of Fragment effects, we have F1=0, and F2=x or 1 depending on if the effect is 'smooth'.

Also available in: Atom PDF