diff --git a/.gitignore b/.gitignore index e0e8af4..cf8fd41 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ *.maf *.mtc *.mtc0 +*.svg *.pdf diff --git a/tikz/resource-allocation-graph/Makefile b/tikz/resource-allocation-graph/Makefile new file mode 100644 index 0000000..69e2877 --- /dev/null +++ b/tikz/resource-allocation-graph/Makefile @@ -0,0 +1,35 @@ +SOURCE = resource-allocation-graph +DELAY = 80 +DENSITY = 300 +WIDTH = 512 + +make: + pdflatex $(SOURCE).tex -output-format=pdf + make clean + +clean: + rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot + +gif: + pdfcrop $(SOURCE).pdf + convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif + make clean + +png: + make + make svg + inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png + +transparentGif: + convert $(SOURCE).pdf -transparent white result.gif + make clean + +svg: + make + #inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg + pdf2svg $(SOURCE).pdf $(SOURCE).svg + # Necessary, as pdf2svg does not always create valid svgs: + inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg + rsvg-convert -a -w $(WIDTH) -f svg $(SOURCE).svg -o $(SOURCE)2.svg + inkscape $(SOURCE)2.svg --export-plain-svg=$(SOURCE).svg + rm $(SOURCE)2.svg diff --git a/tikz/resource-allocation-graph/resource-allocation-graph.png b/tikz/resource-allocation-graph/resource-allocation-graph.png new file mode 100644 index 0000000..d20180a Binary files /dev/null and b/tikz/resource-allocation-graph/resource-allocation-graph.png differ diff --git a/tikz/resource-allocation-graph/resource-allocation-graph.tex b/tikz/resource-allocation-graph/resource-allocation-graph.tex new file mode 100644 index 0000000..8430074 --- /dev/null +++ b/tikz/resource-allocation-graph/resource-allocation-graph.tex @@ -0,0 +1,28 @@ +\documentclass{article} +\usepackage[pdftex,active,tightpage]{preview} +\setlength\PreviewBorder{2mm} + +\usepackage{tikz} +\usetikzlibrary{arrows,positioning, calc,lindenmayersystems,decorations.pathmorphing,intersections} +\tikzstyle{resource}= [draw,minimum size=16pt,inner sep=0pt] +\tikzstyle{process} = [draw,minimum size=16pt,inner sep=0pt,circle] +\tikzstyle{allocation} = [->,thick,arrows={-latex}] + +\begin{document} +\begin{preview} +\begin{tikzpicture}[scale=2] + \node (r1)[resource] at (0,2) {$R_1$}; + \node (r2)[resource] at (1,2) {$R_2$}; + \node (r3)[resource] at (2,2) {$R_3$}; + \node (p1)[process] at (0,1) {$P_1$}; + \node (p2)[process] at (1,1) {$P_2$}; + \node (p3)[process] at (2,1) {$P_3$}; + \node (r4)[resource] at (0,0) {$R_4$}; + + \draw[allocation] (r1) -- (p1); + \draw[allocation] (r2) -- (p2); + \draw[allocation] (r3) -- (p2); + \draw[allocation] (p3) -- (r3); +\end{tikzpicture} +\end{preview} +\end{document}