: Creating an inner stroke (sort of) on a clipped object Consider the following SVG of a globe: Apart from the inland waters and the latitude/longitude lines, which are not relevant to this
Consider the following SVG of a globe:
Apart from the inland waters and the latitude/longitude lines, which are not relevant to this question, the SVG is constructed from three shapes: A black object for the oceans, a blue square, and a green circle:
The blue square is placed behind the black object and clipped, and the result is then placed over the green circle.
I would like to add a black border around the oceanic coastline. The border should extend into the ocean, not into the land. This is effectively stroking the inverse of the clipped object. That is, I'd like to end up with something like the following:
How can I do this in Inkscape?
Similar questions on this site and others propose solutions that involve converting the object to a path, but for some reason the "Object to Path" command doesn't work on the black object.
More posts by @Sims5801359
3 Comments
Sorted by latest first Latest Oldest Best
Once Billy Kerr explained that the black shape is a clone, it became easy to adapt existing answers to solve this problem:
Select the black shape and unlink it (Edit→Clone→Unlink Clone) to get the original object.
Convert the object to a path (Path→Object to Path).
Copy the path (Edit→Copy).
Draw a rectangle with a stroke but no fill around the path.
Select the rectangle and the path and combine them (Path→Combine). The path will change to an outline.
Using the Edit Paths by Nodes tool, edit the new path to remove the rectangle and the path segments around the circumference of the globe. (There's only a few.)
Paste the path (Edit→Paste) and align it overtop the outline version.
Select both paths and clip (Object→Clip→Set). This ensures the stroke extends only into the ocean, not into the land.
Copy the path, paste it on the original image, and lower it so that it is just below the latitude/longitude lines.
This method has the advantage over the one posted by user287001 that it does not rely on the Paint Bucket Tool, which is a glorified bitmap tracer. The fidelity of all paths is therefore preserved.
I downloaded the SVG to examine it.
The black object is a clone. That's why you can't edit it properly.
An easy way to find out if an object is a clone is to examine it in the XML editor in Inkscape. If you see the selected item is showing something like <svg:use id="use1234">, then that means it's a clone. A normal path looks like this <svg:path id="path1234">
To turn it back into an ordinary path, select it and click Edit > Clone > Unlink Clone. Then you can copy it, revert the SVG to the original, then paste back the copy, align it, set the fill to none, set the stroke to whatever you want. Change the stack order so it's under the grid lines.
Here's the SVG with a black outline added, using the above technique.
I downloaded the SVG and noticed: The oceans are masked with the back shape that does not allow path operations. The following succeeded:
ungrouping
hiding the latitudes and longitudes away
changing the land areas to single solid color
filling with paint bucket the land areas to get them as Inkscape paths
adding stroke to the land areas
removing possible unwanted stroke sections
making the stroke to path (=coastline path)
subtracting the land areas from the coastline path
coloring the rest of the coastline path to black
Here's a screenshot of the partially filled land areas (=orange) and all path nodes visible:
Here's tested to make the coastline path. The land areas are just subtracted, so the coastline path is only on the sea. No part in the edge and lakes is removed, small islands were skipped
No need to paint the land areas. As well you can paint the oceans. The coastline path on the sea is achieved by making an intersection with the full coastline path and strokeless sea area.
Here's another fill example. Atlantic and Pacific areas were filled with red and got black strokes. Then an union was made as path operation:
The path was duplicated, stroke was removed from upper copy, fill from lower copy, the stroke was converted to a path (=the full coastline path) and the strokeless ocean was intesected with the coastline path. No tinkering with islands were needed:
The black strokes at the edges are probably unwanted. They should be removed just before conversion to path. Selection of multiple stroke segments for conversion is easy in objects panel or as well by the same color in Edit menu.
To keep all placed properly have a hidden copies of the original shapes. Finally you want only to take the coastline path and place it under the latitudes and longitudes in the object panel.
Stop press and at least upvoting! The result is good onscreen, but high zoom reveals the inaccuracy. Paint bucket doesn't create complex enough path for this!
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.