[pstricks] Create an own Gouraud figure

Marco Daniel marcodaniel1807 at googlemail.com
Mon Jun 22 08:09:44 CEST 2009


Hello,

I try to create a "psGFrame" which based on the psGTriangle. I modified 
the code with no result.  Unfortunately I am not able to implement the 
pstricks source code. I hope you can help me

Here the "minimal example":

%=================%
\documentclass{article}
\makeatletter
%PSTRICKS-CODE
% /GTriangle {
%   gsave
%   /mtrx CM def
%   /colorA ED /colorB ED /colorC ED     % save the colors
%   /yA ED /xA ED                       % save the origin
%   xA yA translate
%   rotate                           % \psk at gangle
%   /yB ED /xB ED /yC ED /xC ED       % save other coordinates
%   /ds [                % save data in a array
%      0 0 0 colorA aload pop         % fd x y xr xg xb
%      0 xB xA sub yB yA sub colorB aload pop
%      0 xC xA sub yC yA sub colorC aload pop
% %     1 xC xB add yB colorA aload pop      % for use with 4 points ABCD
%   ] def
%   newpath
%   <<
%   /ShadingType 4           % single Gouraud
%   /ColorSpace [ /DeviceRGB ]
%   /DataSource ds
%   >>
%   shfill
%   closepath
%   mtrx
%   setmatrix grestore} def


\def\psGFrame{\pst at object{psGFrame}}
\def\psGFramee at i(#1)(#2)#3#4{{%
  \def\solid at star{}%
  \begin at ClosedObj
  \pst at getcoor{#1}\pst at tempA    %   A: "rgb xr xg xb" or "gray xg"
  \pst at getcoor{#2}\pst at tempB    %   B
  \pst at getcolor{#3}\pst at colorA
  \pst at getcolor{#4}\pst at colorB
  \addto at pscode{%
    \pst at tempB            % B
    \psk at gangle             %   rotating angle
    \pst at tempA             % A, temporary origin
    /rgb {} def
    /gray {} def
    [ \pst at colorB ] aload length 1 eq { dup dup } if 3 array astore
    [ \pst at colorA ] aload length 1 eq { dup dup } if 3 array astore
    tx at addDict begin GTriangle end % PS part
  }%
  \if at star\psframe[fillstyle=none](#1)(#2)\fi%    draw borderline
  \def\pst at linetype{2}%
  \end at ClosedObj%
}\ignorespaces}
\makeatother
\usepackage{pst-slpe}
\usepackage{pstricks-add}
\begin{document}
\begin{pspicture}(0,0)(5,10)
  \psGFrame(0,0)(5,10){orange!10}{orange!60}
\end{pspicture}

\end{document}
%================%

Thanks
Marco


More information about the PSTricks mailing list