Scroll to navigation

Damage(3U) InterViews Reference Manual Damage(3U)

NAME

Damage - repairs damaged graphics

SYNOPSIS

#include <Unidraw/Graphic/damage.h>

DESCRIPTION

Damage objects store damaged areas of a graphic for subsequent incremental repair. Areas of a graphic are "damaged" if they need to be redrawn for any reason, e.g., if their state has been modified or if under/overlapping graphics change their appearance. Damage objects try to minimize the amount of redrawing needed to repair a graphic. They are most useful when the graphic is complicated enough that it would be undesirable to redraw the entire canvas when the graphic is modified. Damage objects do not eliminate the need for an interactor's Redraw member function, though they could be used to implement it.

PUBLIC OPERATIONS

Create a new Damage object for a graphic on the given canvas. The painter is used to erase damaged areas using its ClearRect function prior to redrawing them.
)

Notify the damage object that a rectangular area has been damaged, either by passing the graphic that contributed the area or the area itself.
Notify the damage object that the given graphic was appended (not inserted) to the graphic but never drawn. The damage object can thus be responsible for drawing newly added graphics as well.
Repair all damage incurred since the last Repair (or since the damage object was created if this is the first Repair).
Reset the damage object. Any damage incurred is lost.
Returns true if any damage has been incurred.
Set and get attributes of the damage object.

PROTECTED OPERATIONS

A helper function that returns the area in square pixels occupied by the given BoxObj.
Explicitly draw the areas of incurred and added damage, respectively.
Merge the given BoxObj into the list of incur-damaged areas, coalescing it into an existing area if the number of non-overlapping areas exceeds 2.
Operations for iterating over the lists of damaged areas (represented with BoxObj objects) and added Graphics. FirstArea and FirstAddition initialize the iterator to point to the first item on the corresponding list, Next advances the iterator, and Done returns true if the iterator points beyond the end of the list. GetArea and GetAddition return the BoxObj or Graphic to which the iterator points.
A helper function for returning the UList to which an iterator points. The _areas protected member is a UList that stores the list of damaged areas, and the _additions protected stores the list of added graphics.
DeleteArea is a helper function for deleting the storage associated with a damaged area, including the area itself and the UList element. DeleteAreas is a helper function that deletes the list of damaged areas.

SEE ALSO

Canvas(3I), Graphic(3U), Iterator(3U), Painter(3I), UList(3U), geomobjs(3U)

30 January 1991 Unidraw