pst-blur package version 1.0

Martin Giese^{∗}

98/09/15

1 Introduction

The ability to paint shadows on arbitrary shapes is a standard feature of PSTricks. However, these shadows are always ‘hard’:

A

The pst-blur package provides blurred shadows for closed shapes drawn with PSTricks:

A

It also provides a new box command \psblurbox, which is similar to \psshadowbox, but gives the box a blurred shadow.

The new graphics parameters and macros provided by the package are described in section 2 of this document. Section 3, if present, documents the implementation consisting of a generic TEX file and a PostScript header for the dvi-to-PostScript converter. You can get section 3 by calling L^{A}TEX as follows on most relevant systems:

latex '\AtBeginDocument{\AlsoImplementation}\input{pst-blur.dtx}'

2 Package Usage

To use pst-blur, you have to say

   \usepackage{pst-blur}

∗email:giese@ira.uka.de

Figure 1: Parameters for blurred shadows

   shadowsize blurradius  −shadowangle shadowcolorblurbg

in the document prologue for L^{A}TEX, and

   \input pst-blur.tex

in “plain” TEX. blur To paint shapes with blurred shadows, set the graphics parameters shadow and

blur to true, eg
    \psset{unit=1cm}
    \pscircle[shadow=true,blur=true](0,0){0.5}

for a circle with a blurred shadow. The parameter blur has no influence if shadow

is false.

shadowsize The rendering of blurred shadows is controlled by a number of additional

shadowangle
blurradius

graphics parameters. The offset of the shadow is controlled by the parameters shadowsize and shadowangle, which are the same as for ordinary shadows.^{1} The size of the blurring effect is controlled by the parameter blurradius, see Fig 1. The default value for blurradius is 1.5pt, which fits nicely with the default shadowsize of 3pt.

shadowcolor The inner, usually darkest part of the shadow is painted in the colour defined

blurbg by shadowcolor. In the range defined by blurradius, the colour gradually fades to the background colour set by blurbg. The default value for blurbg is white. You should change this parameter when you want to paint shapes over a coloured background, ie

   \psframe[fillstyle=solid,fillcolor=yellow](-.7,-.7)(.7,.7)
   \pscircle[shadow=true,blur=true,blurbg=yellow](0,0){0.4}

1In particular, shadowangle has to be negative for the usual placement of shadows below and to the right of shapes.

blursteps The number of distinct colour steps painted between shadowcolor and blurbg is controlled by the parameter blursteps. The default value for blursteps is 20, which is usually more than sufficient. Note, that higher values for blursteps result in proportionally slower rendering. This can be very tiresome with complex shapes.

\psblurbox Using a \psframebox with a blurred shadow in the middle of some text produces poor results, because TEX does not know about the extra space taken by the shadow. For normal shadows, this problem is solved by the \psshadowbox macro, which adds the extra space around the box for the shadow. For blurred shadows, this is not sufficient: an extra \blurradius has to be added. This is done by the macro \psblurbox , which is otherwise identical to \psshadowbox. Note,

that \psblurbox shares a deficiency of \psshadowbox: It only works correctly with shadowangle = −45, because TEX does not provide trigonometric operations.