无需重写代码,我希望圆圈重叠的部分是透明的,因此它看起来是白色的(或隐藏在圆圈后面的任何颜色)。
平面设计师可能会将此称为剪贴蒙版,阿尔法合成等等。
这是一个布尔运算:A XOR B。
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[node distance=3.50em, auto]
%%% define shapes %%%
\tikzstyle{bluecircle} = [draw, circle,
fill=blue!20,
line width=0.00em,
minimum height=5.00em,
text centered]
\tikzstyle{emptycircle} = [draw, circle,
fill=none,
line width=0.10em,
minimum height=5.00em,
text centered]
\tikzstyle{emptysquare} = [draw, rectangle,
fill=none,
line width=0.10em,
minimum height=6.00em,
text width = 9.00em,
text centered]
%%% circle fill %%%
\node[bluecircle] (A) {};
\node[bluecircle, right of=A] (B) {};
%%% circle edge %%%
\node[emptycircle] (A2) {$A$};
\node[emptycircle, right of=A] (B2) {$B$};
%%% square edge %%%
\node[emptysquare, xshift=1.75em] (U) {};
\end{tikzpicture}
\end{document}
答案1
使用clip
命令可以得到以下结果。
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[node distance=3.50em, auto]
%%% define shapes %%%
\tikzstyle{bluecircle} = [draw, circle,
fill=blue!20,
line width=0.00em,
minimum height=5.00em,
text centered]
\tikzstyle{emptycircle} = [draw, circle,
fill=none,
line width=0.10em,
minimum height=5.00em,
text centered]
\tikzstyle{emptysquare} = [draw, rectangle,
fill=none,
line width=0.10em,
minimum height=6.00em,
text width = 9.00em,
text centered]
%%% circle fill %%%
\node[bluecircle] (A) {};
\node[bluecircle, right of=A] (B) {};
%%% circle edge %%%
%\node[emptycircle] (A2) {};
%\node[emptycircle, right of=A] (B2) {$B$};
%%% square edge %%%
\node[emptysquare, xshift=1.75em] (U) {};
\begin{scope}
\clip (A.center) circle [radius=2.5em];
\fill[fill=white] (B.center) circle [radius=2.5em];
\end{scope}
%%% circle edge %%%
\node[emptycircle] (A2) {$A$};
\node[emptycircle, right of=A] (B2) {$B$};
\end{tikzpicture}
\end{document}