Rubband(3I)
okay so bestie, we're reading Rubband(3I), straight from the InterViews Reference Manual, and it's lowkey giving "base class of a whole squad" and I'm obsessed π
β¨ NAME β¨
Rubband β rubberbanding graphical objects π
β¨ SYNOPSIS β¨
#include <InterViews/rubband.h>
#include <InterViews/rubcurve.h>
#include <InterViews/rubgroup.h>
#include <InterViews/rubline.h>
#include <InterViews/rubrect.h>
#include <InterViews/rubverts.h>
π DESCRIPTION π
So Rubband is the base class for a whole little family of classes that hand the user some graphical feedback while they're mid-interaction β think sizing a rectangle, dragging stuff around, all that β¨. A rubberband's whole look changes as its tracking point moves, which is the entire point of it fr fr.
Important vibe check: a rubberband is not an interactor itself π ββοΈ. Interactors are the ones that use rubberbands to make animated effects happen. And because rubberbands aren't interactors, their constructors have to be handed the painter and canvas they should draw with. No painter, no canvas, no drawing, periodt.
π PUBLIC OPERATIONS π
RubberLine(Painter*, Canvas*, Coord fx, fy, mx, my, offx = 0, offy = 0)β a rubber line stretches out to follow the tracking point, while its other endpoint stays tied down πRubberAxis(Painter*, Canvas*, Coord fx, fy, mx, my, offx = 0, offy = 0)β a rubber axis stretches horizontally or vertically to follow the tracking point while its other endpoint stays tied down. One endpoint stays fixed, and the other one moves along either the horizontal or the vertical axis β whichever one is closer to the tracking point πSlidingLine(Painter*, Canvas*, Coord x0, y0, x1, y1, rfx, rfy, Coord offx = 0, offy = 0)β a sliding line just slides around, and it does not change its length or its angle as the tracking point moves around a reference point πRotatingLine(Painter*, Canvas*, Coord x0, y0, x1, y1, rfx, rfy, Coord offx = 0, offy = 0)β a rotating line spins around(cx, cy), based on the angle between the radius from(cx, cy)to(rfx, rfy)and the radius from(cx, cy)to the tracking point πRubberRect(Painter*, Canvas*, Coord fx, fy, mx, my, offx = 0, offy = 0)β a rubber rectangle stretches to follow the tacking point while its opposite corner stays tied down πSlidingRect(Painter*, Canvas*, Coord x1, y1, x2, y2, rfx, rfy, Coord offx = 0, offy = 0)β a sliding rectangle slides around the screen without changing its side or its orientation as the tracking point moves around a reference point π§ScalingRect(Painter*, Canvas*, Coord x1, y1, x2, y2, cx, cy, Coord offx = 0, offy = 0)β a scaling rectangle scales equally in both dimensions about(cx, cy), so that one edge keeps intersecting the tracking point πRotatingRect(Painter*, Canvas*, Coord x1, y1, x2, y2, cx, cy, rfx, rfy, Coord offx = 0, offy = 0)β a rotating rectangle rotates about(cx, cy), based on the radius from(cx, cy)to(rfx, rfy)and the radius from(cx, cy)to the tracking point πStretchingRect(Painter*, Canvas*, Coord x1, y1, x2, y2, Side ts, Coord offx = 0, offy = 0)β a stretching rectangle's tracking side follows the tracking point while the opposite side stays fixed. That side can be one ofLeftSide,RightSide,BottomSide, orTopSideπ«±RubberCircle(Painter*, Canvas*, Coord cx, cy, rx, ry, offx = 0, offy = 0)β a rubber circle's radius varies with the magnitude of the tracking point's distance from(cx, cy)βRubberEllipse(Painter*, Canvas*, Coord cx, cy, rx, ry, offx = 0, offy = 0)β a rubber ellipse's horizontal and vertical radii vary with the magnitude of the tracking point's distance from(cx, cy)π₯RubberSpline(Painter*, Canvas*, Coord x[], y[], int n, pt, Coord offx = 0, offy = 0)RubberClosedSpline(Painter*, Canvas*, Coord x[], y[], int n, pt, Coord offx = 0, offy = 0)β a rubber spline is the section of a B-spline defined byncontrol points, and it changes shape as the control point indexed byptgets set to the tracking point πͺ’RubberHandles(Painter*, Canvas*, Coord x[], y[], int n, pt, size, Coord offx = 0, offy = 0)β a rubber handles object is a set of filled squares centered about each point in the list. The point indexed byptis the one that follows the tracking point π¨SlidingPointList(Painter*, Canvas*, Coord x[], y[], int n, pt, Coord rfx, rfy, Coord offx = 0, offy = 0)β a sliding point list slides around the screen without changing its appearance as the tracking point moves around a reference point π·SlidingLineList(Painter*, Canvas*, Coord x[], y[], int n, pt, Coord rfx, rfy, Coord offx = 0, offy = 0)β a sliding line list slides around the screen without changing the appearance of its connected lines as the tracking point moves around(rfx, rfy)π§΅ScalingLineList(Painer*, Canvas*, Coord x[], Coord y[], int n, Coord cx, cy, rfx, rfy, offx = 0, offy = 0)β a scaling line list scales a list of lines about(cx, cy)to keep the line list's bounding box intersecting the tracking point π¦RotatingLineList(Painer*, Canvas*, Coord x[], Coord y[], int n, Coord cx, cy, rfx, rfy, offx = 0, offy = 0)β a rotating line list rotates a list of lines about(cx, cy), based on the angle between the radius from(cx, cy)to(rfx, rfy)and the radius from(cx, cy)to the tracking point πͺοΈGrowingVertices(Painter*, Canvas*, Coord x[], y[], int n, int pt = -1, int handleSize = -1)GrowingMultiLine(Painter*, Canvas*, Coord x[], y[], int n, int pt = -1, int handleSize = -1)GrowingPolygon(Painter*, Canvas*, Coord x[], y[], int n, int pt = -1, int handleSize = -1)GrowingBSpline(Painter*, Canvas*, Coord x[], y[], int n, int pt = -1, int handleSize = -1)GrowingClosedBSpline(Painter*, Canvas*, Coord x[], y[], int n, int pt = -1, int handleSize = -1)virtual void AddVertex(Coord, Coord)virtual void RemoveVertex()βGrowingVerticesis an abstract rubberband holding a list of vertices that grows or shrinks dynamically π±
The pt parameter says which vertex index will follow the tracking point; a value of -1 means a vertex after the last one in the list. The handleSize parameter says how big the handle drawn at each vertex is (same deal as RubberHandles above); a value of -1 means no handles get drawn at all.
The AddVertex operation adds a brand-new vertex at the tracking point to the list, and makes the next (or last) vertex in the list follow the tracking point. RemoveVertex removes the vertex at the tracking point and makes the previous (or first) vertex the new tracking point. GrowingMultiLine, GrowingPolygon, GrowingBSpline, and GrowingClosedBSpline are GrowingVertices subclasses that draw a multiline, polygon, B-spline, and closed B-spline, respectively π¨
RubberGroup(Painter*, Canvas*)void Append(Rubberband*, Rubberband* = nil, Rubberband* = nil, Rubberband* = nil)void Remove(Rubberband*)void RemoveCur()void SetCurrent(Rubberband*)Rubberband* GetCurrent()Rubberband* First()Rubberband* Last()Rubberband* Next()Rubberband* Prev()boolean IsEmpty()boolean AtEnd()β aRubberGroupcomposes other rubberbands together, handing you operations for including, excluding, and traversing its children π―ββοΈ. RubberGroups are useful for combining the behavior of several rubberbands into one, which means you don't have to callTrackon a bunch of rubberbands separately. The RubberGroup'sSetCanvasandSetPainteroperations set the children's canvas and painter as well as the RubberGroup's own β but other than that, the children do not inherit the group's canvas and painter. TheTrackoperation callsTrackon each child with the same parameters.virtual void Draw()void Redraw()virtual void Erase()β explicitly draw, redraw, and erase the rubberband βοΈ. Multiple calls toDrawwithout an interveningErasewill only draw the rubberband once.Redrawforces the rubberband to actually be drawn. And since rubberbands are drawn in XOR mode,Redrawwill erase the rubberband every other time it's called π. These functions are used only on occasion β for example, when part of the screen gets erased while a rubberband is visible.Trackis normally what you use to draw the rubberband in response to mouse input.virtual void Track(Coord x, Coord y)β erase the rubberband and redraw it using the new tracking point π±οΈvoid GetOriginal(Coord& x1, Coord& y2, Coord& x2, Coord& y2)void GetCurrent(Coord& x1, Coord& y2, Coord& x2, Coord& y2)βGetOriginalobtains the original points specified for the rubberband.GetCurrentobtains the current points based on the most recent call toTrack. What those points mean depends on the kind of rubberband: for lines, the points are the endpoints; for rectangles, the points are opposite corners; for curves,(x1, y1)is the center andx2andy2are the radii πvirtual void SetPainter(Painter*)Painter* GetPainter()β explicitly set and get the painter the rubberband uses π¨. By default, rubberbands use a copy of the painter passed to their constructor. You can specify a particular painter to use by passing anilpainter to the constructor and later callingSetPainter.
N.B.: the rubberband may alter the painter specified via SetPainter π³
virtual void SetCanvas(Canvas*)Canvas* GetCanvas()β explicitly set and get the canvas the rubberband uses πΌοΈ
π SEE ALSO π
Canvas(3I), Painter(3I) β go read those too, bestie, iykyk π
and that's the whole page!! InterViews, dated 15 June 1987 β iconic vintage behavior, no cap πβ¨π π¦
π¦ 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