Search⌘ K
AI Features

RadialGradient

Explore how to create radial gradients in Pycairo by defining two circles with different centers and radii to achieve smooth circular color transitions. Understand gradient stops, radius interpolation, and extend modes to design complex color effects for vector graphics.

Radial gradients

A RadialGradient is circular in appearance. It is created like this:

pattern=RadialGradient(cx0, cy0, r0, cx1, cy1, r1)

The radial gradient is defined by two circles:

  • Circle0, with centre (cx0, cy0) and radius r0
  • Circle1, with centre (cx1, cy1) and radius r1

Similar to linear gradients, these coordinates and lengths are defined in userspace, using whatever transforms are in place at the time that the RadialGradient is called.

In most cases, Circle0 is contained within Circle1, because this creates the most useful effects but, in fact, the two circles can be located ...