答案1
PSTricks 解决方案:
\documentclass{article}
\usepackage{pstricks}
\begin{document}
\begin{pspicture}(4,3)
\psset{fillstyle = solid}
\psframe[fillcolor = orange](0,0)(4,3)
\pscircle(2,1.5){1}
\pscircle[fillcolor = cyan](2,1.5){0.8}
\end{pspicture}
\end{document}
如果您希望环的填充颜色与背景颜色相同,您可以执行以下操作:
\documentclass{article}
\usepackage{pstricks}
\usepackage{pagecolor}
\def\bgcolor{green!50} % background color
\pagecolor{\bgcolor}
\begin{document}
\begin{pspicture}(4,3)
\psset{fillstyle = solid}
\psframe[fillcolor = orange](0,0)(4,3)
\pscircle[fillcolor = \bgcolor](2,1.5){1}
\pscircle[fillcolor = cyan](2,1.5){0.8}
\end{pspicture}
\end{document}
答案2
这里建议使用even odd rule
填充橙色区域,即没有外圆的矩形。
\documentclass[margin=5mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\path[fill=orange,even odd rule]
(-4, -4) rectangle (4,4)
(0,0)circle[radius=2]
;
\path[fill=blue]
(0,0) circle [radius=1.5]
;
\path[draw,very thick]
(0,0) foreach \r in {1.5,2}{circle [radius=\r]}
;
\end{tikzpicture}
\end{document}
答案3
我认为最简单的方法是给整个图片涂上阴影,然后画一个白色圆圈和一个蓝色圆圈。
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
% fills entire rectangle
\fill[orange] (-4, -4) rectangle (4,4);
% removes filling inside circle
\filldraw[fill=white, draw=black, very thick] (0,0) circle (2cm);
% adds blue circle
\filldraw[fill=blue, draw=black, very thick] (0,0) circle (1.5cm);
\end{tikzpicture}
\end{document}