2

Disclaimer: I'm very new to Inkscape and have almost no experience in graphic design, I'm just getting started.

I'm trying to create an object with certain areas be either transparent or always filled with white. I've used squares, lines, and circles to make the following:

enter image description here

The top-right circle is transparent and does not change color when I change the fill color of the object (this is what I want to happen). However, the bottom one is always treated as a fill area. I tried to make a white circle and combine both images but it doesn't seem to work for the bottom circle for some reason. What I tried:

  • Object to path: no fill is there to be removed
  • Combine: everything is deleted
  • Exclusion: removes the left-hand straight lines and makes remaining lines sharp-edged
  • Difference: removes the left-hand straight lines and increases the size of some of the lines
  • Union: removes the light-hand straight lines and fills the bottom circle with the same color as the object above

Also, for some reason the fill is always half-way to transparent even though the fill color is set to be 100% opaque.

This is most likely a super-beginner question but if anyone could help out here it'd be greatly appreciated!

EDIT: I can even make the bottom circle transparent as evident with the checkered background, but if I apply a fill to the whole selection it also fills the bottom circle but not the right-hand one:

enter image description here

2
  • 1
    Hi. Welcome to GDSE. There are a lot of questions here! Can you share the SVG on SVGshare.com so we can at least see how you consructed it? I'm not sure if there is actually a problem here. The top right circle is obviously part of a compound path with the rectangle, but the lower circle is just a circle with/without a fill. There are two controls for opacity - there's the fill colour opacity, but below that there's also the object opacity. Make sure both are set to 100%.
    – Billy Kerr
    Commented Feb 22, 2022 at 11:08
  • 1
    Thanks for responding! Yes, here it is svgshare.com/s/eRN I'm sure there are many errors here but in short what I did: draw a rectangle with rounded corners, add a circle with white fill, select both and use Exclusion to make the circle inside the rectangle become transparent. The left-handed lines are just straight lines that have been converted to path (I think, they might just be lines). I then combined everything to make a full object. The goal is to be able to change the fill of the rectangles, or just the lines separately. Commented Feb 22, 2022 at 11:42

1 Answer 1

1

I think there are two separate questions here.

Firstly, some of the boolean operations consume one of the objects. So, if that is happening, you can copy the shape before doing the boolean operation, then Paste in Place to get it back. Also some boolean operations don't work so well on open paths. Most only work with closed paths (i.e. paths that don't have open ends).

Secondly, the issue with your particular graphic. One method would be to separate out the fill from the paths - so that there are two separate objects. This would avoid the problem you are having which is that once paths are combined, you can't have different pieces within the combined object with different fills/no fill. One object can only have 1 stroke and 1 fill attribute.

Anyway here's the example

All the paths in the example below are combined, and have no fill. The fill is a separate object under the combined paths. I made the fill using a copy of the rectangle and top right circle object, set the stroke to none, and the fill to grey, and sent to the bottom. Then I combined all the strokes as one, making sure to set the fill to none.

enter image description here

Here's the SVG if you want to examine the construction

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg width="210mm" height="297mm" version="1.1" viewBox="0 0 210 297" xmlns="http://www.w3.org/2000/svg">
 <path d="m24.23 153.3c-5.636 0-10.17 4.538-10.17 10.17v19.61c0 5.636 4.537 10.17 10.17 10.17h158.7c5.636 0 10.17-4.537 10.17-10.17v-19.61c0-5.636-4.538-10.17-10.17-10.17zm149.4 12.55c4.14 1.2e-4 7.496 3.356 7.496 7.496 1.7e-4 4.14-3.356 7.497-7.496 7.497-4.14-1.2e-4 -7.496-3.357-7.496-7.497 1.2e-4 -4.14 3.356-7.496 7.496-7.496z" fill="#747474" stop-color="#000000"/>
 <path d="m28.31 165.7h10.35m64.45 37.39v-9.533m-78.88-40.24c-5.636 0-10.17 4.538-10.17 10.17v19.61c0 5.636 4.537 10.17 10.17 10.17h158.7c5.636 0 10.17-4.537 10.17-10.17v-19.61c0-5.636-4.538-10.17-10.17-10.17zm149.4 12.55c4.14 1.2e-4 7.496 3.356 7.496 7.496 1.7e-4 4.14-3.356 7.497-7.496 7.497-4.14-1.2e-4 -7.496-3.357-7.496-7.497 1.2e-4 -4.14 3.356-7.496 7.496-7.496zm-62.46 44.31 51.76 0.1785m-120.1-0.1785 51.76 0.1785m16.01 0.2392c0 4.14-3.356 7.496-7.496 7.496-4.14 0-7.496-3.356-7.496-7.496 2e-6 -4.14 3.356-7.496 7.496-7.496 4.14 0 7.496 3.356 7.496 7.496zm-7.496-57.46v-6.316" fill="none" stop-color="#000000" stroke="#000" stroke-linecap="round" stroke-width="4.8"/>
</svg>
6
  • 1
    This definitely looks like exactly what I'm looking for :) just for clarification: you first take the rectangle + circle and do a combine, then you take that combined object, copy it with fill and no stroke (so you get the empty circle bit), then you add all the other lines and the circle, combine all of those into one single object, then add the fill to the bottom layer behind the original rectangle? Commented Feb 22, 2022 at 13:04
  • @TanakaSaito Yup, you got it!
    – Billy Kerr
    Commented Feb 22, 2022 at 13:42
  • Awesome, thank you :) maybe this is a separate question but I noticed that the example file you made for me here also behaves in the same way. If I apply a Fill to that object it fills both the top rectangle and the bottom circle. Is this because Inkscape assumes that any area that is completely enclosed is an area that can have Fill applied to it, and therefore will always apply Fill to it? To put it simply: is there a way to have an enclosed area not Fill when I apply Fill to the object containing the closed area? Commented Feb 24, 2022 at 5:43
  • @TanakaSaito - no it's because you are trying to add a fill to a compound object. Compound objects can only have 1 fill and 1 stroke attribute. There's no way to have different fills on different parts of it because the SVG format treats a compound/combined path as one path, or one object. This is why I suggest you set the fill on the compound object to none. And use the separate fillable shape underneath for your fill instead.
    – Billy Kerr
    Commented Feb 25, 2022 at 14:15
  • 1
    Thanks a bunch! I noticed that leaving fill empty on the compound object and adding a fill to it has a very tiny sliver of empty space between the fill and the compound object, so what I did was do as you initially suggested with a fill, then increase the size of it slightly, and dropped it to the bottom of the picture, that way there are no "dead" spaces between the fill and the compound object :) this is probably the first time in my IT career in a long time that I find learning something new is exciting! Commented Mar 8, 2022 at 5:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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