TermBuf::Drawing
Stability: stable — changes only in a major release.
The drawing surface, shared by the terminal and by a batch being built.
The two differ only in what they do with a command: one sends it, the other collects it. Everything else about the API is the same, so it lives here rather than being written twice and drifting apart.
Instance methods
Copies cells out of source, its top left landing at (x, y), taking
from of it or all of it. See Buffer#blit.
The source is read when the command is serviced rather than when it is issued, so a batched blit must not be followed by drawing into the same source before the frame is painted.
Blanks the whole screen.
Sets every cell of rect to char, each cell's style settled by blend against what is already there when there is one.
Sends command on, or collects it. What a Terminal and a Batcher
disagree about, and all they disagree about.
Where this surface's (0, 0) falls in the buffer's coordinates. Zero for
everything that draws on a whole buffer; a View says where it sits, so
the blend it carries can be asked in its own coordinates.
Sends bytes to the terminal untouched, after the current frame.
Sends bytes to the terminal untouched, after the current frame.
How clusters are measured on this surface, which is what a View cuts
writes by. Surfaces that know which buffer they draw into say so.
Scrolls rect by lines rows, positive moving content up.
Scrolls a region, keeping what leaves the top if it has scrollback.
A rectangle of this surface, addressed from its own top left and cut at
its own edges. Anything drawn through it merges onto style. See View.
A blend settles the style of every cell drawn through the view, on top
of whatever a draw call brings of its own. It is asked in the view's
coordinates, (0, 0) at the view's top left, so a Gradient built
against the view's bounds lands where the view is — unlike the blend
of a draw call, which is asked in the buffer's. See View#blend.
ramp = Gradient.new(top, bottom, Rect.new(0, 0, rect.width, rect.height), :vertical)
screen.view(rect, blend: ramp.background).clear
Writes text starting at (x, y), one grapheme cluster per cell, stopping at the right edge of the row.
With a blend, each cell gets the style the blend answers for it from
what is already there and style — Style::KEEP_BACKGROUND for a label
across a progress bar. See Buffer#write and Blend.