有没有类似 mermaid 的通过代码绘制这种图形的
绘图软件
相关帖子
-
-
不怕麻烦可以试试 Tikz,大概让 GPT 配合整了一下。
\documentclass[tikz,border=2mm]{standalone} \usetikzlibrary{shapes.geometric, arrows, fit, positioning,calc} \begin{document} \begin{tikzpicture}[font=\small] % Ethernet II Frame \node[draw, rectangle, minimum height=1cm, minimum width=3cm, fill=cyan!30] (dmac1) {DMAC (6 B)}; \node[draw, rectangle, minimum height=1cm, minimum width=3cm, fill=cyan!30, right=0cm of dmac1] (smac1) {SMAC (6 B)}; \node[draw, rectangle, minimum height=1cm, minimum width=3cm, fill=cyan!60, right=0cm of smac1] (type1) {Type (2 B)}; \node[draw, rectangle, minimum height=1cm, minimum width=11cm, fill=cyan!30, right=0cm of type1] (data1) {Data (46-1500 B)}; \node[draw, rectangle, minimum height=1cm, minimum width=2cm, fill=cyan!30, right=0cm of data1] (fcs1) {FCS (4 B)}; \node[anchor=east, left=0.5cm of dmac1] (ethernetii) {Ethernet II}; % IEEE 802.3 Frame \node[draw, rectangle, minimum height=1cm, minimum width=3cm, fill=cyan!30, below=1.5cm of dmac1] (dmac2) {DMAC (6 B)}; \node[draw, rectangle, minimum height=1cm, minimum width=3cm, fill=cyan!30, right=0cm of dmac2] (smac2) {SMAC (6 B)}; \node[draw, rectangle, minimum height=1cm, minimum width=3cm, fill=cyan!60, right=0cm of smac2] (length) {Length (2 B)}; \node[draw, rectangle, minimum height=1cm, minimum width=3cm, fill=cyan!60, right=0cm of length] (llc) {LLC (3 B)}; \node[draw, rectangle, minimum height=1cm, minimum width=5cm, fill=cyan!60, right=0cm of llc] (snap) {SNAP (5 B)}; \node[draw, rectangle, minimum height=1cm, minimum width=3cm, fill=cyan!30, right=0cm of snap] (data2) {Data (38-1492 B)}; \node[draw, rectangle, minimum height=1cm, minimum width=2cm, fill=cyan!30, right=0cm of data2] (fcs2) {FCS (4 B)}; \node[anchor=east, left=0.5cm of dmac2] (ieee8023) {IEEE 802.3}; % SNAP Fields Breakdown \node[draw, rectangle, minimum height=1cm, minimum width=2cm, fill=cyan!30, below=2cm of llc.west, anchor=west] (dsap) {D.SAP (1 B)}; \node[draw, rectangle, minimum height=1cm, minimum width=2cm, fill=cyan!30, right=0cm of dsap] (ssap) {S.SAP (1 B)}; \node[draw, rectangle, minimum height=1cm, minimum width=2cm, fill=cyan!30, right=0cm of ssap] (control) {Control (1 B)}; \node[draw, rectangle, minimum height=1cm, minimum width=3cm, fill=cyan!30, right=2cm of control] (org) {Org Code (3 B)}; \node[draw, rectangle, minimum height=1cm, minimum width=2cm, fill=cyan!30, right=0cm of org] (type2) {Type (2 B)}; % Vertical alignment lines \draw[dashed] (llc.north west) -- (data1.south west); \draw[dashed] (data2.north east) -- (data1.south east); % Arrows with 46-1500B label \draw[<->, thick] ($(llc.north west)!0.5!(data1.south west)$) -- ($(data2.north east)!0.5!(data1.south east)$) node[midway, fill=white, inner sep=1pt] {46-1500 B}; % Fit boxes for IEEE 802.3 breakdown \node[draw, dashed, inner sep=2mm, fit={(dsap) (type2)}] (snapfit) {}; % Additional dashed lines for SNAP fit \draw[dashed] (llc.south west) -- (snapfit.north west); \draw[dashed] (snap.south east) -- (snapfit.north east); \end{tikzpicture} \end{document}
1 回复 -
欢迎来到这里!
我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。
注册 关于