FTXUI 6.1.9
C++ functional terminal UI.
Loading...
Searching...
No Matches
inverted.cpp
Go to the documentation of this file.
1// Copyright 2020 Arthur Sonzogni. 保留所有權利。
2// 本原始碼的使用受 MIT 授權條款約束,該條款可在
3// LICENSE 檔案中找到。
4#include <memory> // for make_shared
5#include <utility> // for move
6
7#include "ftxui/dom/elements.hpp" // for Element, inverted
8#include "ftxui/dom/node.hpp" // for Node
9#include "ftxui/dom/node_decorator.hpp" // for NodeDecorator
10#include "ftxui/screen/box.hpp" // for Box
11#include "ftxui/screen/screen.hpp" // for Pixel, Screen
12
13namespace ftxui {
14
15namespace {
16class Inverted : public NodeDecorator {
17 public:
19
20 void Render(Screen& screen) override {
21 Node::Render(screen);
22 for (int y = box_.y_min; y <= box_.y_max; ++y) {
23 for (int x = box_.x_min; x <= box_.x_max; ++x) {
24 screen.PixelAt(x, y).inverted ^= true;
25 }
26 }
27 }
28};
29} // namespace
30
31/// @brief 添加一個濾鏡,它將反轉前景和背景
32/// 顏色。
33/// @ingroup dom
35 return std::make_shared<Inverted>(std::move(child));
36}
37
38} // namespace ftxui
NodeDecorator(Element child)
friend void Render(Screen &screen, Node *node, Selection &selection)
Element inverted(Element)
添加一個濾鏡,它將反轉前景和背景 顏色。
Definition inverted.cpp:34
FTXUI 的 ftxui:: 命名空間
Definition animation.hpp:10
std::shared_ptr< Node > Element
Definition elements.hpp:22
void Render(Screen &screen, const Element &element)