%3F.png)
draw=none
TikZ 키-값 쌍 과 의 차이점은 무엇입니까 draw opacity=0
? 기능적으로 동일합니까, 아니면 하나를 다른 것보다 선호해야 하는 상황이 있습니까? 마찬가지로, fill=none
그리고 의 차이점은 무엇입니까 fill opacity=0
?
답변1
draw=none
(명령과 동일 \path
) 실제로 TikZ가 구성된 경로를 버리고 경계 상자는 방해받지 않습니다. (말도 안되는 소리, 경계 상자는 변경되지만 line width
무시만 됩니다. 이 어리석음을 잡아준 @Fritz에게 감사드립니다.)
draw opacity=0
그러나 잉크 없이 경로가 그려지므로 경계 상자는 line width
옵션이 적용된 상태로 업데이트되므로 선 스타일은 경계 상자 계산에 중요합니다.
\begin{tikzpicture}
\draw (0,0) rectangle (3,3);
\draw[opacity=0,line width=1cm] (0,0) rectangle (3,3); % Enlarge the bounding box
\pgfsetlinewidth{5cm} % this has no effect
\pgfpathmoveto{\pgfpointorigin}
\pgfpathlineto{\pgfpoint{4cm}{4cm}} % this updates the known max x,y coordinates!!
\pgfusepath{} % even though it's thrown away.
\begin{pgfinterruptboundingbox}
\pgfpathmoveto{\pgfpointorigin}
\pgfpathlineto{\pgfpoint{10cm}{10cm}} % Nothing happens
\pgfusepath{}
\end{pgfinterruptboundingbox}
\draw[dashed,thin] (current bounding box.north east) rectangle (current bounding box.south west);
\end{tikzpicture}
답변2
filling opacity
채우기 작업뿐만 아니라 텍스트 및 이미지에도 적용됩니다. 다음 예에서는 fill=none
및 (실제로 는 텍스트를 표시하기 위해 fill opacity=0
사용함 ) 결과가 서로 다른 경우를 보여줍니다. 노드 레이블에는 영향을 미치지 않지만 텍스트에는 영향을 미칩니다.fill opacity=0.2
fill=none
fill opacity=<value>
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\fill[olive] (0,0) rectangle (3,2);
\node[fill opacity=0.2] at (3,2) {\huge B};
\node[fill=none] at (0,0) {\huge A};
\end{tikzpicture}
\end{document}