Quickies

[categories] [index] [all (564)] [latest]

PostScript
  1. %!PS-Adobe-3.0
    
    % gs -dBATCH -dNOPAUSE -sDEVICE=png16m -sOutputFile="x.png" linear.ps && open x.png
    
    << /PageSize [500 300] >> setpagedevice
    
    50 50 translate
    
    newpath
        0     0 moveto
        0   200 lineto
        300 200 lineto
        300   0 lineto
        0     0 lineto
    closepath
    
    gsave
    clip
    
    % shading dict
    <<
      /ShadingType 2 % 2-axial, 3-radial
    
      /ColorSpace /DeviceRGB
    
      /Coords [ 0 0 300 300 ] % [x0 y0 x1 y1]
    
      /Function <<
        /FunctionType 2 % 2-exponential interpolation
        /Domain [ 0.0 1.0 ]
        /C0 [ 1 0 0 ] % start color
        /C1 [ 0 0 1 ] % end color
        /N 1 % exponent, 1 = linear interpolation
      >>
    >>
    
    shfill
    
    grestore
    
    showpage