I want to be able to iterate (left to right, bottom to top) the bounding box of a specific path, (I am guessing) one that has been "saved" using spath3. Why? I want to use it to fill the path with a custom fill but do not want to iterate outside of the bounding box (yes, still using clip).

So I need access to the bounding box of an arbitrary path.

The closest thing I can see is: Tikz: Shading a path without any filling

New contributor
ggg is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • In general, you can only find approximate solutions. Why? The envelope of a cubic Bezier curve is in general not composed of cubic Bezier curves, let alone single Bezier curves for the "upper" boundary. – user241266 May 4 at 20:35
  • Understood. But what about a path that is made up of only straight segments. Can the bounding box of this be obtained in some manner, either through spath3 or some other package? – ggg May 5 at 12:40
  • I'd assume that you could use a decoration, e.g. tex.stackexchange.com/a/495140 seems to do such things. – user241266 May 5 at 16:04

Why don't use a knockout transparency group:

\shade [left color=red,right color=blue] (-2,-1) rectangle (2,1);
\begin{scope}[transparency group=knockout]
\fill [white] (-1.9,-.9) rectangle (1.9,.9);
\node [opacity=0,font=\fontencoding{T1}\fontfamily{ptm}\fontsize{45}{45}\bfseries]

enter image description here

Note: example taken from the PGFManual. Not all renderers support it (the image above is with Adobe reader DC. It don't work with the render of texstudio)

Your Answer

ggg is a new contributor. Be nice, and check out our Code of Conduct.

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.