TikZ - 可以绘制这个框图吗?

TikZ - 可以绘制这个框图吗?

我在进行演示时遇到了问题beamer

在此处输入图片描述

我可以用 LibreOffice 打开原始幻灯片 (PDF),并且可以检索图表的结构。我可以从这里开始,并将其(不是图像而是结构)放在我的beamer演示文稿中吗?

我尝试将图像直接放在框架上,但图像有模糊效果。有人可以帮我提供TikZ此图表的版本吗?

平均能量损失

\documentclass{beamer}
\title{TITLE}
\author{ME}
\date{TODAY}
\usetheme{Berlin}
\setbeamercovered{dynamic}

\begin{document}

\begin{frame}
\maketitle
\end{frame}

\begin{frame}
\frametitle{Sistemi Crittografici}
\framesubtitle{Proteggere i contenuti} 
\begin{figure}[t]
\includegraphics[opts.]{the image of the diagram}
\end{figure}
\begin{itemize}[<+->]
\item{bla}
\item{bla bla bla}
\item{bla bla bla bla bla}
\end{itemize}
\end{frame}

\end{document}

答案1

一种可能性是:

在此处输入图片描述

代码(需要 PGF/TikZ 版本 3.0):

\documentclass[border=3pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,fit,patterns}

\tikzset{
  pics/media/.style ={
    code = { %
      \node[text width=2cm,minimum height=2cm,#1] (back) {};
      \node[draw,anchor=center,fill=white] at ([yshift=5pt]back.center) {Media};
      \draw[dashed] (back.north west) rectangle (back.south east);
    }
  },
  pics/media/.default={pattern=north east lines},
  aes/.style={
    draw,
    fill=red!30
  },
  rsa/.style={
    draw,
    rounded corners,
    fill=blue!30
  },
  ar/.style={
    ->,
    >=latex,
    shorten >= 3pt,
    shorten <= 3pt,    
  },
  ar2/.style={
    ->,
    >=latex,
    line width=2pt,
    shorten >= 3pt,
    shorten <= 3pt,    
  }
}

\newcommand\mediaencryptedbox[3][1cm]{
\node[
  draw,
  thick,
  rounded corners,
  #2,
  text width=3.5cm,
  minimum height=4.5cm,
  anchor=north west,
  yshift=#1
  ]
  (#3)
  {};
\node[
  aes,
  anchor=north
  ]
  at (#3.north) 
  {AES key}; 
\pic at (#3.center) (sm3) {media};
\node[
  anchor=south
  ]
  (rsa)  
  at (sm3back.north) 
  {Encrypted with RSA};
\node[
  anchor=north
  ] 
  at (sm3back.south) 
  {Encrypted with AES};
\draw
  (#3.west|-rsa.south) -- (#3.east|-rsa.south);
}

\begin{document}

\begin{tikzpicture}

% The Server
\pic (sm1) {media={fill=gray!30}};
\pic[right=of sm1back] (sm2) {media};
\mediaencryptedbox{right=of sm2back}{box1}
\node[
  aes,
  anchor=north,
  above=of sm2back.north
  ]
  (aes1)
  {AES key};  
\draw[ar]
  (aes1) -- (sm2back.north) ;  
\draw[ar]
  (aes1.south east) to[out=-60,in=180] coordinate (aux1) (box1.north west) ;
\node[
  anchor=west,
  rsa
  ]
  at (aux1|-aes1)
  (rsa1)
  {RSA public key};    

\draw[ar]
  (rsa1) -- (aux1) ;  

\draw[ar2]
  (sm1back.east) -- (sm2back.west);
\draw[ar2]
  (sm2back.east) -- (box1.west|-sm2back.east);

\node[
  inner sep=10pt,
  draw,
  dashed,fit={(sm1back.north west) (box1.south east) (aes1)}
  ]
  (server) 
  {};
\node[
  anchor=south west,
  font=\Large
  ]
  at ([shift={(15pt,5pt)}]server.north west)
  {Server};      

% The Player
\mediaencryptedbox[2.2cm]{right=6cm of box1}{box2}
\node[
  anchor=north west,
  rsa,
  above left=of box2
  ]
  (rsa2)
  {RSA public key};    
\draw[ar]
  (rsa2.south) 
    to[out=-80,in=160]
    node[align=center,anchor=east,shift={(10pt,-20pt)}] {RSA decryption \\ (slow)} 
  ([yshift=-20pt]box2.north west);
\draw[ar]
  ([yshift=-10pt]box2.north east) 
    to[out=0,in=0]
    node[align=center,anchor=west,shift={(5pt,0pt)}] (AESd) {AES decryption \\ (fast)} 
  (sm3back.east);
\node[
  inner sep=10pt,
  draw,
  dashed,fit={(rsa2) (box2.south east) (AESd)}
  ]
  (player) 
  {};
\node[
  anchor=south west,
  font=\Large
  ]
  at ([shift={(15pt,5pt)}]player.north west)
  {Player};

\draw[ar2]
  (server.east) -- (player.west|-server.east);        
\draw[ar2]
  ([yshift=10pt]sm3back.south east) -- ++(3cm,0) node[near end,anchor=south west] {Streaming};
\end{tikzpicture}

\end{document}

答案2

启动时,看一下(使用 TikZ):

\documentclass[12pt]{article}
\usepackage{tikz}
\usepackage[left=0in,right=0in]{geometry}
\begin{document}
\begin{tikzpicture}
\draw[dashed, color=blue] (-3,0) rectangle (4,4);
\filldraw[color=blue!20] (-2.5,1.2) rectangle (-0.5,2.7); 
\end{tikzpicture}
\end{document} 

在此处输入图片描述

相关内容