% style `snow': the default tiles with wavy snow on most upper edges and on the % finder rings; tunables \fancyqr@snow@color, \fancyqr@snow@line, % \fancyqr@snow@height, \fancyqr@snow@wave and \fancyqr@snow@chance (of a row % of tiles to get snow), \fancyqr@snow@icicle@chance (of a snow-covered tile to % get ice running down over it, and with white below drips on its lower edge) \@ifundefined{fancyqr@snow@color}{\def\fancyqr@snow@color{blue!5!white}}{}% \@ifundefined{fancyqr@snow@line}{\def\fancyqr@snow@line{blue!25!gray!55!white}}{}% \@ifundefined{fancyqr@snow@height}{\def\fancyqr@snow@height{.32}}{}% \@ifundefined{fancyqr@snow@wave}{\def\fancyqr@snow@wave{.1}}{}% \@ifundefined{fancyqr@snow@chance}{\def\fancyqr@snow@chance{.7}}{}% \@ifundefined{fancyqr@snow@icicle@chance}{\def\fancyqr@snow@icicle@chance{.25}}{}% \ifdefined\fancyqr@snow@c\else\newcount\fancyqr@snow@c\fi\ifdefined\fancyqr@snow@k\else\newcount\fancyqr@snow@k\fi \newif\iffancyqr@snow@ % \fancyqr@snow@sin@ is sin(k/10), k = 0..62 covers one period \@tempcnta\z@ \@whilenum\@tempcnta<63\do{\expandafter\xdef\csname fancyqr@snow@sin@\the\@tempcnta\endcsname {\fpeval{round(sin(\@tempcnta/10),4)}}\advance\@tempcnta\@ne}% \def\fancyqr@snow@sin#1{\csname fancyqr@snow@sin@\fancyqr@snow@mod{#1}{63}\endcsname}% \def\fancyqr@snow@mod#1#2{\the\numexpr(#1)-#2*(((#1)-(#2-1)/2)/#2)\relax}% % the wave at column #2, row #3: its height \fancyqr@snow@h and slope \fancyqr@snow@s, % both 0 at a free end (#1 = 1), which meets the round corner \def\fancyqr@snow@wave@at#1#2#3{% \ifnum#1=\@ne\def\fancyqr@snow@h{0}\def\fancyqr@snow@s{0}\else \edef\fancyqr@snow@h{\fancyqr@snow@wave*\fancyqr@snow@sin{23*#2+17*#3}}% \edef\fancyqr@snow@s{2.3*\fancyqr@snow@wave*\fancyqr@snow@sin{23*#2+17*#3+16}}\fi}% % the shape of a cap of width #1 on tiles with corner radius #2 and top at % \fancyqr@snow@one (tiles are drawn larger by their overlap); #3/#4 are 1 if the % left/right end is free, 0 if the snow runs on to the neighbour; cached \def\fancyqr@snow@setup#1#2#3#4{% \def\fancyqr@snow@w{#1}\def\fancyqr@snow@l{#3}\def\fancyqr@snow@r{#4}% \edef\@tempa{fancyqr@snow@m@#1@#2@#3#4@\fancyqr@snow@height @\fancyqr@snow@one}% \ifcsname\@tempa\endcsname\else\fancyqr@snow@shape{#1}{#2}{#3}{#4}\fi \csname\@tempa\endcsname}% % a free end runs out on the corner of radius r (centre (x, 1-r)) at the angle a % from the top, at (x-+dx, y); its upper edge is the circle around (x, cy) through % that point and the top (x, top) \def\fancyqr@snow@shape#1#2#3#4{% \edef\fancyqr@snow@top{\fpeval{\fancyqr@snow@one+\fancyqr@snow@height}}% \edef\@tempb{\fpeval{(#2)*\fancyqr@snow@one}}% r \edef\fancyqr@snow@xl{\ifnum#3=\@ne\@tempb\else0\fi}% \edef\fancyqr@snow@xr{\ifnum#4=\@ne\fpeval{#1*\fancyqr@snow@one-\@tempb}\else#1\fi}% \edef\@tempc{\fpeval{\@tempb>0 ? min(63,acosd(max(0,1-.2/\@tempb))) : 0}}% a \edef\@tempd{\fpeval{\@tempb*sind(\@tempc)}}% dx \edef\@tempe{\fpeval{\fancyqr@snow@one-\@tempb+\@tempb*cosd(\@tempc)}}% y \edef\@tempa{\fpeval{(\fancyqr@snow@top^2-\@tempd^2-\@tempe^2)/(2*(\fancyqr@snow@top-\@tempe))}}% cy \edef\@tempf{\fpeval{atand(\@tempe-\@tempa,-\@tempd)+(\@tempe<\@tempa ? 360 : 0)}}% the end seen from (x, cy) \edef\fancyqr@snow@end{(\fpeval{\fancyqr@snow@xl-\@tempd},\@tempe)}% \edef\fancyqr@snow@lc{\noexpand\circlearc{\fancyqr@snow@xl}{\@tempa}{\fpeval{\fancyqr@snow@top-\@tempa}}{\@tempf}{90}}% \edef\fancyqr@snow@rc{\noexpand\circlearc{\fancyqr@snow@xr}{\@tempa}{\fpeval{\fancyqr@snow@top-\@tempa}}{90}{\fpeval{180-\@tempf}}% \noexpand\circlearc{\fancyqr@snow@xr}{\fpeval{\fancyqr@snow@one-\@tempb}}{\@tempb}{\fpeval{90-\@tempc}}{90}}% \edef\fancyqr@snow@ll{\noexpand\circlearc{\fancyqr@snow@xl}{\fpeval{\fancyqr@snow@one-\@tempb}}{\@tempb}{90}{\fpeval{90+\@tempc}}}% \def\fancyqr@snow@keep##1{\def\expandafter\noexpand\csname fancyqr@snow@##1\endcsname {\unexpanded\expandafter\expandafter\expandafter{\csname fancyqr@snow@##1\endcsname}}}% \global\expandafter\edef\csname fancyqr@snow@m@#1@#2@#3#4@\fancyqr@snow@height @\fancyqr@snow@one\endcsname{% \fancyqr@snow@keep{top}\fancyqr@snow@keep{xl}\fancyqr@snow@keep{xr}\fancyqr@snow@keep{end}% \fancyqr@snow@keep{lc}\fancyqr@snow@keep{rc}\fancyqr@snow@keep{ll}}}% % the upper edge: one Bezier curve between each two columns, with the heights and % slopes of the wave at its ends; #1 column, #2 row of the left end of the cap \def\fancyqr@snow@waves#1#2{% \fancyqr@snow@wave@at\fancyqr@snow@l{#1}{#2}% \edef\fancyqr@snow@tl{\fpeval{\fancyqr@snow@top+\fancyqr@snow@h}}% \let\fancyqr@snow@px\fancyqr@snow@xl \let\fancyqr@snow@ph\fancyqr@snow@h \let\fancyqr@snow@ps\fancyqr@snow@s \def\fancyqr@snow@up{}% \fancyqr@snow@c\fpeval{ceil(\fancyqr@snow@xl+.01)}\relax \@whilenum\fancyqr@snow@c<\fpeval{ceil(\fancyqr@snow@xr-.01)}\do{% \fancyqr@snow@wave@at0{\the\numexpr#1+\fancyqr@snow@c\relax}{#2}\fancyqr@snow@seg{\the\fancyqr@snow@c}% \advance\fancyqr@snow@c\@ne}% \fancyqr@snow@wave@at\fancyqr@snow@r{\the\numexpr#1+\fancyqr@snow@w\relax}{#2}\fancyqr@snow@seg\fancyqr@snow@xr}% \def\fancyqr@snow@seg#1{% \edef\@tempa{\noexpand\curveto (\fpeval{(2*\fancyqr@snow@px+#1)/3},\fpeval{\fancyqr@snow@top+\fancyqr@snow@ph+\fancyqr@snow@ps*(#1-\fancyqr@snow@px)/3})% (\fpeval{(\fancyqr@snow@px+2*#1)/3},\fpeval{\fancyqr@snow@top+\fancyqr@snow@h-\fancyqr@snow@s*(#1-\fancyqr@snow@px)/3})% (#1,\fpeval{\fancyqr@snow@top+\fancyqr@snow@h})}% \edef\fancyqr@snow@up{\unexpanded\expandafter{\fancyqr@snow@up}\unexpanded\expandafter{\@tempa}}% \edef\fancyqr@snow@px{#1}\let\fancyqr@snow@ph\fancyqr@snow@h \let\fancyqr@snow@ps\fancyqr@snow@s}% % #1 is \lineto to fill and \moveto to outline: a seam to a neighbour has no outline \def\fancyqr@snow@path#1{% \ifnum\fancyqr@snow@l=\@ne\expandafter\moveto\fancyqr@snow@end\fancyqr@snow@lc \else\moveto(0,\fancyqr@snow@one)#1(0,\fancyqr@snow@tl)\fi \fancyqr@snow@up \ifnum\fancyqr@snow@r=\@ne\fancyqr@snow@rc\else#1(\fancyqr@snow@w,\fancyqr@snow@one)\fi \lineto(\fancyqr@snow@xl,\fancyqr@snow@one)% \ifnum\fancyqr@snow@l=\@ne\fancyqr@snow@ll\else\ifx#1\lineto\closepath\fi\fi}% % a cap at column #1, row #2, in module units, so that caps meet exactly at their % seams \def\fancyqr@snow@draw#1#2{% \unitlength\qr@modulesize \fancyqr@snow@waves{#1}{#2}% \roundjoin\roundcap\linethickness{.05\unitlength}% \color{\fancyqr@snow@color}\fancyqr@snow@path\lineto\fillpath \color{\fancyqr@snow@line}\fancyqr@snow@path\moveto\strokepath}% % a row of tiles with white above gets snow as a whole: its left end (#1 row, #2 % column) decides with a hash salted per code, and picks one of five heights and % wavinesses (see \fancyqr@style@begin) \def\fancyqr@snow@run#1#2{% \fancyqr@snow@c#2\relax\fancyqr@snow@true \@whilesw\iffancyqr@snow@\fi{\fancyqr@snow@false \ifnum\fancyqr@snow@c>\@ne \ifnum\qr@matrixentry\fancyqr@currprint{#1}{\the\numexpr\fancyqr@snow@c-\@ne}=\qr@black\relax \ifnum\qr@matrixentry\fancyqr@currprint{\the\numexpr#1-\@ne}{\the\numexpr\fancyqr@snow@c-\@ne}=\qr@white\relax \advance\fancyqr@snow@c\m@ne\fancyqr@snow@true\fi\fi\fi}% \ifnum\fancyqr@snow@mod{#1*37+\fancyqr@snow@c*11+\fancyqr@snow@salt}{100}<\fancyqr@snow@percent\relax \fancyqr@snow@true \edef\fancyqr@snow@height{\csname fancyqr@snow@h\fancyqr@snow@mod{#1*13+\fancyqr@snow@c*29+\fancyqr@snow@salt}5\endcsname}% \edef\fancyqr@snow@wave{\csname fancyqr@snow@v\fancyqr@snow@mod{#1*7+\fancyqr@snow@c*17+3*\fancyqr@snow@salt}5\endcsname}% \else\fancyqr@snow@false\fi}% \def\fancyqr@snow@begin{% \edef\fancyqr@snow@percent{\iffancyqr@gallery@100\else\fpeval{round(100*\fancyqr@snow@chance)}\fi}% \edef\fancyqr@snow@ipercent{\fpeval{round(100*\fancyqr@snow@icicle@chance)}}% \edef\fancyqr@snow@salt{\fpeval{randint(0,999)}}% \edef\fancyqr@snow@scale{\fpeval{round(1+\strip@pt\fancyqr@edge@compensate/\strip@pt\qr@modulesize,3)}}% \@tempcnta\z@ \@whilenum\@tempcnta<5\do{% \expandafter\edef\csname fancyqr@snow@h\the\@tempcnta\endcsname{\fpeval{(.65+.175*\@tempcnta)*\fancyqr@snow@height}}% \expandafter\edef\csname fancyqr@snow@v\the\@tempcnta\endcsname{\fpeval{(.5+.25*\@tempcnta)*\fancyqr@snow@wave}}% \advance\@tempcnta\@ne}}% \let\fancyqr@style@begin\fancyqr@snow@begin % the snow is drawn in a second pass, on top of the tiles; a lone tile gets less; % an end at a dark neighbour ends flush, as the snow runs on or meets a wall; % nothing lies above the top row (but in the gallery of tiles) or hangs below the bottom one \def\fancyqr@snow@tile#1#2#3#4{% \ifnum\fancyqr@pass=\@ne\fancyqr@rounded@rect#1#2#3#4% \else\fancyqr@snow@cap\fi}% % now and then a pale snowflake in a free white module between the tiles (white % above it, so no icicle hangs into it), by the place \def\fancyqr@snow@nm{snow}% \def\fancyqr@snow@fall{\ifx\fancyqr@loaded@style\fancyqr@snow@nm{\unitlength\qr@modulesize \fancyqr@mixcolor{\fancyqr@snow@line!55!white}\linethickness{.04\unitlength}\roundcap \@tempcnta\@ne\@whilenum\@tempcnta<\@max@y\do{\advance\@tempcnta\@ne\@tempcntb\z@ \@whilenum\@tempcntb<\@max@x\do{\advance\@tempcntb\@ne \edef\fancyqr@snow@ih{\fancyqr@snow@mod{\@tempcnta*29+\@tempcntb*47+5*\fancyqr@snow@salt}{97}}% \ifnum\fancyqr@snow@ih<\iffancyqr@faint@30\else9\fi\relax \ifnum\qr@matrixentry\fancyqr@currprint{\the\@tempcnta}{\the\@tempcntb}=\qr@white\relax \ifnum\qr@matrixentry\fancyqr@currprint{\the\numexpr\@tempcnta-1}{\the\@tempcntb}=\qr@white\relax \ifcsname fancyqr@B@\the\@tempcnta @\the\@tempcntb\endcsname\else \ifnum\ifnum\@tempcnta<10 \ifnum\@tempcntb<10 1\else\ifnum\@tempcntb>\numexpr\@max@x-9\relax1\else0\fi\fi \else\ifnum\@tempcnta>\numexpr\@max@y-9\relax\ifnum\@tempcntb<10 1\else0\fi\else0\fi\fi=\z@ \put(\the\@tempcntb,\the\numexpr\@max@y-\@tempcnta\relax){\fancyqr@snow@flake}\fi\fi\fi\fi\fi}}}\fi}% \def\fancyqr@snow@flake{\edef\h@r{\fpeval{15*\fancyqr@snow@ih}}% \@for\@tempa:=0,60,120\do{\edef\@tempb{\fpeval{\@tempa+\h@r}}% \moveto(\fpeval{.5-.22*cosd(\@tempb)},\fpeval{.5-.22*sind(\@tempb)})\lineto(\fpeval{.5+.22*cosd(\@tempb)},\fpeval{.5+.22*sind(\@tempb)})}% \@for\@tempa:=0,60,120,180,240,300\do{\edef\@tempb{\fpeval{\@tempa+\h@r}}% \moveto(\fpeval{.5+.14*cosd(\@tempb)+.07*cosd(\@tempb+50)},\fpeval{.5+.14*sind(\@tempb)+.07*sind(\@tempb+50)})% \lineto(\fpeval{.5+.14*cosd(\@tempb)},\fpeval{.5+.14*sind(\@tempb)})% \lineto(\fpeval{.5+.14*cosd(\@tempb)+.07*cosd(\@tempb-50)},\fpeval{.5+.14*sind(\@tempb)+.07*sind(\@tempb-50)})}% \strokepath}% \FancyQrExtras{flakes}% % a host style may define \fancyqr@snow@host@