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 βDamageobjects do not eliminate the need for an interactor'sRedrawmember 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 newDamageobject for a graphic on the given canvas π the painter is used to erase damaged areas with itsClearRectfunction 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 lastRepair(or since the damage object was created, if this is the firstRepair). the main character moment πvirtual void Reset()β resets the damage object. any damage incurred is lost π gone, deleted, no takebacks.virtual boolean Incurred()β returnstrueif 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 givenBoxObjπ 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 givenBoxObjinto the list of incur-damaged areas, coalescing it into an existing area if the number of non-overlapping areas exceeds2. 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 withBoxObjobjects) and addedGraphics π so:FirstAreaandFirstAdditioninitialize the iterator to point to the first item on the corresponding list,Nextadvances the iterator, andDonereturnstrueif the iterator points beyond the end of the list.GetAreaandGetAdditionreturn theBoxObjorGraphicthat the iterator points to. full tour of the list, no skips πUList* Elem(Iterator)β a helper function that returns theUListan iterator points to. heads up: the_areasprotected member is aUListthat stores the list of damaged areas, and the_additionsprotected [member] stores the list of added graphics πvoid DeleteArea(BoxObj*)void DeleteAreas()βDeleteAreais a helper function for deleting the storage associated with a damaged area, including the area itself and theUListelement.DeleteAreasis 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 π¦β¨
π¦ where this page comes from
- debian bookworm: ivtools-dev 2.0.11d.a1-1+b4
- debian trixie: ivtools-dev 2.0.11d.a1-3+b4
- ubuntu jammy: ivtools-dev 2.0.11d.a1-1build1
- ubuntu noble: ivtools-dev 2.0.11d.a1-3build1
- ubuntu questing: ivtools-dev 2.0.11d.a1-3build7
- ubuntu resolute: ivtools-dev 2.0.11d.a1-3build9
- ubuntu stonking: ivtools-dev 2.1.1+git.2025.07.26.a1-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms