A halo is an outline of constant width that is drawn around a shape or label. It is typically drawn in a color that contrasts with that of the haloed object itself, to make the object clearly visible on all backgrounds.
The following painters have built-in support for halos:
All halo-enabled painters share a common set of methods to configure the halo effect:
setHaloEnabledspecifies whether or not to draw halos.
setHaloThicknesssets the thickness (in pixels) of the halo. Note that higher values result in reduced performance. A value of 1 or 2 pixels is recommended.
setHaloColorsets the color of the halo. Choose this such that it contrasts well with the color of the shape or label to which the halo is added.
setUseImageCachespecifies whether or not the painter should cache image representations of the haloed objects. Enabling this can compensate for the performance overhead associated with enabling halos. When caching is off, the painter must redraw the halo for every repaint. When caching is enabled, the painter can paint the object and its halo once and draw the cached image on the view for subsequent repaints.
clearImageCacheremoves objects from the image cache. There may be situations in which an object or its label changes, without the painter knowing about it. In that case, any image that the painter may have already cached for this object becomes invalid and should thus be recreated. By calling
clearImageCache, applications can force this behavior whenever necessary. Two versions of
clearImageCacheexist: one with an
Objectparameter, which removes only the image cached for that particular object, and one without parameters, which removes all currently cached images.