% This is a part of bclogo.sty v3.0
%% This file is loaded by bclogo when tikz is used
%% It is a modification of md-frame-1.mdf file, from mdframed package
%% This file may be distributed under the terms of the LaTeX Project
%% Public License, as described in lppl.txt in the base LaTeX distribution.
%% Either version 1.0 or, at your option, any later version.
%
\def\bc@tikzBlur{%ombre avec un semblant d'effet blur...
[preaction={fill=\bcval@couleurOmbre,line width=5,line join=round,opacity=0.1,draw=\bcval@couleurOmbre,%
        transform canvas={xshift=0.5*\bcval@epOmbre cm, yshift=-0.5*\bcval@epOmbre cm}},%
preaction={fill=\bcval@couleurOmbre,line width=4,line join=round,opacity=0.15,draw=\bcval@couleurOmbre,%
        transform canvas={xshift=0.5*\bcval@epOmbre cm, yshift=-0.5*\bcval@epOmbre cm}},%
preaction={fill=\bcval@couleurOmbre,line width=3,line join=round,opacity=0.2,draw=\bcval@couleurOmbre,%
        transform canvas={xshift=0.5*\bcval@epOmbre cm, yshift=-0.5*\bcval@epOmbre cm}},%
preaction={fill=\bcval@couleurOmbre,line width=2,line join=round,opacity=0.3,draw=\bcval@couleurOmbre,%
        transform canvas={xshift=0.5*\bcval@epOmbre cm, yshift=-0.5*\bcval@epOmbre cm}},%
preaction={fill=\bcval@couleurOmbre,line width=1,line join=round,opacity=0.4,draw=\bcval@couleurOmbre,%
        transform canvas={xshift=0.5*\bcval@epOmbre cm, yshift=-0.5*\bcval@epOmbre cm}},%
preaction={fill=\bcval@couleurOmbre,line width=0.5,line join=round,opacity=0.4,draw=\bcval@couleurOmbre,%
        transform canvas={xshift=0.5*\bcval@epOmbre cm, yshift=-0.5*\bcval@epOmbre cm}}]%
}%
\def\bc@tikzOmbre{%ombre sans blur
[preaction={opacity=0.6,fill=\bcval@couleurOmbre,transform canvas={xshift=\bcval@epOmbre cm,yshift=-\bcval@epOmbre cm}}]%
}%
%
\def\md@tikz@settings{%
           \ifdimequal{\mdf@middlelinewidth@length}{\z@}%
                       {\ifdimequal{\mdf@innerlinewidth@length}{\z@}%
                            {\ifdimequal{\mdf@outerlinewidth@length}{\z@}%
                              {\let\mdf@middlelinecolor\mdf@backgroundcolor}%
                              {\let\mdf@middlelinecolor\mdf@outerlinecolor}%
                            }%
                            {\let\mdf@middlelinecolor\mdf@innerlinecolor}%
                        }{}%
          \ifdimequal{\mdf@innerlinewidth@length}{\z@}%
                       {\ifdimequal{\mdf@outerlinewidth@length}{\z@}%
                            {\ifdimequal{\mdf@middlelinewidth@length}{\z@}%
                              {}%
                              {\let\mdf@middlelinecolor\mdf@linecolor}%
                            }%
                            {}%
                        }{}%
        \tikzset{mdftext/.style={inner sep=0pt,outer sep=0pt}}%
        \tikzset{mdfcorners/.style={rounded corners=\mdf@roundcorner@length}}%
        \tikzset{mdfbackground/.style={fill=\mdf@backgroundcolor}}%
        \ifdimgreater{\mdf@outerlinewidth@length}{\z@}%
            {\tikzset{mdfborderA/.style={%
                         draw=\mdf@outerlinecolor,%
                         line width=2\mdf@outerlinewidth@length+\mdf@middlelinewidth@length%
                         }%
                     }%
            }%
            {\tikzset{mdfborderA/.style={}}}%
        \ifdimgreater{\mdf@innerlinewidth@length}{\z@}%
            {\tikzset{mdfborderI/.style={%
                         draw=\mdf@innerlinecolor,%
                         line width=2\mdf@innerlinewidth@length+\mdf@middlelinewidth@length%
                         }%
                     }%
            }%
            {\tikzset{mdfborderI/.style={}}}%
       \tikzset{mdfmiddle/.style={draw=\mdf@middlelinecolor,line width=\mdf@middlelinewidth@length}}%
}%
\def\md@putbox@single{%boite qui tient sur la page
   \leftline{\null\hspace*{\mdf@leftmargin@length}%%
       \md@tikz@settings%
        \setlength\bc@mdfboxwidth{\wd\@tempboxa}%
        \setlength\bc@mdfboxheight{\ht\@tempboxa+\dp\@tempboxa}%
        \setlength{\bc@invboxh}{\bc@mdfboxheight}%
        \begin{tikzpicture}%
	         \coordinate(O)at(0,0);%
                 \pgfmathsetlengthmacro\x{\bc@mdfboxwidth+\mdf@innerrightmargin@length%
                                          +\mdf@innerleftmargin@length+%
                                          2\mdf@innerlinewidth@length+\mdf@middlelinewidth@length}%
                 \pgfmathsetlengthmacro\xp{\mdf@innerleftmargin@length+%
                                          1*\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}%
                 \pgfmathsetlengthmacro\y{\bc@mdfboxheight+\mdf@innertopmargin@length%
                                          +\mdf@innerbottommargin@length%
                                          +2*\mdf@innerlinewidth@length+\mdf@middlelinewidth@length}%
                 \pgfmathsetlengthmacro\yp{\mdf@innerbottommargin@length%
                                          +1*\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}%
                 \pgfmathsetlengthmacro\dep{\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}%
                 \coordinate(P)at(\x,\y);%
                 \begin{scope}%
                   \ifKV@bclogo@ombre%
                      \ifKV@bclogo@blur%
                         \path[mdfcorners]\bc@tikzBlur(-\dep,-\dep)--(\x+\dep,-\dep)--(\x+\dep,\y+\dep)--(-\dep,\y+\dep)--cycle;%
                      \else%
                         \path[mdfcorners]\bc@tikzOmbre(-\dep,-\dep)--(\x+\dep,-\dep)--(\x+\dep,\y+\dep)--(-\dep,\y+\dep)--cycle;%
                      \fi%
                   \fi%
                   \clip[preaction=mdfborderA]%
                        [postaction={mdfbackground,mdfborderI}]%
                        [mdfcorners](O)--(O|-P)--(P)--(P|-O)--cycle;%
	         \end{scope}%
                 \path[mdfmiddle,mdfcorners,draw=\ifKV@bclogo@noborder none\else\bcval@couleurBord\fi](O)--(O|-P)--(P)--(P|-O)--cycle;
                 \node[mdftext,anchor=north west]at%
                  (\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length+0.5*\bcval@framesep,%
                   \y-0.75*\bcval@framesep-\mdf@innerlinewidth@length-0.5*\mdf@middlelinewidth@length){\box\bc@envbox};
                 \node[mdftext,anchor=south west]at(\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length+0.5*\bcval@framesep,\yp){\bc@barre};
                 \node[mdftext,anchor=south west]at(\xp,\yp){\box\@tempboxa};
                 %\draw[fill] (0,0) circle (.1cm);
                 %\draw[fill,yellow] (\x,\y) circle (.1cm);
                 %\draw[fill,orange] (\xp,\yp) circle (.05cm);
       \end{tikzpicture}%
     }%
}%
%
\def\md@putbox@first{%tête d'une boite coupée
   \leftline{\null\hspace*{\mdf@leftmargin@length}%%
       \md@tikz@settings%
        \setlength\bc@mdfboxwidth{\wd\tw@}%
        \setlength\bc@mdfboxheight{\ht\tw@+\dp\tw@}%
        \setlength{\bc@invboxh}{\bc@mdfboxheight}%
        \ifdimequal{\pagegoal}{\maxdimen}{\enlargethispage{\baselineskip}}{}%
        \begin{tikzpicture}%
	         \coordinate(O) at (0,0);%
                 \pgfmathsetlengthmacro\x{\bc@mdfboxwidth+\mdf@innerrightmargin@length%
                                          +\mdf@innerleftmargin@length+%
                                          2*\mdf@innerlinewidth@length+1*\mdf@middlelinewidth@length}
                 \pgfmathsetlengthmacro\xp{\mdf@innerleftmargin@length+%
                                          1*\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}
                 \pgfmathsetlengthmacro\y{-\bc@mdfboxheight-\mdf@innertopmargin@length%
                                          -1*\mdf@innerlinewidth@length-0.5*\mdf@middlelinewidth@length+0.0cm}
                 \pgfmathsetlengthmacro\yp{-\mdf@innertopmargin@length%
                                           -1*\mdf@innerlinewidth@length-0.5*\mdf@middlelinewidth@length%
                                           -0.5\bc@mdfboxheight}
                 \pgfmathsetlengthmacro\dep{\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}%
                 \coordinate(P)at(\x,\y);%
                 \clip(-\mdf@outerlinewidth@length-0.5*\mdf@middlelinewidth@length,%
                       \mdf@outerlinewidth@length+0.5*\mdf@middlelinewidth@length)%
                      rectangle(\x+\mdf@outerlinewidth@length+0.5*\mdf@middlelinewidth@length+\ifKV@bclogo@ombre\bcval@epOmbre cm\else0\fi,%
                                \y-\ifKV@bclogo@ombre\bcval@epOmbre cm\else0\fi);
                 \begin{scope}%
                        \ifKV@bclogo@ombre%
                        \ifKV@bclogo@blur%
                        \path[mdfcorners]\bc@tikzBlur(-\dep,\y)--(-\dep,\dep)--(\x+\dep,\dep)--(\x+\dep,\y);%
                        \else%
                        \path[mdfcorners]\bc@tikzOmbre(-\dep,\y)--(-\dep,\dep)--(\x+\dep,\dep)--(\x+\dep,\y);%
                        \fi\fi%
                        \clip[preaction=mdfborderA]%
                          [postaction={mdfbackground,mdfborderI}]%
                          [mdfcorners](O|-P)--(O)--(P|-O)--(P);%
                 \end{scope}%
                 \path[mdfmiddle,mdfcorners,mdfbackground,draw=\ifKV@bclogo@noborder none\else \bcval@couleurBord\fi](O|-P)--(O)--(P|-O)--(P);
                 \node[mdftext,anchor=north west]at(\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length+0.5*\bcval@framesep,%
                        -0.75*\bcval@framesep-\mdf@innerlinewidth@length-0.5*\mdf@middlelinewidth@length){\box\bc@envbox};%
                 \node[mdftext,anchor=south west]at(\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length+0.5*\bcval@framesep,\y){\bc@barre};%
                 \node[mdftext,anchor=west,inner sep=0pt,outer sep=0pt]at(\xp,\yp){\box\tw@};%
                 %\draw[fill] (0,0) circle (.1cm);
                 %\draw[fill,yellow] (\x,\y) circle (.1cm);
                 %\draw[fill,orange] (\xp,\yp) circle (.05cm);
     \end{tikzpicture}%
     }%
}%
%
\def\md@putbox@middle{%milieu d'une boite coupée (occupe une page entière)
   \leftline{\null\hspace*{\mdf@leftmargin@length}%%
        \md@tikz@settings%
        \setlength\bc@mdfboxwidth{\wd\tw@}%
        \setlength\bc@mdfboxheight{\ht\tw@+\dp\tw@}%
        \setlength{\bc@invboxh}{\bc@mdfboxheight}%
        %\setlength{\bc@mdf@ymargin@length}{0.4\baselineskip}%
        \begin{tikzpicture}%
	         \coordinate(O)at(0,0);%
                 \pgfmathsetlengthmacro\x{\bc@mdfboxwidth+\mdf@innerrightmargin@length%
                                          +\mdf@innerleftmargin@length+%
                                          2*\mdf@innerlinewidth@length+1*\mdf@middlelinewidth@length}%
                 \pgfmathsetlengthmacro\xp{\mdf@innerleftmargin@length+%
                                          1*\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}%
                 \pgfmathsetlengthmacro\y{\bc@mdfboxheight}%
                 \pgfmathsetlengthmacro\yp{0cm}%
                 \pgfmathsetlengthmacro\dep{\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}%
                 \coordinate(P)at(\x,\y);%
                 \clip(-\mdf@outerlinewidth@length-0.5*\mdf@middlelinewidth@length,-\ifKV@bclogo@ombre\bcval@epOmbre cm\else0\fi)%
                       rectangle(\x+\mdf@outerlinewidth@length+0.5*\mdf@middlelinewidth@length+\ifKV@bclogo@ombre\bcval@epOmbre cm\else0\fi,\y);
                 \begin{scope}%
                 	\path[mdfborderA](O)--(O|-P)(P)--(P|-O);%
                        \ifKV@bclogo@ombre%
                        \ifKV@bclogo@blur%
                        \path\bc@tikzBlur(-\dep,0)--(\x+\dep,0)--(\x+\dep,\y)--(0,\y)--cycle;%
                        \else%
                        \path\bc@tikzOmbre(-\dep,0)--(\x+\dep,0)--(\x+\dep,\y)--(0,\y)--cycle;%
                        \fi\fi%
                        \clip%
                             [postaction=mdfbackground](O)--(O|-P)--(P)--(P|-O);%
                        \path[mdfborderI](O)--(O|-P)(P)--(P|-O);%
                 \end{scope}%
                 \path[mdfmiddle,draw=\ifKV@bclogo@noborder none\else \bcval@couleurBord\fi](O)--(O|-P)(P)--(P|-O);%
                 \node[mdftext,anchor=south west]at(\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length+0.5*\bcval@framesep,0){\bc@barre};%
                 \node[mdftext,anchor=south west]at(\xp,\yp){\box\tw@};%
       \end{tikzpicture}%
     }%
}%
%
\def\md@putbox@second{%dernière partie d'une boite coupée
   \leftline{\null\hspace*{\mdf@leftmargin@length}%%
       \md@tikz@settings%
        \setlength\bc@mdfboxwidth{\wd\@tempboxa}%
        \setlength\bc@mdfboxheight{\ht\@tempboxa+\dp\@tempboxa}%
        \setlength{\bc@invboxh}{\bc@mdfboxheight}%
        \begin{tikzpicture}%
                 \coordinate(O)at(0,0);%
                 \pgfmathsetlengthmacro\x{\bc@mdfboxwidth+\mdf@innerrightmargin@length%
                                          +\mdf@innerleftmargin@length+%
                                          2*\mdf@innerlinewidth@length+1*\mdf@middlelinewidth@length}%
                 \pgfmathsetlengthmacro\xp{\mdf@innerleftmargin@length+%
                                          1*\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}%
                 \pgfmathsetlengthmacro\y{\bc@mdfboxheight%
                                          +\mdf@innerbottommargin@length%
                                          +1*\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}
                 \pgfmathsetlengthmacro\yp{\mdf@innerbottommargin@length%
                                          +1*\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}%
                 \pgfmathsetlengthmacro\dep{\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length}%
                 \coordinate(P)at(\x,\y);%
                 \clip(-\mdf@outerlinewidth@length-0.5*\mdf@middlelinewidth@length,%
                       -\mdf@outerlinewidth@length-0.5*\mdf@middlelinewidth@length-\ifKV@bclogo@ombre\bcval@epOmbre cm\else0\fi)%
                      rectangle(\x+\mdf@outerlinewidth@length+0.5*\mdf@middlelinewidth@length+\ifKV@bclogo@ombre\bcval@epOmbre cm\else0\fi,\y);
                 \begin{scope}%
                        \ifKV@bclogo@ombre%
                        \ifKV@bclogo@blur%
                        \path[mdfcorners]\bc@tikzBlur(-\dep,\y)--(-\dep,-\dep)--(\x+\dep,-\dep)--(\x+\dep,\y);%
                        \else%
                        \path[mdfcorners]\bc@tikzOmbre(-\dep,\y)--(-\dep,-\dep)--(\x+\dep,-\dep)--(\x+\dep,\y);%
                        \fi\fi%
                      \clip[preaction=mdfborderA]%
                      [postaction={mdfbackground,mdfborderI}]%
                      [mdfcorners](P-|O)--(O)--(O-|P)--(P);%
                 \end{scope}%
                 \path[mdfmiddle,mdfcorners,draw=\ifKV@bclogo@noborder none\else \bcval@couleurBord\fi](P-|O)--(O)--(O-|P)--(P);%
                 \node[mdftext,anchor=south west]at(\mdf@innerlinewidth@length+0.5*\mdf@middlelinewidth@length+0.5*\bcval@framesep,\yp){\bc@barre};%
                 \node[mdftext,anchor=south west] at (\xp,\yp){\box\@tempboxa};%
       \end{tikzpicture}%
     }%
}%
