
다음과 같이 상자 안에 쓸 수 있도록 이미지에 음영 처리된 투명 상자를 오버레이하려고 합니다.
\documentclass{report}
\usepackage{xcolor}
\definecolor{lblue}{RGB}{15,77,158}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node[] at (0,0) {\includegraphics[width=0.9\textwidth,]{IMG_2124_Everest.jpg}};
\shade [left color=lblue, right color=lblue, opacity=0.6] (-4,1) rectangle (4,2.5);
\node[shift={(-0.0cm,1.73cm)}] at (0,0) { \textcolor{white}{\Huge\textbf{Mount Everest}} };
\end{tikzpicture}
\end{document}
그리고 그것을 정의하는 선의 가시성을 줄이기 위해 음영 처리된 상자의 테두리를 희미하게 만들고 싶습니다.
내가 읽고:
하지만 음영 처리된 상자에 적용하는 방법을 잃어버렸습니다. 그게 가능할까요?
이미지 출처:http://upload.wikimedia.org/wikipedia/commons/0/00/IMG_2124_Everest.jpg
답변1
이 솔루션은 foreach
루프를 사용하여 내부 직사각형 상자에서 모서리가 둥근 외부 상자로 이동합니다. 다른 솔루션은 OP의 연결된 질문을 참조하세요.
\documentclass[tikz, border=1cm]{standalone}
\usetikzlibrary{fadings}
\pgfmathsetmacro{\mywidth}{9}
\pgfmathsetmacro{\myheight}{3.5}
\pgfmathsetmacro{\myfadewidth}{1}
\begin{tikzfadingfrompicture}[name=myfading]
\foreach \i in {100,...,0}
\fill[transparent!\i, rounded corners=\myfadewidth/100*\i cm] (-\mywidth/2-\myfadewidth/100*\i+\myfadewidth,-\myheight/2-\myfadewidth/100*\i+\myfadewidth) rectangle (\mywidth/2+\myfadewidth/100*\i-\myfadewidth,\myheight/2+\myfadewidth/100*\i-\myfadewidth);
\end{tikzfadingfrompicture}
\begin{document}
\begin{tikzpicture}
\node {\includegraphics[width=12cm]{example-image}};
\node[
fill=blue, text=white,
fill opacity=0.6, text opacity=1,
minimum width=\mywidth cm, minimum height=\myheight cm,
path fading=myfading, fit fading=false,
font=\Huge\bf,
yshift=1.5cm, fading transform={yshift=1.5cm},
] {Mount Everest};
\end{tikzpicture}
\end{document}
루프 대신 a를 \pgfdeclarefunctionalshading
사용할 수도 있지만 이는 간단하지 않으며 이 경고는 매뉴얼에 있습니다.
이러한 음영처리는 이동성이 가장 낮으며 렌더러에게 가장 큰 부담을 줍니다. 속도가 느리고 올바르게 인쇄되지 않을 수도 있습니다!