Module gemini_engine::elements::view
source · Expand description
This module is home to the View, which handles the printing of pixels to an ANSI standard text output
Re-exports
pub use utils::Wrapping;
Modules
- A module containing various helper functions and structs
Structs
- We use
ColCharto say exactly what each pixel should look like and what colour it should be. That is, theView’s canvas is just a vector ofColChars under the hood.ColCharhas thetext_charandmodifierproperties.text_charis the single ascii character used as the “pixel” when theViewis rendered, whereasmodifiercan give that pixel a colour or make it bold/italic - A struct to contain colour values. Can be created from RGB, HSV or greyscale values, but is ultimately stored as RGB.
- A pair of
isizeused for coordinates, size or direction on a 2D plane - The View struct is the canvas on which you will print all of your ViewElements. In normal use, you would clear the View,
blitall your ViewElements to it and then render. The following example demonstrates a piece of code that will render a View of width 9 and height 3, with a single Point in the middle
Enums
- The
Modifierenum is used for adding modifications to text such as colour, bold/italic/underline and others. It’s essentially a wrapper for\x1b[{x}m, where {x} is a code or rgb value of some sort.Modifieris primarily used byColCharas one of its properties
Traits
ViewElementis a trait that must be implemented by any element that can be blitted to aView