Contents

setShadow(offset:blur:)

Enables shadowing in a graphics context.

Declaration

func setShadow(offset: CGSize, blur: CGFloat)

Parameters

  • offset:

    Specifies a translation of the context’s coordinate system, to establish an offset for the shadow ({0,0} specifies a light source immediately above the screen).

  • blur:

    A non-negative number specifying the amount of blur.

Discussion

Shadow parameters are part of the graphics state in a context. After shadowing is set, all objects drawn are shadowed using a black color with 1/3 alpha (in effect, RGBA = {0, 0, 0, 1.0/3.0}) in the DeviceRGB color space.

To turn off shadowing:

  • Use the standard save/restore mechanism for the graphics state.

  • Use setShadow(offset:blur:color:) to set the shadow color to a fully transparent color (or pass NULL as the color).

See Also

Setting Fill, Stroke, and Shadow Colors