In actual practice, there is hardly any point in using a custom painter just to paint a background color, because the
setBgColor method of
Style will usually do the job. Themes too can be used for setting background colors. However, painters are very useful when intricate background patterns need to be drawn, and especially if multiple layers are involved.
PainterChain, described in the next section, is a class designed for handling such requirements.
It is possible to use more than one painter to render different layers of a background. Such a set of painters can be chained together through the
PainterChain class. The only constructor of this class has the form