Füllen eines Bereichs mit einem in einer Datei gespeicherten Muster

Füllen eines Bereichs mit einem in einer Datei gespeicherten Muster

Wie kann ich mithilfe des folgenden Codes diesen geschlossenen Bereich mit einem Muster füllen, das in einer externen Datei als beiliegendes Muster gespeichert ist?

\documentclass{beamer}
\setbeamertemplate{navigation symbols}{}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{frame}[t]
\frametitle{}
\begin{tikzpicture}[scale=.9, transform shape]
\node [thin, black] at (0,0) (i){x};
\draw [very thick, blue] (i.center) node (ii){} to [out=5, in=170] ++(0.:7.cm) -- +(-90:2.2cm)  to [out=130, in=-170, looseness=.6] (ii.center) -- cycle;
\end{tikzpicture}
\end{frame} 
\end{document} 

Bildbeschreibung hier eingeben

Bildbeschreibung hier eingeben

Antwort1

Beamer lädt das graphicxPaket. Ich verwende ein Beispielbild, das mit diesem Paket verfügbar ist.

Ich verwende die path pictureOption, die im Abschnitt definiert istVerallgemeinertes Füllen: Verwenden beliebiger Bilder zum Füllen eines Pfadsdes TikZ-Handbuchs.

Bildschirmfoto

\documentclass{beamer}
\setbeamertemplate{navigation symbols}{}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{frame}[t]
\frametitle{}
\begin{tikzpicture}[scale=.9, transform shape]
\node [thin, black] at (0,0) (i){};
\draw [very thick, blue] (i.center) node (ii){} to [out=5, in=170] ++(0.:7.cm) -- +(-90:2.2cm)  to [out=130, in=-170, looseness=.6] (ii.center) -- cycle
[path picture={\node at (path picture bounding box.center) {\includegraphics{example-image}};}];
\end{tikzpicture}
\end{frame} 
\end{document} 

Bildgröße

Wie @zarko richtig bemerkt, ist es notwendig, dass das Bild größer als der Pfad ist. Sonst entsteht ein Loch.

Eine Lösung besteht dann darin, hier einen Vergrößerungsfaktor zu verwenden scale=1.4.

Bildgröße

\documentclass{article}
\usepackage[margin=10mm]{geometry}
\usepackage{graphicx,mwe,tikz}

\begin{document}

\Huge{SCALE=1}
\smallskip

\newcommand{\facteur}{1}

\begin{tikzpicture}
\node [thin, black] at (0,0) (i){};
\node[] at (i.center){\includegraphics[scale=\facteur]{example-image}};
\draw [very thick, blue,fill=cyan!80,fill opacity=.5] (-2.7,1) node (ii){} to [out=5, in=170] ++(0.:7.cm) -- +(-90:2.2cm)  to [out=130, in=-170, looseness=.6] (ii.center) -- cycle
[path picture={\node at (path picture bounding box.center) {\includegraphics[scale=\facteur]{example-image}};}];

\draw(current bounding box.south east)rectangle(current bounding box.north west);
\end{tikzpicture}


\bigskip
\Huge{SCALE=1}
\smallskip

\begin{tikzpicture}
\node [thin, black] at (0,0) (i){};
\node[] at (i.center){\includegraphics[scale=\facteur]{example-image-duck}};
\draw [very thick, blue,fill=cyan!80,fill opacity=.5] (-2.7,1) node (ii){} to [out=5, in=170] ++(0.:7.cm) -- +(-90:2.2cm)  to [out=130, in=-170, looseness=.6] (ii.center) -- cycle
[path picture={\node at (path picture bounding box.center) {\includegraphics[scale=\facteur]{example-image-duck}};}];

\draw(current bounding box.south east)rectangle(current bounding box.north west);
\end{tikzpicture}

\renewcommand{\facteur}{1.4}
\bigskip
\Huge{SCALE=1.4}
\smallskip

\begin{tikzpicture}
\node [thin, black] at (0,0) (i){};
\node[] at (i.center){\includegraphics[scale=\facteur]{example-image-duck}};
\draw [very thick, blue,fill=cyan!80,fill opacity=.5] (-2.7,1) node (ii){} to [out=5, in=170] ++(0.:7.cm) -- +(-90:2.2cm)  to [out=130, in=-170, looseness=.6] (ii.center) -- cycle
[path picture={\node at (path picture bounding box.center) {\includegraphics[scale=\facteur]{example-image-duck}};}];

\draw(current bounding box.south east)rectangle(current bounding box.north west);
\end{tikzpicture}
\end{document}

Antwort2

So was?

Bildbeschreibung hier eingeben

example-image-duckDa ich die von mir im Paket definierte Musterdatei nicht habe graphicx.

MWE:

\documentclass{beamer}
\setbeamertemplate{navigation symbols}{}
\usepackage{tikz}
\usetikzlibrary{positioning}

\begin{document}
\begin{frame}
\frametitle{}
\begin{tikzpicture}[scale=.9, transform shape]
\coordinate (i);
\path[preaction={draw=blue!50, ultra thick},clip] 
    (i) to [out=5, in=170] ++(0.:7.cm) -- +(-90:2.2cm)  
        to [out=130, in=-170, looseness=.6] (i);
\node (j) [minimum width=\linewidth, minimum height=0.5\linewidth, 
           right=-5mm of i] 
    {\includegraphics[width=\linewidth]{example-image-duck}};
\end{tikzpicture}
\end{frame}
\end{document} 

verwandte Informationen