使用多边形轮廓精确定位和裁剪投影仪幻灯片上的图像

使用多边形轮廓精确定位和裁剪投影仪幻灯片上的图像

我想要实现这样的幻灯片: 期望输出

到目前为止我已经学会了如何使用多边形路径剪切图像如何创建无边距的框架

然而我无法将两者结合起来以获得所需的输出。

我的 MWE 如下,图片可以检索这里这里

\documentclass{beamer}
\usepackage{tikz}

\begin{document}

\setbeamertemplate{navigation symbols}{}

\begin{frame}[plain,b]
    \begin{tikzpicture}[remember picture, overlay]
        \clip (0\paperwidth,0\paperheight)--(0.4\paperwidth,0\paperheight)--(0.6\paperwidth,1\paperheight)--(0\paperwidth,1\paperheight)--cycle; 
        \node[anchor=south west] at (0,0) {\includegraphics[width=\paperwidth]{photo-1463595373836-6e0b0a8ee322.jpeg}};
    \end{tikzpicture}
\end{frame}

\end{document}

谢谢你!

答案1

paperwidth我没有使用和,而是papweheight使用了current page锚点和calctikzlibrary 来定义剪切路径。

width我没有将其作为两幅图像的比例因子,而是使用了height它们,因为否则它们的高度不够,无法覆盖幻灯片。

最后inner sep=0pt修复以避免图形周围有白边。

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}

\setbeamertemplate{navigation symbols}{}

\begin{frame}[plain,b]
    \begin{tikzpicture}[remember picture, overlay]
        \begin{scope}
        \clip (current page.south west)|- 
              ($(current page.north west)!0.6!(current page.north east)$) --
              ($(current page.south west)!0.4!(current page.south east)$) --
              cycle;
        \node [anchor=south west, inner sep=0pt] at 
              (current page.south west)
              {\includegraphics[height=\paperheight]{photo-1463595373836-6e0b0a8ee322.jpg}};
        \end{scope}
        \begin{scope}
        \clip (current page.south east)|- 
              ($(current page.north west)!0.6!(current page.north east)$) --
              ($(current page.south west)!0.4!(current page.south east)$) --
              cycle;
        \node[anchor=south west, draw, inner sep=0pt] 
             at (current page.south west)
             {\includegraphics[height=\paperheight]{photo-1464013778555-8e723c2f01f8.jpg}};
        \end{scope}
    \end{tikzpicture}
\end{frame}

\end{document}

在此处输入图片描述

答案2

使用15.6 Generalized Filling: Using Arbitrary Pictures to Fill a Path,我设法做到:

\documentclass{beamer}
\usepackage{tikz}
\usepackage{mwe}

\begin{document}

\setbeamertemplate{navigation symbols}{}

\begin{frame}[plain,b,fragile]
  \begin{tikzpicture}[path image/.style={
      path picture={
        \node at (path picture bounding box.center) {
          \includegraphics[width=\paperwidth]{#1}
        };}}]
    \draw [path image=example-image-a] (0,0)--(0.4\paperwidth,0\paperheight)--(0.6\paperwidth,\paperheight)--(0\paperwidth,\paperheight)--cycle; 

    \draw [path image=example-image] (0.4\paperwidth,0\paperheight)--(\paperwidth,0\paperheight)--(\paperwidth,\paperheight)--(0.6\paperwidth,\paperheight)--cycle; 
  \end{tikzpicture}
\end{frame}

\end{document}

在此处输入图片描述

相关内容