考虑一下代码
\documentclass{book}
\textheight=10in
\usepackage{tikz,graphicx}
\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}
\node[opacity=0.5, inner sep=0pt](A) at (0, 0) {\includegraphics[scale=0.5]{example-image}};
\shade [left color=blue, right color=white, shading angle=45, opacity=0.5]
(A.south west) rectangle (A.north east);
\end{tikzpicture} \, Shading Angle=45
\begin{tikzpicture}
\node[opacity=0.5, inner sep=0pt](A) at (0, 0) {\includegraphics[scale=0.5]{example-image}};
\shade [left color=blue, right color=white, shading angle=135, opacity=0.5]
(A.south west) rectangle (A.north east);
\end{tikzpicture} \, Shading Angle=135
\begin{tikzpicture}
\node[opacity=0.5, inner sep=0pt](A) at (0, 0) {\includegraphics[scale=0.5]{example-image}};
\shade [left color=blue, right color=white, shading angle=225, opacity=0.5]
(A.south west) rectangle (A.north east);
\end{tikzpicture} \, Shading Angle=225
\begin{tikzpicture}
\node[opacity=0.5, inner sep=0pt](A) at (0, 0) {\includegraphics[scale=0.5]{example-image}};
\shade [left color=blue, right color=white, shading angle=315, opacity=0.5]
(A.south west) rectangle (A.north east);
\end{tikzpicture} \, Shading Angle=315
\end{document}
产生四幅图像
实际上,我希望将四幅图像合并为一幅;也就是说,我希望生成一幅具有shading angle=45
、shading angle=135
、shading angle=225
和效果的图像,shading angle=315
但该命令似乎\shade
一次只能处理一个阴影角度。如果可能的话,我怎样才能将所有四个阴影角度效果合并为一幅tikzpicture
?
谢谢。
答案1
我不知道您想象的结果应该是什么样的!?一种方法是混合几种色调。混合模式有很多种 - 请参阅手册第 357-359 页。
\documentclass[tikz, border=1cm]{standalone}
\begin{document}
\begin{tikzpicture}
\node[opacity=0.5, inner sep=0pt] (A) at (0,0) {\includegraphics[scale=0.5]{example-image}};
\begin{scope}[blend mode=lighten]
\shade [left color=blue, right color=white, shading angle=45 , opacity=0.5] (A.south west) rectangle (A.north east);
\shade [left color=blue, right color=white, shading angle=135, opacity=0.5] (A.south west) rectangle (A.north east);
\shade [left color=blue, right color=white, shading angle=225, opacity=0.5] (A.south west) rectangle (A.north east);
\shade [left color=blue, right color=white, shading angle=315, opacity=0.5] (A.south west) rectangle (A.north east);
\end{scope}
\end{tikzpicture}
\begin{tikzpicture}
\node[opacity=0.5, inner sep=0pt] (A) at (0,0) {\includegraphics[scale=0.5]{example-image}};
\shade [inner color=blue, outer color=white, shading angle=45 , opacity=0.5] (A.south west) rectangle (A.north east);
\end{tikzpicture}
\end{document}
\documentclass[tikz, border=1cm]{standalone}
\begin{document}
\begin{tikzpicture}
\node[opacity=0.5, inner sep=0pt] (A) at (0,0) {\includegraphics[scale=0.5]{example-image}};
\shade [left color=blue, right color=white, shading angle=45 , opacity=0.5] (A.center) rectangle (A.south east);
\shade [left color=blue, right color=white, shading angle=135, opacity=0.5] (A.center) rectangle (A.north east);
\shade [left color=blue, right color=white, shading angle=225, opacity=0.5] (A.center) rectangle (A.north west);
\shade [left color=blue, right color=white, shading angle=315, opacity=0.5] (A.center) rectangle (A.south west);
\end{tikzpicture}
\end{document}
您还可以声明自己的功能阴影。