答案1
这是众多可能性中的一种。请注意,complete sines
距离是量化的,这意味着如果你稍微改变一些距离,影响可能会比预期的要大。
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{matrix}
% from https://tex.stackexchange.com/a/25689/121799
\usetikzlibrary{decorations}
\pgfdeclaredecoration{complete sines}{initial}
{
\state{initial}[
width=+0pt,
next state=sine,
persistent precomputation={\pgfmathsetmacro\matchinglength{
\pgfdecoratedinputsegmentlength / int(\pgfdecoratedinputsegmentlength/\pgfdecorationsegmentlength)}
\setlength{\pgfdecorationsegmentlength}{\matchinglength pt}
}] {}
\state{sine}[width=\pgfdecorationsegmentlength]{
\pgfpathsine{\pgfpoint{0.25\pgfdecorationsegmentlength}{0.5\pgfdecorationsegmentamplitude}}
\pgfpathcosine{\pgfpoint{0.25\pgfdecorationsegmentlength}{-0.5\pgfdecorationsegmentamplitude}}
\pgfpathsine{\pgfpoint{0.25\pgfdecorationsegmentlength}{-0.5\pgfdecorationsegmentamplitude}}
\pgfpathcosine{\pgfpoint{0.25\pgfdecorationsegmentlength}{0.5\pgfdecorationsegmentamplitude}}
}
\state{final}{}
}
\begin{document}
\begin{tikzpicture}[decoration={complete sines,amplitude=8pt, segment length=11pt}]
\matrix (m) [fill=blue!20,matrix of nodes,inner sep=0pt,
nodes={draw,minimum width=9mm,minimum height=5mm},
column sep=-\pgflinewidth/2,row sep=-\pgflinewidth/2,]%
{
105 & 102 & 96 & \phantom{123}\\
103 & 99 & 107 & \phantom{123}\\
101 & 98 & 105 & \phantom{123}\\
\phantom{123} & \phantom{123} & \phantom{123} & \phantom{123} \\
};
\fill[white,decorate,overlay] ([xshift=6mm,yshift=10pt]m.north east) coordinate (tl)
-- ([xshift=-5mm,yshift=10pt]m.north east)
-- ([xshift=-5mm,yshift=10pt]m.south east)
-- ([xshift=-5pt,yshift=10pt]m.south west)
-- ++ (0,-18pt) -| cycle;
\end{tikzpicture}
\end{document}
另一种可能性是将矩阵剪裁成某种(预定义的)形状。我在这里使用的是云,但它可以是任何东西。
\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{matrix,shapes}
\makeatletter
\tikzset{ % https://tex.stackexchange.com/a/38995/121799
use path/.code={\pgfsyssoftpath@setcurrentpath{#1}}
}
\makeatother
\begin{document}
\begin{tikzpicture}
\begin{pgfinterruptboundingbox}
\node[cloud,save path=\Cloud,aspect=2,cloud puffs=20,
minimum width=4.5cm,minimum height=2.5cm%,draw
] (cloud){};
\clip[use path=\Cloud];
\end{pgfinterruptboundingbox}
\matrix (m) at ([xshift=3mm,yshift=-3mm]cloud.north west) [anchor=north west,
fill=blue!20,matrix of nodes,inner sep=0pt,
nodes={draw,minimum width=9mm,minimum height=5mm},
column sep=-\pgflinewidth/2,row sep=-\pgflinewidth/2,]%
{
105 & 102 & 96 & \phantom{123}\\
103 & 99 & 107 & \phantom{123}\\
101 & 98 & 105 & \phantom{123}\\
\phantom{123} & \phantom{123} & \phantom{123} & \phantom{123} \\
};
\end{tikzpicture}
\end{document}
(似乎无法path picture
轻易地将矩阵放入其中,否则这里的事情会简化。)