FTXUI 6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
ftxui/screen

Detailed Description

請查看 ftxui/screen 模組的 教學

Namespaces

namespace  ftxui::Dimension
 定義螢幕的維度外觀。
 

Classes

struct  Box
 Box 是一個表示二維空間中矩形區域的結構。 More...
 
class  Color
 Color 是一個在終端使用者介面中表示顏色的類別。 More...
 
struct  ColorInfo
 ColorInfo 是一個結構,包含有關終端機 顏色調色盤的資訊。 More...
 
class  Image
 像素的矩形網格。 More...
 
struct  Pixel
 一個 Unicode 字元及其相關樣式。 More...
 
class  Screen
 像素的矩形網格。 More...
 
struct  Dimensions
 Dimensions 是一個表示終端機大小的結構 More...
 

Enumerations

enum  Color {
  Palette1 ,
  Palette16 ,
  Palette256 ,
  TrueColor
}
 Color 是一個列舉,表示終端機的色彩支援 More...
 

Functions

Dimensions Size ()
 獲取終端機大小。
 
Color ColorSupport ()
 獲取終端機的顏色支援。
 

Class Documentation

◆ ftxui::Box

struct ftxui::Box

Box 是一個表示二維空間中矩形區域的結構。

它由其沿 x 軸和 y 軸的最小和最大座標定義。 請注意,座標是包含性的,這表示該框包含最小值和最大值。

Definition at line 14 of file box.hpp.

Public Member Functions

void Shift (int x, int y)
 
bool Contain (int x, int y) const
 
bool IsEmpty () const
 
bool operator== (const Box &other) const
 
bool operator!= (const Box &other) const
 

Static Public Member Functions

static auto Intersection (Box a, Box b) -> Box
 
static auto Union (Box a, Box b) -> Box
 

Public Attributes

int x_min = 0
 
int x_max = 0
 
int y_min = 0
 
int y_max = 0
 

Member Function Documentation

◆ Intersection()

Box Intersection ( Box a,
Box b ) -> Box
static
Returns
包含在 |a| 和 |b| 中的最大 Box。

Definition at line 11 of file box.cpp.

◆ Union()

Box Union ( Box a,
Box b ) -> Box
static
Returns
包含 |a| 和 |b| 的最小 Box。

Definition at line 22 of file box.cpp.

◆ Shift()

void Shift ( int x,
int y )

Box 依據 (x,y) 進行位移。

Parameters
x水平位移。
y垂直位移。

Definition at line 34 of file box.cpp.

◆ Contain()

bool Contain ( int x,
int y ) const
Returns
(x,y) 是否包含在 Box 內。

Definition at line 42 of file box.cpp.

◆ IsEmpty()

bool IsEmpty ( ) const
Returns
Box 是否為空。

Definition at line 50 of file box.cpp.

◆ operator==()

bool operator== ( const Box & other) const
Returns
|other| 是否與 |this| 相同。

Definition at line 55 of file box.cpp.

◆ operator!=()

bool operator!= ( const Box & other) const
Returns
|other| 和 |this| 是否不同。

Definition at line 61 of file box.cpp.

Member Data Documentation

◆ x_min

int x_min = 0

Definition at line 15 of file box.hpp.

◆ x_max

int x_max = 0

Definition at line 16 of file box.hpp.

◆ y_min

int y_min = 0

Definition at line 17 of file box.hpp.

◆ y_max

int y_max = 0

Definition at line 18 of file box.hpp.

◆ ftxui::Color

class ftxui::Color

Public Types

enum  Palette1 : uint8_t { Default }
 
enum  Palette16 : uint8_t {
  Black = 0 ,
  Red = 1 ,
  Green = 2 ,
  Yellow = 3 ,
  Blue = 4 ,
  Magenta = 5 ,
  Cyan = 6 ,
  GrayLight = 7 ,
  GrayDark = 8 ,
  RedLight = 9 ,
  GreenLight = 10 ,
  YellowLight = 11 ,
  BlueLight = 12 ,
  MagentaLight = 13 ,
  CyanLight = 14 ,
  White = 15
}
 
enum  Palette256 : uint8_t {
  Aquamarine1 = 122 ,
  Aquamarine1Bis = 86 ,
  Aquamarine3 = 79 ,
  Blue1 = 21 ,
  Blue3 = 19 ,
  Blue3Bis = 20 ,
  BlueViolet = 57 ,
  CadetBlue = 72 ,
  CadetBlueBis = 73 ,
  Chartreuse1 = 118 ,
  Chartreuse2 = 112 ,
  Chartreuse2Bis = 82 ,
  Chartreuse3 = 70 ,
  Chartreuse3Bis = 76 ,
  Chartreuse4 = 64 ,
  CornflowerBlue = 69 ,
  Cornsilk1 = 230 ,
  Cyan1 = 51 ,
  Cyan2 = 50 ,
  Cyan3 = 43 ,
  DarkBlue = 18 ,
  DarkCyan = 36 ,
  DarkGoldenrod = 136 ,
  DarkGreen = 22 ,
  DarkKhaki = 143 ,
  DarkMagenta = 90 ,
  DarkMagentaBis = 91 ,
  DarkOliveGreen1 = 191 ,
  DarkOliveGreen1Bis = 192 ,
  DarkOliveGreen2 = 155 ,
  DarkOliveGreen3 = 107 ,
  DarkOliveGreen3Bis = 113 ,
  DarkOliveGreen3Ter = 149 ,
  DarkOrange = 208 ,
  DarkOrange3 = 130 ,
  DarkOrange3Bis = 166 ,
  DarkRed = 52 ,
  DarkRedBis = 88 ,
  DarkSeaGreen = 108 ,
  DarkSeaGreen1 = 158 ,
  DarkSeaGreen1Bis = 193 ,
  DarkSeaGreen2 = 151 ,
  DarkSeaGreen2Bis = 157 ,
  DarkSeaGreen3 = 115 ,
  DarkSeaGreen3Bis = 150 ,
  DarkSeaGreen4 = 65 ,
  DarkSeaGreen4Bis = 71 ,
  DarkSlateGray1 = 123 ,
  DarkSlateGray2 = 87 ,
  DarkSlateGray3 = 116 ,
  DarkTurquoise = 44 ,
  DarkViolet = 128 ,
  DarkVioletBis = 92 ,
  DeepPink1 = 198 ,
  DeepPink1Bis = 199 ,
  DeepPink2 = 197 ,
  DeepPink3 = 161 ,
  DeepPink3Bis = 162 ,
  DeepPink4 = 125 ,
  DeepPink4Bis = 89 ,
  DeepPink4Ter = 53 ,
  DeepSkyBlue1 = 39 ,
  DeepSkyBlue2 = 38 ,
  DeepSkyBlue3 = 31 ,
  DeepSkyBlue3Bis = 32 ,
  DeepSkyBlue4 = 23 ,
  DeepSkyBlue4Bis = 24 ,
  DeepSkyBlue4Ter = 25 ,
  DodgerBlue1 = 33 ,
  DodgerBlue2 = 27 ,
  DodgerBlue3 = 26 ,
  Gold1 = 220 ,
  Gold3 = 142 ,
  Gold3Bis = 178 ,
  Green1 = 46 ,
  Green3 = 34 ,
  Green3Bis = 40 ,
  Green4 = 28 ,
  GreenYellow = 154 ,
  Grey0 = 16 ,
  Grey100 = 231 ,
  Grey11 = 234 ,
  Grey15 = 235 ,
  Grey19 = 236 ,
  Grey23 = 237 ,
  Grey27 = 238 ,
  Grey3 = 232 ,
  Grey30 = 239 ,
  Grey35 = 240 ,
  Grey37 = 59 ,
  Grey39 = 241 ,
  Grey42 = 242 ,
  Grey46 = 243 ,
  Grey50 = 244 ,
  Grey53 = 102 ,
  Grey54 = 245 ,
  Grey58 = 246 ,
  Grey62 = 247 ,
  Grey63 = 139 ,
  Grey66 = 248 ,
  Grey69 = 145 ,
  Grey7 = 233 ,
  Grey70 = 249 ,
  Grey74 = 250 ,
  Grey78 = 251 ,
  Grey82 = 252 ,
  Grey84 = 188 ,
  Grey85 = 253 ,
  Grey89 = 254 ,
  Grey93 = 255 ,
  Honeydew2 = 194 ,
  HotPink = 205 ,
  HotPink2 = 169 ,
  HotPink3 = 132 ,
  HotPink3Bis = 168 ,
  HotPinkBis = 206 ,
  IndianRed = 131 ,
  IndianRed1 = 203 ,
  IndianRed1Bis = 204 ,
  IndianRedBis = 167 ,
  Khaki1 = 228 ,
  Khaki3 = 185 ,
  LightCoral = 210 ,
  LightCyan1Bis = 195 ,
  LightCyan3 = 152 ,
  LightGoldenrod1 = 227 ,
  LightGoldenrod2 = 186 ,
  LightGoldenrod2Bis = 221 ,
  LightGoldenrod2Ter = 222 ,
  LightGoldenrod3 = 179 ,
  LightGreen = 119 ,
  LightGreenBis = 120 ,
  LightPink1 = 217 ,
  LightPink3 = 174 ,
  LightPink4 = 95 ,
  LightSalmon1 = 216 ,
  LightSalmon3 = 137 ,
  LightSalmon3Bis = 173 ,
  LightSeaGreen = 37 ,
  LightSkyBlue1 = 153 ,
  LightSkyBlue3 = 109 ,
  LightSkyBlue3Bis = 110 ,
  LightSlateBlue = 105 ,
  LightSlateGrey = 103 ,
  LightSteelBlue = 147 ,
  LightSteelBlue1 = 189 ,
  LightSteelBlue3 = 146 ,
  LightYellow3 = 187 ,
  Magenta1 = 201 ,
  Magenta2 = 165 ,
  Magenta2Bis = 200 ,
  Magenta3 = 127 ,
  Magenta3Bis = 163 ,
  Magenta3Ter = 164 ,
  MediumOrchid = 134 ,
  MediumOrchid1 = 171 ,
  MediumOrchid1Bis = 207 ,
  MediumOrchid3 = 133 ,
  MediumPurple = 104 ,
  MediumPurple1 = 141 ,
  MediumPurple2 = 135 ,
  MediumPurple2Bis = 140 ,
  MediumPurple3 = 97 ,
  MediumPurple3Bis = 98 ,
  MediumPurple4 = 60 ,
  MediumSpringGreen = 49 ,
  MediumTurquoise = 80 ,
  MediumVioletRed = 126 ,
  MistyRose1 = 224 ,
  MistyRose3 = 181 ,
  NavajoWhite1 = 223 ,
  NavajoWhite3 = 144 ,
  NavyBlue = 17 ,
  Orange1 = 214 ,
  Orange3 = 172 ,
  Orange4 = 58 ,
  Orange4Bis = 94 ,
  OrangeRed1 = 202 ,
  Orchid = 170 ,
  Orchid1 = 213 ,
  Orchid2 = 212 ,
  PaleGreen1 = 121 ,
  PaleGreen1Bis = 156 ,
  PaleGreen3 = 114 ,
  PaleGreen3Bis = 77 ,
  PaleTurquoise1 = 159 ,
  PaleTurquoise4 = 66 ,
  PaleVioletRed1 = 211 ,
  Pink1 = 218 ,
  Pink3 = 175 ,
  Plum1 = 219 ,
  Plum2 = 183 ,
  Plum3 = 176 ,
  Plum4 = 96 ,
  Purple = 129 ,
  Purple3 = 56 ,
  Purple4 = 54 ,
  Purple4Bis = 55 ,
  PurpleBis = 93 ,
  Red1 = 196 ,
  Red3 = 124 ,
  Red3Bis = 160 ,
  RosyBrown = 138 ,
  RoyalBlue1 = 63 ,
  Salmon1 = 209 ,
  SandyBrown = 215 ,
  SeaGreen1 = 84 ,
  SeaGreen1Bis = 85 ,
  SeaGreen2 = 83 ,
  SeaGreen3 = 78 ,
  SkyBlue1 = 117 ,
  SkyBlue2 = 111 ,
  SkyBlue3 = 74 ,
  SlateBlue1 = 99 ,
  SlateBlue3 = 61 ,
  SlateBlue3Bis = 62 ,
  SpringGreen1 = 48 ,
  SpringGreen2 = 42 ,
  SpringGreen2Bis = 47 ,
  SpringGreen3 = 35 ,
  SpringGreen3Bis = 41 ,
  SpringGreen4 = 29 ,
  SteelBlue = 67 ,
  SteelBlue1 = 75 ,
  SteelBlue1Bis = 81 ,
  SteelBlue3 = 68 ,
  Tan = 180 ,
  Thistle1 = 225 ,
  Thistle3 = 182 ,
  Turquoise2 = 45 ,
  Turquoise4 = 30 ,
  Violet = 177 ,
  Wheat1 = 229 ,
  Wheat4 = 101 ,
  Yellow1 = 226 ,
  Yellow2 = 190 ,
  Yellow3 = 148 ,
  Yellow3Bis = 184 ,
  Yellow4 = 100 ,
  Yellow4Bis = 106
}
 

Public Member Functions

 Color ()
 建立一個透明的顏色。
 
 Color (Palette1 index)
 建立一個透明的顏色。
 
 Color (Palette16 index)
 使用 Palette16 顏色建立一個顏色。
 
 Color (Palette256 index)
 使用 Palette256 顏色建立一個顏色。
 
 Color (uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha=255)
 從 RGB 表示建立一個顏色。 https://en.wikipedia.org/wiki/RGB_color_model
 
bool operator== (const Color &rhs) const
 
bool operator!= (const Color &rhs) const
 
std::string Print (bool is_background_color) const
 
bool IsOpaque () const
 

Static Public Member Functions

static Color RGB (uint8_t red, uint8_t green, uint8_t blue)
 從 RGB 表示建立一個顏色。 https://en.wikipedia.org/wiki/RGB_color_model
 
static Color HSV (uint8_t hue, uint8_t saturation, uint8_t value)
 從 HSV 表示建立一個顏色。 https://en.wikipedia.org/wiki/HSL_and_HSV
 
static Color RGBA (uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha)
 從 RGBA 表示建立一個顏色。 https://en.wikipedia.org/wiki/RGB_color_model
 
static Color HSVA (uint8_t hue, uint8_t saturation, uint8_t value, uint8_t alpha)
 從 HSV 表示建立一個顏色。 https://en.wikipedia.org/wiki/HSL_and_HSV
 
static Color Interpolate (float t, const Color &a, const Color &b)
 
static Color Blend (const Color &lhs, const Color &rhs)
 使用 alpha 色版將兩種顏色混合在一起。
 

Member Enumeration Documentation

◆ Palette1

enum Palette1 : uint8_t
Enumerator
Default 

Definition at line 47 of file color.hpp.

◆ Palette16

enum Palette16 : uint8_t
Enumerator
Black 
Red 
Green 
Yellow 
Blue 
Magenta 
Cyan 
GrayLight 
GrayDark 
RedLight 
GreenLight 
YellowLight 
BlueLight 
MagentaLight 
CyanLight 
White 

Definition at line 51 of file color.hpp.

◆ Palette256

enum Palette256 : uint8_t
Enumerator
Aquamarine1 
Aquamarine1Bis 
Aquamarine3 
Blue1 
Blue3 
Blue3Bis 
BlueViolet 
CadetBlue 
CadetBlueBis 
Chartreuse1 
Chartreuse2 
Chartreuse2Bis 
Chartreuse3 
Chartreuse3Bis 
Chartreuse4 
CornflowerBlue 
Cornsilk1 
Cyan1 
Cyan2 
Cyan3 
DarkBlue 
DarkCyan 
DarkGoldenrod 
DarkGreen 
DarkKhaki 
DarkMagenta 
DarkMagentaBis 
DarkOliveGreen1 
DarkOliveGreen1Bis 
DarkOliveGreen2 
DarkOliveGreen3 
DarkOliveGreen3Bis 
DarkOliveGreen3Ter 
DarkOrange 
DarkOrange3 
DarkOrange3Bis 
DarkRed 
DarkRedBis 
DarkSeaGreen 
DarkSeaGreen1 
DarkSeaGreen1Bis 
DarkSeaGreen2 
DarkSeaGreen2Bis 
DarkSeaGreen3 
DarkSeaGreen3Bis 
DarkSeaGreen4 
DarkSeaGreen4Bis 
DarkSlateGray1 
DarkSlateGray2 
DarkSlateGray3 
DarkTurquoise 
DarkViolet 
DarkVioletBis 
DeepPink1 
DeepPink1Bis 
DeepPink2 
DeepPink3 
DeepPink3Bis 
DeepPink4 
DeepPink4Bis 
DeepPink4Ter 
DeepSkyBlue1 
DeepSkyBlue2 
DeepSkyBlue3 
DeepSkyBlue3Bis 
DeepSkyBlue4 
DeepSkyBlue4Bis 
DeepSkyBlue4Ter 
DodgerBlue1 
DodgerBlue2 
DodgerBlue3 
Gold1 
Gold3 
Gold3Bis 
Green1 
Green3 
Green3Bis 
Green4 
GreenYellow 
Grey0 
Grey100 
Grey11 
Grey15 
Grey19 
Grey23 
Grey27 
Grey3 
Grey30 
Grey35 
Grey37 
Grey39 
Grey42 
Grey46 
Grey50 
Grey53 
Grey54 
Grey58 
Grey62 
Grey63 
Grey66 
Grey69 
Grey7 
Grey70 
Grey74 
Grey78 
Grey82 
Grey84 
Grey85 
Grey89 
Grey93 
Honeydew2 
HotPink 
HotPink2 
HotPink3 
HotPink3Bis 
HotPinkBis 
IndianRed 
IndianRed1 
IndianRed1Bis 
IndianRedBis 
Khaki1 
Khaki3 
LightCoral 
LightCyan1Bis 
LightCyan3 
LightGoldenrod1 
LightGoldenrod2 
LightGoldenrod2Bis 
LightGoldenrod2Ter 
LightGoldenrod3 
LightGreen 
LightGreenBis 
LightPink1 
LightPink3 
LightPink4 
LightSalmon1 
LightSalmon3 
LightSalmon3Bis 
LightSeaGreen 
LightSkyBlue1 
LightSkyBlue3 
LightSkyBlue3Bis 
LightSlateBlue 
LightSlateGrey 
LightSteelBlue 
LightSteelBlue1 
LightSteelBlue3 
LightYellow3 
Magenta1 
Magenta2 
Magenta2Bis 
Magenta3 
Magenta3Bis 
Magenta3Ter 
MediumOrchid 
MediumOrchid1 
MediumOrchid1Bis 
MediumOrchid3 
MediumPurple 
MediumPurple1 
MediumPurple2 
MediumPurple2Bis 
MediumPurple3 
MediumPurple3Bis 
MediumPurple4 
MediumSpringGreen 
MediumTurquoise 
MediumVioletRed 
MistyRose1 
MistyRose3 
NavajoWhite1 
NavajoWhite3 
NavyBlue 
Orange1 
Orange3 
Orange4 
Orange4Bis 
OrangeRed1 
Orchid 
Orchid1 
Orchid2 
PaleGreen1 
PaleGreen1Bis 
PaleGreen3 
PaleGreen3Bis 
PaleTurquoise1 
PaleTurquoise4 
PaleVioletRed1 
Pink1 
Pink3 
Plum1 
Plum2 
Plum3 
Plum4 
Purple 
Purple3 
Purple4 
Purple4Bis 
PurpleBis 
Red1 
Red3 
Red3Bis 
RosyBrown 
RoyalBlue1 
Salmon1 
SandyBrown 
SeaGreen1 
SeaGreen1Bis 
SeaGreen2 
SeaGreen3 
SkyBlue1 
SkyBlue2 
SkyBlue3 
SlateBlue1 
SlateBlue3 
SlateBlue3Bis 
SpringGreen1 
SpringGreen2 
SpringGreen2Bis 
SpringGreen3 
SpringGreen3Bis 
SpringGreen4 
SteelBlue 
SteelBlue1 
SteelBlue1Bis 
SteelBlue3 
Tan 
Thistle1 
Thistle3 
Turquoise2 
Turquoise4 
Violet 
Wheat1 
Wheat4 
Yellow1 
Yellow2 
Yellow3 
Yellow3Bis 
Yellow4 
Yellow4Bis 

Definition at line 70 of file color.hpp.

Constructor & Destructor Documentation

◆ Color() [1/5]

Color ( )
default

建立一個透明的顏色。

◆ Color() [2/5]

Color ( Palette1 index)

建立一個透明的顏色。

Definition at line 80 of file screen/color.cpp.

◆ Color() [3/5]

Color ( Palette16 index)

使用 Palette16 顏色建立一個顏色。

Definition at line 83 of file screen/color.cpp.

◆ Color() [4/5]

Color ( Palette256 index)

使用 Palette256 顏色建立一個顏色。

Definition at line 87 of file screen/color.cpp.

◆ Color() [5/5]

Color ( uint8_t red,
uint8_t green,
uint8_t blue,
uint8_t alpha = 255 )

從 RGB 表示建立一個顏色。 https://en.wikipedia.org/wiki/RGB_color_model

Parameters
red紅色的量 [0,255]
green綠色的量 [0,255]
blue藍色的量 [0,255]
alphaalpha 的量 [0,255]

Definition at line 103 of file screen/color.cpp.

Member Function Documentation

◆ RGB()

Color RGB ( uint8_t red,
uint8_t green,
uint8_t blue )
static

從 RGB 表示建立一個顏色。 https://en.wikipedia.org/wiki/RGB_color_model

Parameters
red紅色的量 [0,255]
green綠色的量 [0,255]
blue藍色的量 [0,255]

Definition at line 147 of file screen/color.cpp.

◆ HSV()

Color HSV ( uint8_t h,
uint8_t s,
uint8_t v )
static

從 HSV 表示建立一個顏色。 https://en.wikipedia.org/wiki/HSL_and_HSV

Parameters
h顏色的色相 [0,255]
s「色彩豐富度」 [0,255]。
v「亮度」 [0,255]

Definition at line 198 of file screen/color.cpp.

◆ RGBA()

Color RGBA ( uint8_t red,
uint8_t green,
uint8_t blue,
uint8_t alpha )
static

從 RGBA 表示建立一個顏色。 https://en.wikipedia.org/wiki/RGB_color_model

Parameters
red紅色的量 [0,255]
green綠色的量 [0,255]
blue藍色的量 [0,255]
alphaalpha 的量 [0,255]
See also
Color::RGB

Definition at line 159 of file screen/color.cpp.

◆ HSVA()

Color HSVA ( uint8_t h,
uint8_t s,
uint8_t v,
uint8_t alpha )
static

從 HSV 表示建立一個顏色。 https://en.wikipedia.org/wiki/HSL_and_HSV

Parameters
h顏色的色相 [0,255]
s「色彩豐富度」 [0,255]。
v「亮度」 [0,255]
alphaalpha 的量 [0,255]

Definition at line 171 of file screen/color.cpp.

◆ Interpolate()

Color Interpolate ( float t,
const Color & a,
const Color & b )
static

Definition at line 203 of file screen/color.cpp.

◆ Blend()

Color Blend ( const Color & lhs,
const Color & rhs )
static

使用 alpha 色版將兩種顏色混合在一起。

Definition at line 272 of file screen/color.cpp.

◆ operator==()

bool operator== ( const Color & rhs) const

Definition at line 37 of file screen/color.cpp.

◆ operator!=()

bool operator!= ( const Color & rhs) const

Definition at line 42 of file screen/color.cpp.

◆ Print()

std::string Print ( bool is_background_color) const

Definition at line 46 of file screen/color.cpp.

◆ IsOpaque()

bool IsOpaque ( ) const
inline

Definition at line 319 of file color.hpp.

◆ ftxui::ColorInfo

struct ftxui::ColorInfo

ColorInfo 是一個結構,包含有關終端機 顏色調色盤的資訊。

Definition at line 16 of file color_info.hpp.

Public Attributes

const char * name
 
uint8_t index_256
 
uint8_t index_16
 
uint8_t red
 
uint8_t green
 
uint8_t blue
 
uint8_t hue
 
uint8_t saturation
 
uint8_t value
 

Member Data Documentation

◆ name

const char* name

Definition at line 17 of file color_info.hpp.

◆ index_256

uint8_t index_256

Definition at line 18 of file color_info.hpp.

◆ index_16

uint8_t index_16

Definition at line 19 of file color_info.hpp.

◆ red

uint8_t red

Definition at line 20 of file color_info.hpp.

◆ green

uint8_t green

Definition at line 21 of file color_info.hpp.

◆ blue

uint8_t blue

Definition at line 22 of file color_info.hpp.

◆ hue

uint8_t hue

Definition at line 23 of file color_info.hpp.

◆ saturation

uint8_t saturation

Definition at line 24 of file color_info.hpp.

◆ value

uint8_t value

Definition at line 25 of file color_info.hpp.

◆ ftxui::Image

class ftxui::Image

像素的矩形網格。

Definition at line 17 of file image.hpp.

+ Inheritance diagram for Image:

Public Member Functions

 Image ()=delete
 
 Image (int dimx, int dimy)
 
virtual ~Image ()=default
 
std::string & at (int x, int y)
 存取給定位置的單元格中的字元。
 
const std::string & at (int x, int y) const
 存取給定位置的單元格中的字元。
 
PixelPixelAt (int x, int y)
 存取給定位置的單元格 (Pixel)。
 
const PixelPixelAt (int x, int y) const
 存取給定位置的單元格 (Pixel)。
 
int dimx () const
 
int dimy () const
 
void Clear ()
 清除螢幕上的所有像素。
 

Public Attributes

Box stencil
 

Protected Attributes

int dimx_
 
int dimy_
 
std::vector< std::vector< Pixel > > pixels_
 

Constructor & Destructor Documentation

◆ Image() [1/2]

Image ( )
delete

◆ Image() [2/2]

Image ( int dimx,
int dimy )

Definition at line 20 of file image.cpp.

◆ ~Image()

virtual ~Image ( )
virtualdefault

Member Function Documentation

◆ at() [1/2]

std::string & at ( int x,
int y )

存取給定位置的單元格中的字元。

Parameters
x沿 X 軸的單元格位置。
y沿 Y 軸的單元格位置。

Definition at line 29 of file image.cpp.

◆ at() [2/2]

const std::string & at ( int x,
int y ) const

存取給定位置的單元格中的字元。

Parameters
x沿 X 軸的單元格位置。
y沿 Y 軸的單元格位置。

Definition at line 36 of file image.cpp.

◆ PixelAt() [1/2]

Pixel & PixelAt ( int x,
int y )

存取給定位置的單元格 (Pixel)。

Parameters
x沿 X 軸的單元格位置。
y沿 Y 軸的單元格位置。

Definition at line 43 of file image.cpp.

◆ PixelAt() [2/2]

const Pixel & PixelAt ( int x,
int y ) const

存取給定位置的單元格 (Pixel)。

Parameters
x沿 X 軸的單元格位置。
y沿 Y 軸的單元格位置。

Definition at line 50 of file image.cpp.

◆ dimx()

int dimx ( ) const
inline

Definition at line 35 of file image.hpp.

◆ dimy()

int dimy ( ) const
inline

Definition at line 36 of file image.hpp.

◆ Clear()

void Clear ( )

清除螢幕上的所有像素。

Definition at line 55 of file image.cpp.

Member Data Documentation

◆ stencil

Box stencil

Definition at line 41 of file image.hpp.

◆ dimx_

int dimx_
protected

Definition at line 44 of file image.hpp.

◆ dimy_

int dimy_
protected

Definition at line 45 of file image.hpp.

◆ pixels_

std::vector<std::vector<Pixel> > pixels_
protected

Definition at line 46 of file image.hpp.

◆ ftxui::Pixel

struct ftxui::Pixel

一個 Unicode 字元及其相關樣式。

Examples
examples/component/canvas_animated.cpp, examples/component/selection.cpp, and examples/dom/canvas.cpp.

Definition at line 14 of file pixel.hpp.

Public Member Functions

 Pixel ()
 

Public Attributes

bool blink: 1
 
bool bold: 1
 
bool dim: 1
 
bool italic: 1
 
bool inverted: 1
 
bool underlined: 1
 
bool underlined_double: 1
 
bool strikethrough: 1
 
bool automerge: 1
 
uint8_t hyperlink = 0
 
std::string character = ""
 
Color background_color = Color::Default
 
Color foreground_color = Color::Default
 

Constructor & Destructor Documentation

◆ Pixel()

Pixel ( )
inline

Definition at line 15 of file pixel.hpp.

Member Data Documentation

◆ blink

bool blink

Definition at line 27 of file pixel.hpp.

◆ bold

bool bold
Examples
examples/component/canvas_animated.cpp.

Definition at line 28 of file pixel.hpp.

◆ dim

bool dim

Definition at line 29 of file pixel.hpp.

◆ italic

bool italic

Definition at line 30 of file pixel.hpp.

◆ inverted

bool inverted

Definition at line 31 of file pixel.hpp.

◆ underlined

bool underlined

◆ underlined_double

bool underlined_double
Examples
examples/component/selection.cpp.

Definition at line 33 of file pixel.hpp.

◆ strikethrough

bool strikethrough

Definition at line 34 of file pixel.hpp.

◆ automerge

bool automerge

Definition at line 35 of file pixel.hpp.

◆ hyperlink

uint8_t hyperlink = 0

Definition at line 40 of file pixel.hpp.

◆ character

std::string character = ""

Definition at line 44 of file pixel.hpp.

◆ background_color

Color background_color = Color::Default

Definition at line 47 of file pixel.hpp.

◆ foreground_color

Color foreground_color = Color::Default

◆ ftxui::Screen

class ftxui::Screen

像素的矩形網格。

Examples
examples/dom/gauge.cpp, and examples/dom/gauge_direction.cpp.

Definition at line 26 of file screen.hpp.

+ Inheritance diagram for Screen:

Public Types

using SelectionStyle = std::function<void(Pixel&)>
 

Public Member Functions

 Screen (int dimx, int dimy)
 
 ~Screen () override=default
 
std::string ToString () const
 
void Print () const
 
void Clear ()
 清除螢幕上的所有像素。
 
std::string ResetPosition (bool clear=false) const
 返回一個字串,用於將游標位置重置到螢幕的開頭。
 
void ApplyShader ()
 
Cursor cursor () const
 
void SetCursor (Cursor cursor)
 
uint8_t RegisterHyperlink (const std::string &link)
 
const std::string & Hyperlink (uint8_t id) const
 
const SelectionStyleGetSelectionStyle () const
 返回當前選擇樣式。
 
void SetSelectionStyle (SelectionStyle decorator)
 設置當前選擇樣式。
 
std::string & at (int x, int y)
 存取給定位置的單元格中的字元。
 
const std::string & at (int x, int y) const
 存取給定位置的單元格中的字元。
 
PixelPixelAt (int x, int y)
 存取給定位置的單元格 (Pixel)。
 
const PixelPixelAt (int x, int y) const
 存取給定位置的單元格 (Pixel)。
 
int dimx () const
 
int dimy () const
 

Static Public Member Functions

static Screen Create (Dimensions dimension)
 創建具有給定尺寸的螢幕。
 
static Screen Create (Dimensions width, Dimensions height)
 沿著 x 軸和 y 軸創建具有給定尺寸的螢幕。
 

Public Attributes

Box stencil
 

Protected Attributes

Cursor cursor_
 
std::vector< std::string > hyperlinks_ = {""}
 
SelectionStyle selection_style_
 
int dimx_
 
int dimy_
 
std::vector< std::vector< Pixel > > pixels_
 

Member Typedef Documentation

◆ SelectionStyle

using SelectionStyle = std::function<void(Pixel&)>

Definition at line 72 of file screen.hpp.

Constructor & Destructor Documentation

◆ Screen()

Screen ( int dimx,
int dimy )

Definition at line 399 of file screen.cpp.

◆ ~Screen()

~Screen ( )
overridedefault

Member Function Documentation

◆ Create() [1/2]

Screen Create ( Dimensions dimension)
static

創建具有給定尺寸的螢幕。

Definition at line 395 of file screen.cpp.

◆ Create() [2/2]

Screen Create ( Dimensions width,
Dimensions height )
static

沿著 x 軸和 y 軸創建具有給定尺寸的螢幕。

Definition at line 389 of file screen.cpp.

◆ ToString()

std::string ToString ( ) const

生成一個可用於在終端上列印螢幕的 std::string。

Note
不要忘記刷新 stdout。或者,您可以使用 Screen::Print();

Definition at line 412 of file screen.cpp.

◆ Print()

void Print ( ) const

Definition at line 449 of file screen.cpp.

◆ Clear()

void Clear ( )

清除螢幕上的所有像素。

Definition at line 489 of file screen.cpp.

◆ ResetPosition()

std::string ResetPosition ( bool clear = false) const

返回一個字串,用於將游標位置重置到螢幕的開頭。

std::string reset_position;
while(true) {
auto document = render();
auto screen = Screen::Create(Dimension::Full(), Dimension::Fit(document));
Render(screen, document);
std::cout << reset_position << screen.ToString() << std::flush;
reset_position = screen.ResetPosition();
using namespace std::chrono_literals;
std::this_thread::sleep_for(0.01s);
}
static Screen Create(Dimensions dimension)
創建具有給定尺寸的螢幕。
Definition screen.cpp:395
void Render(Screen &screen, const Element &element)
Returns
用於將游標位置重置到開頭的字串。

Definition at line 470 of file screen.cpp.

◆ ApplyShader()

void ApplyShader ( )

Definition at line 501 of file screen.cpp.

◆ cursor()

Cursor cursor ( ) const
inline

Definition at line 65 of file screen.hpp.

◆ SetCursor()

void SetCursor ( Cursor cursor)
inline

Definition at line 66 of file screen.hpp.

◆ RegisterHyperlink()

std::uint8_t RegisterHyperlink ( const std::string & link)

Definition at line 528 of file screen.cpp.

◆ Hyperlink()

const std::string & Hyperlink ( uint8_t id) const

Definition at line 541 of file screen.cpp.

◆ GetSelectionStyle()

const Screen::SelectionStyle & GetSelectionStyle ( ) const

返回當前選擇樣式。

See also
SetSelectionStyle

Definition at line 550 of file screen.cpp.

◆ SetSelectionStyle()

void SetSelectionStyle ( SelectionStyle decorator)

設置當前選擇樣式。

See also
GetSelectionStyle

Definition at line 556 of file screen.cpp.

◆ at() [1/2]

std::string & at ( int x,
int y )
inherited

存取給定位置的單元格中的字元。

Parameters
x沿 X 軸的單元格位置。
y沿 Y 軸的單元格位置。

Definition at line 29 of file image.cpp.

◆ at() [2/2]

const std::string & at ( int x,
int y ) const
inherited

存取給定位置的單元格中的字元。

Parameters
x沿 X 軸的單元格位置。
y沿 Y 軸的單元格位置。

Definition at line 36 of file image.cpp.

◆ PixelAt() [1/2]

Pixel & PixelAt ( int x,
int y )
inherited

存取給定位置的單元格 (Pixel)。

Parameters
x沿 X 軸的單元格位置。
y沿 Y 軸的單元格位置。

Definition at line 43 of file image.cpp.

◆ PixelAt() [2/2]

const Pixel & PixelAt ( int x,
int y ) const
inherited

存取給定位置的單元格 (Pixel)。

Parameters
x沿 X 軸的單元格位置。
y沿 Y 軸的單元格位置。

Definition at line 50 of file image.cpp.

◆ dimx()

int dimx ( ) const
inlineinherited

Definition at line 35 of file image.hpp.

◆ dimy()

int dimy ( ) const
inlineinherited

Definition at line 36 of file image.hpp.

Member Data Documentation

◆ cursor_

Cursor cursor_
protected

Definition at line 77 of file screen.hpp.

◆ hyperlinks_

std::vector<std::string> hyperlinks_ = {""}
protected

Definition at line 78 of file screen.hpp.

◆ selection_style_

SelectionStyle selection_style_
protected
Initial value:
= [](Pixel& pixel) {
pixel.inverted ^= true;
}

Definition at line 81 of file screen.hpp.

◆ stencil

Box stencil
inherited

Definition at line 41 of file image.hpp.

◆ dimx_

int dimx_
protectedinherited

Definition at line 44 of file image.hpp.

◆ dimy_

int dimy_
protectedinherited

Definition at line 45 of file image.hpp.

◆ pixels_

std::vector<std::vector<Pixel> > pixels_
protectedinherited

Definition at line 46 of file image.hpp.

◆ ftxui::Dimensions

struct ftxui::Dimensions

Dimensions 是一個表示終端機大小的結構

Definition at line 11 of file terminal.hpp.

Public Attributes

int dimx
 
int dimy
 

Member Data Documentation

◆ dimx

int dimx

Definition at line 12 of file terminal.hpp.

◆ dimy

int dimy

Definition at line 13 of file terminal.hpp.

Enumeration Type Documentation

◆ Color

enum Color

Color 是一個列舉,表示終端機的色彩支援

Enumerator
Palette1 
Palette16 
Palette256 
TrueColor 

Definition at line 22 of file terminal.hpp.

Function Documentation

◆ Size()

Dimensions Size ( )

獲取終端機大小。

Returns
終端機大小。

Definition at line 89 of file terminal.cpp.

◆ ColorSupport()

Color ColorSupport ( )

獲取終端機的顏色支援。

Definition at line 125 of file terminal.cpp.