Damage(3U)

πŸ’… Damage(3U) β€” the InterViews Reference Manual glow-up πŸŽ€

okay bestie, gather round, because we're talking about Damage from the InterViews Reference Manual β€” the little icon that repairs damaged graphics ✨


✨ NAME ✨

Damage β€” repairs damaged graphics πŸ’– (yes that's the whole job, and she does it flawlessly)


🌸 SYNOPSIS 🌸

#include <Unidraw/Graphic/damage.h>

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea, bestie πŸ“ Damage objects are lil storage units for damaged areas of a graphic, holding onto them so they can get fixed up later, incrementally, no dramatic full-redraw meltdown. An area of a graphic counts as "damaged" if it needs to be redrawn for any reason β€” like if its state has been modified, or if under/overlapping graphics changed how it looks πŸ‘€

the whole point? Damage objects try to minimize the amount of redrawing needed to repair a graphic. They're most useful when the graphic is complicated enough that redrawing the entire canvas every time you modify something would be, frankly, embarrassing πŸ™ˆ

⚠️ but no cap β€” Damage objects do not eliminate the need for an interactor's Redraw member function. They could be used to implement it, but the need is still there. periodt πŸ’…

πŸ‘‘ PUBLIC OPERATIONS πŸ‘‘

  • Damage(Canvas* = nil, Painter* = nil, Graphic* = nil) β€” creates a brand new Damage object for a graphic on the given canvas πŸŽ€ the painter is used to erase damaged areas with its ClearRect function before redrawing them. iconic behavior.
  • virtual void Incur(Graphic*)
  • virtual void Incur(BoxObj&)
  • virtual void Incur(Coord left, Coord bottom, Coord right, Coord top) β€” these three tell the damage object that a rectangular area got damaged πŸ’€ you either hand over the graphic that contributed the area, or the area itself. pick your fighter.
  • virtual void Added(Graphic*) β€” notifies the damage object that the given graphic was appended (not inserted, bestie, read carefully πŸ‘€) to the graphic but was never drawn. so the damage object can also be responsible for drawing newly added graphics. she's doing overtime fr fr.
  • virtual void Repair() β€” repairs all damage incurred since the last Repair (or since the damage object was created, if this is the first Repair). the main character moment 🌟
  • virtual void Reset() β€” resets the damage object. any damage incurred is lost 😭 gone, deleted, no takebacks.
  • virtual boolean Incurred() β€” returns true if any damage has been incurred. simple. clean. slay.
  • void SetCanvas(Canvas*)
  • void SetPainter(Painter*)
  • void SetGraphic(Graphic*)
  • Canvas* GetCanvas()
  • Painter* GetPainter()
  • Graphic* GetGraphic() β€” set and get the attributes of the damage object. the classic setter/getter duo, we love to see it 🫢

🧚 PROTECTED OPERATIONS 🧚

  • int Area(BoxObj&) β€” a helper function that returns the area in square pixels occupied by the given BoxObj πŸ“ math girlies rise.
  • virtual void DrawAreas()
  • virtual void DrawAdditions() β€” explicitly draw the areas of incurred and added damage, respectively. go off, draw them ✨
  • virtual void Merge(BoxObj&) β€” merges 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. efficiency queen πŸ‘‘
  • void FirstArea(Iterator&)
  • void FirstAddition(Iterator&)
  • void Next(Iterator&)
  • boolean Done(Iterator)
  • BoxObj* GetArea(Iterator)
  • Graphic* GetAddition(Iterator) β€” operations for iterating over the lists of damaged areas (represented with BoxObj objects) and added Graphics πŸ’œ so: 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 that the iterator points to. full tour of the list, no skips 🌈
  • UList* Elem(Iterator) β€” a helper function that returns the UList an iterator points to. heads up: the _areas protected member is a UList that stores the list of damaged areas, and the _additions protected [member] stores the list of added graphics πŸŽ€
  • void DeleteArea(BoxObj*)
  • void DeleteAreas() β€” 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. cleanup crew, we stan 🧹

πŸ”₯ SEE ALSO πŸ”₯

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


and that's the whole page bestie πŸ’– this was written by Unidraw, dated 30 January 1991 β€” yeah she's vintage, she's an icon, she's a legend and she is the moment πŸ‘‘ no cap, go forth and repair those damaged graphics fr fr πŸ¦‹βœ¨