YSTest: YRenderer.h 源文件

YSTest PreAlpha_b900_20201012 The YSLib Test Project

YRenderer.h
浏览该文件的文档.
1 /*
2 © 2011-2015, 2020 FrankHB.
3
4 This file is part of the YSLib project, and may only be used,
5 modified, and distributed under the terms of the YSLib project
6 license, LICENSE.TXT. By continuing to use, modify, or distribute
7 this file you indicate that you have read the license and
8 understand and accept it fully.
9 */
10
28 #ifndef YSL_INC_UI_YRenderer_h_
29 #define YSL_INC_UI_YRenderer_h_ 1
30
31 #include "YModules.h"
32 #include YFM_YSLib_UI_YComponent
33
34 namespace YSLib
35 {
36
37 namespace UI
38 {
39
46 class YF_API Renderer : public ystdex::cloneable
47 {
48 public:
49 DefDeCtor(Renderer)
50 DefDeCopyMoveCtorAssignment(Renderer)
51
52
56 virtual void
57 SetSize(const Size&)
58 {}
59
61 DefClone(const ImplI(ystdex::cloneable), Renderer)
62
63
66 virtual PDefH(Rect, CommitInvalidation, const Rect& r)
67 ImplRet(r)
68
77 virtual Rect
78 Paint(IWidget& wgt, PaintEventArgs&&);
79 };
80
81
86 class YF_API PseudoRenderer : public Renderer
87 {
88 public:
89 DefDeCtor(PseudoRenderer)
90 DefDeCopyMoveCtorAssignment(PseudoRenderer)
95 ~PseudoRenderer() override;
96
97 DefClone(const override, PseudoRenderer)
98
99 PDefH(Rect, Paint, IWidget&, PaintEventArgs&&) override
100 ImplRet({})
101 };
102
103
111 class YF_API BufferedRenderer : public Renderer
112 {
113 protected:
114 mutable Rect rInvalidated; \
116
120 unique_ptr<Drawing::IImage> pImageBuffer;
121
122 public:
127 bool IgnoreBackground;
128
134 BufferedRenderer(bool = {}, unique_ptr<Drawing::IImage> = {});
135 BufferedRenderer(const BufferedRenderer&);
136 DefDeMoveCtor(BufferedRenderer)
137
138
142 YB_ATTR_nodiscard YB_PURE bool
143 RequiresRefresh() const;
144
146 DefGetter(const ynothrow, Drawing::IImage&, ImageBuffer, *pImageBuffer)
150 DefGetter(const ynothrow, const Rect&, InvalidatedArea, rInvalidated)
156 DefGetterMem(const ynothrow, Graphics, Context, GetImageBuffer())
157
162 void
163 SetSize(const Size&) override;
165 void
166 SetImageBuffer(unique_ptr<Drawing::IImage>);
167
169 DefClone(const override, BufferedRenderer)
170
176 Rect
177 CommitInvalidation(const Rect&) override;
178
186 Rect
187 Paint(IWidget& wgt, PaintEventArgs&& e) override;
188
193 void
194 UpdateTo(const PaintContext&) const;
195
205 Rect
206 Validate(IWidget& wgt, IWidget& sender, const PaintContext&);
207 };
208
209 } // namespace UI;
210
211 } // namespace YSLib;
212
213 #endif
214
YB_ATTR_nodiscard
#define YB_ATTR_nodiscard
标记返回值不被忽略的属性。
Definition: ydef.h:715
DefClone
#define DefClone(_q, _t)
动态复制。
Definition: YBaseMacro.h:294
DefGetterMem
#define DefGetterMem(_q, _t, _n, _m)
Definition: YBaseMacro.h:247
YSLib::UI::BufferedRenderer::DefDeMoveCtor
DefDeMoveCtor(BufferedRenderer) YB_ATTR_nodiscard YB_PURE bool RequiresRefresh() const
判断是否需要刷新。
YSLib::UI::BufferedRenderer::IgnoreBackground
bool IgnoreBackground
指定验证时忽略上层缓冲区背景。
Definition: YRenderer.h:127
YSLib::UI::ynothrow
AView &y ynothrow
Definition: YWidgetView.cpp:47
YSLib::Drawing::Size
屏幕区域大小。
Definition: YGDIBase.h:536
YB_PURE
#define YB_PURE
指示函数或函数模板实例为纯函数。
Definition: ydef.h:919
YSLib::Drawing::r
The boundary is out of the const Graphics const Rect const Point const Point Color c const Rect const Rect & r
Definition: YDraw.h:174
YSLib::UI::BufferedRenderer::rInvalidated
Rect rInvalidated
无效区域：包含所有新绘制请求的区域（不一定是最小的）。
Definition: YRenderer.h:114
YSLib::UI::PDefH
PDefH(void, DisplayFor, IWidget &wgt, Timers::TimeSpan delay) ImplExpr(Show(wgt)
在一定时间内显示部件。
YSLib::UI::PseudoRenderer
伪渲染器：静态类型的所有实际操作不产生可观察的副作用。
Definition: YRenderer.h:87
YF_API
#define YF_API
Definition: Platform.h:56
YSLib::UI::BufferedRenderer::pImageBuffer
unique_ptr< Drawing::IImage > pImageBuffer
显示图像缓冲区指针。
Definition: YRenderer.h:120
ImplI
#define ImplI(...)
Definition: YBaseMacro.h:396
DefDeCopyMoveCtorAssignment
#define DefDeCopyMoveCtorAssignment(_t)
Definition: YBaseMacro.h:202
YSLib::Drawing::GGraphics
二维图形接口上下文模板。
Definition: YGraphics.h:63
YSLib::UI::BufferedRenderer::DefGetter
DefGetter(const ynothrow, Drawing::IImage &, ImageBuffer, *pImageBuffer) DefGetter(const ynothrow
取无效区域。
YSLib::UI::Renderer::DefClone
DefClone(const ImplI(ystdex::cloneable), Renderer) virtual PDefH(Rect
提交无效区域。
YSLib::UI::Renderer
部件渲染器。
Definition: YRenderer.h:47
YSLib::UI::e
void e
Definition: YWidget.h:356
YSLib::Drawing::Rect
屏幕标准矩形：表示屏幕矩形区域。
Definition: YGDIBase.h:788
YSLib
YSLib 命名空间。
Definition: AndroidHost.h:46
YSLib::UI::Renderer::DefDeCtor
DefDeCtor(Renderer) DefDeCopyMoveCtorAssignment(Renderer) virtual void SetSize(const Size &)
设置缓冲区大小。
Definition: YRenderer.h:49
YModules.h
YSLib 用户界面模块配置文件。
Context
ContextNode & Context
Definition: NPLA1Forms.cpp:488
NPL::SContext::Validate
YB_ATTR_nodiscard _tIn Validate(_tIn first, _tIn last)
遍历记号列表，验证基本合法性：圆括号是否对应。
Definition: SContext.h:1050
YSLib::UI::BufferedRenderer
带缓冲的部件渲染器。
Definition: YRenderer.h:112
YSLib::UI::wgt
IWidget & wgt
Definition: YControl.h:113
YSLib::UI::PaintEventArgs
部件绘制参数。
Definition: YWidgetEvent.h:330
YSLib::UI::BufferedRenderer::BufferedRenderer
BufferedRenderer(bool={}, unique_ptr< Drawing::IImage >={})
构造：指定是否忽略上层缓冲区背景。
DefGetter
#define DefGetter(_q, _t, _n,...)
Definition: YBaseMacro.h:241
YSLib::UI::PseudoRenderer::DefClone
DefClone(const override, PseudoRenderer) PDefH(Rect
const
const Decapsulate const Decapsulate &y ynothrow ContextNode &ctx const
Definition: NPLA1Forms.cpp:1629
YSLib::UI::Paint
@ Paint
界面绘制。
Definition: YWidgetEvent.h:427
YSLib::UI::PseudoRenderer::DefDeCtor
DefDeCtor(PseudoRenderer) DefDeCopyMoveCtorAssignment(PseudoRenderer) ~PseudoRenderer() override
虚析构：类定义外默认实现。
YSLib::UI::ImplRet
const IWidget &wgt ImplRet(wgt.GetView().IsVisible()) YB_ATTR_nodiscard YB_PURE bool YF_API Contains(const IWidget &
判断点是否在部件的可视区域内。
ystdex::bases::cloneable
可动态复制的抽象基类。
Definition: base.h:126