logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Damage - repairs damaged graphics

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.

Name

       Damage - repairs damaged graphics

Protected Operations

intArea(BoxObj&)
              A helper function that returns the area in square pixels occupied by the given BoxObj.

       virtualvoidDrawAreas()virtualvoidDrawAdditions()
              Explicitly draw the areas of incurred and added damage, respectively.

       virtualvoidMerge(BoxObj&)
              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.

       voidFirstArea(Iterator&)voidFirstAddition(Iterator&)voidNext(Iterator&)booleanDone(Iterator)BoxObj*GetArea(Iterator)Graphic*GetAddition(Iterator)
              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.

       UList*Elem(Iterator)
              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.

       voidDeleteArea(BoxObj*)voidDeleteAreas()
              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.

Public Operations

Damage(Canvas*=nil,Painter*=nil,Graphic*=nil)
              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.

       virtualvoidIncur(Graphic*)virtualvoidIncur(BoxObj&)virtualvoidIncur(Coordleft,Coordbottom,Coordright,Coordtop)
              Notify  the  damage object that a rectangular area has been damaged, either by passing the graphic
              that contributed the area or the area itself.

       virtualvoidAdded(Graphic*)
              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.

       virtualvoidRepair()
              Repair  all  damage incurred since the last Repair (or since the damage object was created if this
              is the first Repair).

       virtualvoidReset()
              Reset the damage object.  Any damage incurred is lost.

       virtualbooleanIncurred()
              Returns true if any damage has been incurred.

       voidSetCanvas(Canvas*)voidSetPainter(Painter*)voidSetGraphic(Graphic*)Canvas*GetCanvas()Painter*GetPainter()Graphic*GetGraphic()
              Set and get attributes of the damage object.

See Also

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

Unidraw                                          30 January 1991                                      Damage(3U)

Synopsis

#include<Unidraw/Graphic/damage.h>

See Also