I have a tikzpicture
tiled inside of a tikzpicture
with the shape
of a starburst as a central, repeating node
. I want to fill the starburst with a picture. Normally, for a question here, I'd take the starburst out of the tiling and have a much simpler MWE. However, I do not want work-around solutions that are incompatible with tiling using an \sbox
. I have this which produces a starburst in a tiling as expected:
\documentclass[tikz]{standalone}
\usepackage[skins]{tcolorbox}
\usetikzlibrary{shapes}
\begin{document}
\newsavebox{\tileone}
\sbox{\tileone}{\let\newpage\relax%
\begin{tikzpicture}[x=0.975cm,y=0.975cm]
\clip (0,0.15) rectangle (2,2.15);
\foreach \x in {0,1} {
\foreach \y in {0,1} {
\node[] at (2*\x, 2*\y)
{ \includegraphics[width=0.065\textwidth]{globe.png}};
\node[shape=starburst, fill=yellow, draw=red, very thin, rotate=10,
/pgf/starburst point height=0.25cm, line width=0.25pt,
minimum height=1.20cm, minimum width=1.20cm, name=ystar
] at (2*\x+1, 2*\y+1) { };
}
}
\begin{scope}[dashed,black]
\draw plot (\x,\x-1);
\draw plot (\x,\x+1);
\draw plot (\x,-\x+1);
\draw plot (\x,-\x+3);
\end{scope}
\end{tikzpicture}%
}
\begin{tikzpicture}[x=1.0cm, y=1.0cm]
\tikzstyle{every node}=[font=\tiny]
\path[draw,fill tile picture={\node[inner sep=0pt,outer sep=0pt,
fill=blue!40!yellow, rounded corners=0.5ex]
{\scalebox{0.5}{\usebox{\tileone}}};
}, rounded corners=1ex] (0.0, 0.0) rectangle (4.0, 4.0);
\end{tikzpicture}
\end{document}
When I replace ] at (2*\x+1, 2*\y+1) { };
with ] at (2*\x+1, 2*\y+1) {path picture bounding box.center={\node {\includegraphics[width=0.065\textwidth]{Fireball.png} } } };
, I get an error message that path picture
is an undefined control sequence even though the Tikz & PGF manual
for Version 2.10-cvs
says that nodes are placed on paths. When I substitute ystar.center
for path picture bounding box.center
, I get another undefined control sequence error.
By substituting \node at (2*\x+1, 2*\y+1) {\includegraphics[width=0.065\textwidth]{Fireball.png}};
for the entire starburst node, I can get this, but the picture is already in the shape of a circle, and I want a starburst.
Lastly, I can draw a shape and use that bounding box to trim the picture, but I don't want to draw each segment of the starburst:
\draw[path picture={\node at (path picture bounding box.center) {
\includegraphics[height=2.50cm, trim=70 0 0 30, clip]
{Fireball.png} };},
draw=blue, thick] (2*\x+1, 2*\y+1) -- ++ (0,0.75) -- ++ (0.75, 0) -- cycle;
Not the actual shape I'll use, but this process does trim a picture by the shape.
Other Answers
This talks about shapes
inside of a node, but I want a shape to act as a bounding box for a picture inside of a node. TikZ: Different shapes inside of a node
This shows how to fill a (drawn) rectangle with a picture, but as I've said above, I'm not looking to draw a shape. I want use a shape from a shape library: How to create a rectangle filled with image using TikZ?
This addresses a particular feature of drawing a rectangle to use to trim a picture, but not what I want: How to create a rectangle filled with image using TikZ?
This talks about including graphics in a node, not the bounding box issue: Moving a picture inside a scope on a background layer
This is close, but does not include the bounding aspect, which is really what is tripping me up: How to typeset a TikZ picture inside a node?