LaTeXML

 view release on metacpan or  search on metacpan

t/tikz/unit_tests_by_silviu.tex  view on Meta::CPAN

  \pgfsetfading{fading1}{\pgftransformshift{\pgfpoint{1cm}{1cm}}}
  \fill [red] (0,0) rectangle (2,2);
\end{tikzpicture}
\pgfdeclareradialshading{myshading}{\pgfpointorigin}{
  color(0mm)=(pgftransparent!0);
  color(5mm)=(pgftransparent!0);
  color(8mm)=(pgftransparent!100);
  color(15mm)=(pgftransparent!100)
}
\pgfdeclarefading{fading3}{\pgfuseshading{myshading}}
\begin{tikzpicture}
  \fill [black!20] (0,0) rectangle (2,2);
  \fill [black!30] (0,0) arc (180:0:1);
  \pgfsetfading{fading3}{\pgftransformshift{\pgfpoint{1cm}{1cm}}}
  \fill [red] (0,0) rectangle (2,2);
\end{tikzpicture}
% pgfsetfading
\pgfdeclarefading{fading2}{\tikz \shade[left color=pgftransparent!0,
  right color=pgftransparent!100] (0,0) rectangle (2,2);}
\begin{tikzpicture}
  \fill [black!20] (0,0) rectangle (2,2);
  \fill [black!30] (0,0) arc (180:0:1);
  \pgfsetfading{fading2}{}
  \fill [red] (0,0) rectangle (2,2);
\end{tikzpicture}
\begin{tikzpicture}
  \fill [black!20] (0,0) rectangle (2,2);
  \fill [black!30] (0,0) arc (180:0:1);
  \pgfsetfading{fading2}{\pgftransformshift{\pgfpoint{1cm}{1cm}}
  \pgftransformrotate{20}}
  \fill [red] (0,0) rectangle (2,2);
\end{tikzpicture}
% pgfsetfadingforcurrentpath
\pgfdeclarehorizontalshading{shading}{100bp}{
  color(0pt)=(transparent!0); color(25bp)=(transparent!0);
  color(75bp)=(transparent!100); color(100bp)=(transparent!100)}
\pgfdeclarefading{fading}{\pgfuseshading{shading}}
\begin{tikzpicture}
  \fill [black!20] (0,0) rectangle (2,2);
  \fill [black!30] (0,0) arc (180:0:1);
  \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{2cm}{1cm}}
  \pgfsetfadingforcurrentpath{fading}{}
  \pgfusepath{discard}
  \fill [red] (0,0) rectangle (2,1);
  \pgfpathrectangle{\pgfpoint{0cm}{1cm}}{\pgfpoint{2cm}{1cm}}
  \pgfsetfadingforcurrentpath{fading}{\pgftransformrotate{90}}
  \pgfusepath{discard}
  \fill [red] (0,1) rectangle (2,2);
\end{tikzpicture}
\endgroup % ----------- end -----------------


% TODO: transparency group
\begingroup % ------ pseudo document ---------
%
% Transparency groups
%
\begin{tikzpicture}
  \draw [help lines] (0,0) grid (2,2);
  % Stuff outside the picture, but still in a transparency group.
  \node [left,overlay] at (0,1) {
  \begin{tikzpicture}
    \pgfsetfillopacity{0.5}
    \pgftransparencygroup
    \node at (2,0) [forbidden sign,line width=2ex,draw=red,fill=white]{Smoking};
    \endpgftransparencygroup
  \end{tikzpicture}
};
\end{tikzpicture}
\endgroup % ----------- end -----------------

\begingroup % ------ pseudo document ---------
%
% Specifying a Uniform Opacity
%
% pgfsetstrokeopacity
\begin{pgfpicture}
  \pgfsetlinewidth{5mm}
  \color{red}
  \pgfpathcircle{\pgfpoint{0cm}{0cm}}{10mm} \pgfusepath{stroke}
  \color{black}
  \pgfsetstrokeopacity{0.5}
  \pgfpathcircle{\pgfpoint{1cm}{0cm}}{10mm} \pgfusepath{stroke}
\end{pgfpicture}
% pgfsetfillopacity
\begin{tikzpicture}
  \pgfsetfillopacity{0.5}
  \fill[red] (90:1cm) circle (11mm);
  \fill[green] (210:1cm) circle (11mm);
  \fill[blue] (-30:1cm) circle (11mm);
\end{tikzpicture}
% If you setup a certain opacity for stroking or flling and you
% stroke or fll the same area twice, the effect accumulates (should)
\begin{tikzpicture}
  \pgfsetfillopacity{0.5}
  \fill[red] (0,0) circle (1);
  \fill[red] (1,0) circle (1);
\end{tikzpicture}
\endgroup % ----------- end -----------------
%======================================================================
\section{Quick Commands}

% TODO: looks good: different pictures and they are trimmed; not to get confused by baseline (NOT SAME PICTURE).
\begingroup % ------ pseudo document ---------
\begin{tikzpicture}
  \draw[help lines] (0,0) grid (3,2);
  \pgftransformxshift{1cm}
  \pgfpathqmoveto{0pt}{0pt} % not transformed
  \pgfpathqlineto{1cm}{1cm} % not transformed
  \pgfpathlineto{\pgfpoint{2cm}{0cm}}
  \pgfusepath{stroke}
\end{tikzpicture}
\begin{tikzpicture}
  \draw[help lines] (0,0) grid (3,2);
  \pgfpathqmoveto{0pt}{0pt}
  \pgfpathqcurveto{1cm}{1cm}{2cm}{1cm}{3cm}{0cm}
  \pgfusepath{stroke}
\end{tikzpicture}
\begin{tikzpicture}
  \draw[help lines] (0,0) grid (1,1);
  \pgfpathqcircle{10pt}



( run in 1.000 second using v1.01-cache-2.11-cpan-5b529ec07f3 )