0

Consider sample Bézier curve with a red stroke:

enter image description here

Now, I want to paint the background of the whole selection area.
Like this:

enter image description here

Is there a straight-forward way of achieving this?

This is what I get using standard fill option:

enter image description here


I've created the mockup by creating a rectangle with the same dimensions as the curve, then aligning and grouping the two.
Perhaps it's the only way.

However, I don't quite like edges not aligning perfectly in case of a thicker stroke:

enter image description here

Furthermore, I thought that the approach with rectangle is workaround-ish and does not produce accurate and scalable result. It does.
Explained in my comment to @user287001 's answer.

  • are you sure you're applying the fill to the rectangle and not to the bezier curve? – Luciano Mar 16 '17 at 16:29
  • I don't understand you. The process of obtaining each of the images has been described in a sufficiently precise manner. – vucalur Mar 17 '17 at 9:34
  • User @Luciano had a solid idea. In vector graphics programs the fill, when applied to an open curve, behaves exactly as you got, but not wanted. The fill is applied like there was a straight line segment from the beginning to the end. The fill does not fit the bounding box of the object until the object happens to be a horizontal rectangle OR somebody programs a new type of fill that colors the bounding box. – user287001 Mar 17 '17 at 17:19
1

You can use a rectangle with a border in the same color as the filling color and choose, as contur width, the same width as the Beziers contour width.

If you later change the width of the Bezier curves contour, you just have to change the rectangles contour to the same value.

1

No use to think other ways, if your mockup gives the wanted visual result and the problem is nothing more than visual. Make a group to keep the rectangle and the curve together when moving, rotating or scaling. Recoloring needs a separation.

ADDENDUM due the comment and edit in the question:

To fit the ends of the curve perfectly draw a little longer curve. Make a clipping mask.

Alternatively convert your curve to a filled area and edit its control points. See an example:

enter image description here

NOTE: the size and the position of the added rectangle are NOT approximate, if you

  • at first copy your curve to the clipboard
  • select the rectangle and paste the size onto it from the clipboard
  • select both and align them with the Object > Align & Distribute -tool.
  • I've demonstrated understanding of the need for grouping in the original question :) See the last edit for a little problem with additional rectangle approach. – vucalur Mar 17 '17 at 9:35
  • @vucalur see the edit – user287001 Mar 17 '17 at 9:50
  • Guess, I'll have to accept your answer, if nothing better comes by. – vucalur Mar 17 '17 at 12:41
  • I thought that filling the selection rectangle is doable in, like, 2 clicks; the approach with additional rectangle is incredibly workaround-ish; and, what is more important, does not produce accurate result: I thought, that rounding error would happen: If you specified same dimensions, made the group, resized it to huge dimensions, they would be off by a couple of pixels. But, due to grouping magic, they stay perfectly same size. But if you then ungroup, the two shapes are off. They don't return to perfect alignment then grouped once more. – vucalur Mar 17 '17 at 12:41
  • @vucalur Added how to fit the curve and the rectangle exactly without clipping and how to make the rectangle excactly to the right size and position. – user287001 Mar 17 '17 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.