Colour defined area fraction of shape in inkscape

I have a number of complex shapes (for example a sketch of a gecko, an ant and a frog) and want to colour a defined fraction of the area of each sketch from the bottom, e.g. 20% of the gecko in blue, 30% of the ant in red etc.

As an illustration, I uploaded two example shapes:

The rectangle on the left has 20% of its area filled from the bottom, which is easy enough to do. For more complex shapes, however, as the one on the right, it is less trivial. Is there any way to do this in inkscape?

Thanks!

• Hope this makes it more clear. Dec 22, 2015 at 8:31
• There is no easy way to do this. Question is still vague. You need to define 20% and how its to be applied draw with pen and paper if you dont khow how to do in inkscape. Question still unclear. Is strategy supplied by Bart ok? If we can just provide a method to calculate 20%. Dec 22, 2015 at 11:59
• No, for the reason specified in the first comment. The problem is to fill a specified fraction of the area taken up by the sketch - I am not sure I know how to define this even more clearly. Perhaps you can give some pointers as to how exactly remains unclear/vague? Dec 22, 2015 at 14:31

Question not entirely clear, is the following strategy useful?

1) Create your form (ant, ...)

2) Create your fill rectangle (here in red)

3) Make a clone of the form you made in step 1 (select the form, then Edit > Clone > Create Clone or shortcut Alt+D)

4) Use the clone to clip the color rectangle (with the clone still selected, shift+leftclick the rectangle, then Object > Clip > Set)

5) result:

Since the clipping mask is a clone, you can still tweak the original form and the clipping mask will automatically follow. More info on cloning in Tavmjong's manual, chapter Clones, and on clipping in Tavmjong's manual, chapter Clipping.

• How will that fill 20% or any other defined proportion of the area? Filling the height wasn't the problem. Dec 22, 2015 at 11:45
• That was exactly why I said the question wasn't clear to me. From reading the question, I thought it possible that filling the height was not a problem for a rectangle, but was a problem for "random" forms. Anyway, maybe not the right answer, then... Dec 22, 2015 at 12:57

You can do iteratively, by hand, at least with 0.91:

Draw your shape. See my beautiful walrus: In the extensions-menue, there is a point - in German it is "Erweiterungen/Pfad visualisieren/Pfad ausmessen" In English it should be similar to 'Extensions/visualize path/measure path'. You mark the path in question, select 'area' from the drop down, and 'perform/commit/enter' (anwenden).

Now the size is printed as in the upper left corner. Now we calculate that value to 20% or whateve we need, which gives me round about 14.000.

Create a duplicate of the path, and remove the upper nodes, pull the lower nodes down, measure, repeat.

It might be hard for a figure with many interceptions and a lot of work, depending on how exactly it has to fit and how complex the figures are, but for an error below 1%, I guess it is doable.

Bonus quesiton: Why is the size negative? I have no idea. :) 5 positive vectors, 3 negative ones, multiplied?

• Thanks. This does the right thing, though I was hoping there would be a more "elegant" way. Dec 22, 2015 at 14:32
• @David write a loop in a script and do a binary search this is a normal strategy half of all physics and control devices such as servo controllers do this. Dec 22, 2015 at 16:23