summaryrefslogtreecommitdiff
path: root/graphics/pgf/contrib/tikzducks/t-tikzducks.mkiv
blob: 19af36180b6044b389eb22d03fcebc5cc9d0583d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
% !TeX root = ./testing/context_duck.tex
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% The tikzducks package
% A package to bring rubber ducks into tikz
% Maintained by samcarter
%
% Project repository and bug tracker:
% https://github.com/samcarter/tikzducks
%
% Released under the LaTeX Project Public License v1.3c or later
% See http://www.latex-project.org/lppl.txt
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Code for this ConTeXt User Module kindly provided by @JairoAdelRio https://github.com/samcarter/tikzducks/pull/25
\writestatus{loading}{ConTeXt User Module / TikZDucks 2024/04/27 version v1.8 Draw rubber ducks in TikZ}

\setupcolors[state=start]
\usemodule[tikz]
\enabledirectives[colors.pgf]
\usetikzlibrary[patterns] % for the wizard hat
\usetikzlibrary[calc]
\definecolor[duck@overleafcol][x=48AC3C]

\catcode`\@=11

% Defining commands not available in context %%%%%%%%%%%%%%%%%%%%%%%%%
\define[2]\scalebox{\scale[factor={\ctxlua{context(3*#1)}}]{#2}}
\let\tiny\tfxx
\let\pdfrandomseed\randomseed

% Duck %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\duck{\dosingleempty\doduck}
\def\doduck[#1]{%
  \iffirstargument
    \startscope%
       \tikzset{/duck/.cd,#1}%
       \duck@draw%
    \stopscope%
  \else
    \startscope%
       \tikzset{/duck/.cd}%
       \duck@draw%
    \stopscope%
  \fi%
}

% Stripes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\stripes{\dosingleempty\dostripes}
\def\dostripes[#1]{%
  \iffirstargument
    \tikzset{/stripes/.cd,#1}\stripes@draw
  \else
    \tikzset{/stripes/.cd}\stripes@draw
  \fi
}

\input tikzducks-generic.tex

\catcode`\@=12
\endinput