| 
									
										
										
										
											2019-08-16 00:50:54 +08:00
										 |  |  |  | // Copyright (c) 2016-2019 Kiwano - Nomango
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | //
 | 
					
						
							| 
									
										
										
										
											2019-08-16 00:50:54 +08:00
										 |  |  |  | // Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
					
						
							|  |  |  |  | // of this software and associated documentation files (the "Software"), to deal
 | 
					
						
							|  |  |  |  | // in the Software without restriction, including without limitation the rights
 | 
					
						
							|  |  |  |  | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 | 
					
						
							|  |  |  |  | // copies of the Software, and to permit persons to whom the Software is
 | 
					
						
							|  |  |  |  | // furnished to do so, subject to the following conditions:
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | //
 | 
					
						
							| 
									
										
										
										
											2019-08-16 00:50:54 +08:00
										 |  |  |  | // The above copyright notice and this permission notice shall be included in
 | 
					
						
							|  |  |  |  | // all copies or substantial portions of the Software.
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | //
 | 
					
						
							| 
									
										
										
										
											2019-08-16 00:50:54 +08:00
										 |  |  |  | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
					
						
							|  |  |  |  | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
					
						
							|  |  |  |  | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 | 
					
						
							|  |  |  |  | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 | 
					
						
							|  |  |  |  | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 | 
					
						
							|  |  |  |  | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 | 
					
						
							|  |  |  |  | // THE SOFTWARE.
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | #pragma once
 | 
					
						
							| 
									
										
										
										
											2019-12-27 10:51:34 +08:00
										 |  |  |  | #include <kiwano/core/ObjectBase.h>
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | #include <kiwano/core/Time.h>
 | 
					
						
							| 
									
										
										
										
											2020-01-17 16:55:47 +08:00
										 |  |  |  | #include <kiwano/render/Brush.h>
 | 
					
						
							| 
									
										
										
										
											2020-02-05 19:56:22 +08:00
										 |  |  |  | #include <kiwano/render/Shape.h>
 | 
					
						
							| 
									
										
										
										
											2020-01-17 16:55:47 +08:00
										 |  |  |  | #include <kiwano/render/LayerArea.h>
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | #include <kiwano/render/TextLayout.h>
 | 
					
						
							|  |  |  |  | #include <kiwano/render/Texture.h>
 | 
					
						
							| 
									
										
										
										
											2020-01-21 11:05:28 +08:00
										 |  |  |  | #include <kiwano/render/DirectX/TextRenderer.h>
 | 
					
						
							| 
									
										
										
										
											2019-08-16 00:50:54 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace kiwano | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | class Renderer; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | KGE_DECLARE_SMART_PTR(RenderContext); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /**
 | 
					
						
							|  |  |  |  |  * \addtogroup Render | 
					
						
							|  |  |  |  |  * @{ | 
					
						
							|  |  |  |  |  */ | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /// \~chinese
 | 
					
						
							|  |  |  |  | /// @brief <20><><EFBFBD>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD>ģʽ
 | 
					
						
							|  |  |  |  | enum class TextAntialiasMode | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     Default,    ///< ϵͳĬ<CDB3><C4AC>
 | 
					
						
							|  |  |  |  |     ClearType,  ///< ClearType <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     GrayScale,  ///< <20>Ҷȿ<D2B6><C8BF><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     None        ///< <20><><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /// \~chinese
 | 
					
						
							|  |  |  |  | /// @brief <20><>Ⱦ<EFBFBD><C8BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | /// @details
 | 
					
						
							|  |  |  |  | /// <20><>Ⱦ<EFBFBD><C8BE><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD><EFBFBD>ɻ<EFBFBD><C9BB><EFBFBD>ͼԪ<CDBC>Ļ<EFBFBD><C4BB>ƣ<EFBFBD><C6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><D8B6><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>У<EFBFBD><D0A3>細<EFBFBD>ڻ<EFBFBD><DABB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | class KGE_API RenderContext : public virtual ObjectBase | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     friend class Renderer; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | public: | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20>Ƿ<EFBFBD><C7B7><EFBFBD>Ч
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     virtual bool IsValid() const = 0; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-08 00:17:31 +08:00
										 |  |  |  |     /// @brief <20><>ʼ<EFBFBD><CABC>Ⱦ
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     virtual void BeginDraw(); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-08 00:17:31 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱦ
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     virtual void EndDraw(); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-08 00:17:31 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     /// @param texture <20><><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     /// @param src_rect Դ<><D4B4><EFBFBD><EFBFBD><EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     /// @param dest_rect <20><><EFBFBD>Ƶ<EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     virtual void DrawTexture(Texture const& texture, const Rect* src_rect = nullptr, | 
					
						
							|  |  |  |  |                              const Rect* dest_rect = nullptr) = 0; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-08 00:17:31 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     /// @param layout <20>ı<EFBFBD><C4B1><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     /// @param offset ƫ<><C6AB><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     virtual void DrawTextLayout(TextLayout const& layout, Point const& offset = Point()) = 0; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-08 00:17:31 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״<EFBFBD><D7B4><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     /// @param shape <20><>״
 | 
					
						
							|  |  |  |  |     /// @param stroke <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
 | 
					
						
							|  |  |  |  |     /// @param stroke_width <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     virtual void DrawShape(Shape const& shape, StrokeStylePtr stroke = nullptr, float stroke_width = 1.0f) = 0; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-08 00:17:31 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD>
 | 
					
						
							|  |  |  |  |     /// @param point1 <20>߶<EFBFBD><DFB6><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     /// @param point2 <20>߶<EFBFBD><DFB6>յ<EFBFBD>
 | 
					
						
							|  |  |  |  |     /// @param stroke <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
 | 
					
						
							|  |  |  |  |     /// @param stroke_width <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     virtual void DrawLine(Point const& point1, Point const& point2, StrokeStylePtr stroke = nullptr, | 
					
						
							|  |  |  |  |                           float stroke_width = 1.0f) = 0; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-08 00:17:31 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD>ƾ<EFBFBD><C6BE>α߿<CEB1>
 | 
					
						
							|  |  |  |  |     /// @param rect <20><><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     /// @param stroke <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
 | 
					
						
							|  |  |  |  |     /// @param stroke_width <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     virtual void DrawRectangle(Rect const& rect, StrokeStylePtr stroke = nullptr, float stroke_width = 1.0f) = 0; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-08 00:17:31 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD>Բ<EFBFBD>Ǿ<EFBFBD><C7BE>α߿<CEB1>
 | 
					
						
							|  |  |  |  |     /// @param rect <20><><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     /// @param radius Բ<>ǰ뾶
 | 
					
						
							|  |  |  |  |     /// @param stroke <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
 | 
					
						
							|  |  |  |  |     /// @param stroke_width <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     virtual void DrawRoundedRectangle(Rect const& rect, Vec2 const& radius, StrokeStylePtr stroke = nullptr, | 
					
						
							|  |  |  |  |                                       float stroke_width = 1.0f) = 0; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-08 00:17:31 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Բ<EFBFBD>߿<EFBFBD>
 | 
					
						
							|  |  |  |  |     /// @param center Բ<><D4B2>
 | 
					
						
							|  |  |  |  |     /// @param radius <20><>Բ<EFBFBD>뾶
 | 
					
						
							|  |  |  |  |     /// @param stroke <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
 | 
					
						
							|  |  |  |  |     /// @param stroke_width <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     virtual void DrawEllipse(Point const& center, Vec2 const& radius, StrokeStylePtr stroke = nullptr, | 
					
						
							|  |  |  |  |                              float stroke_width = 1.0f) = 0; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-08 00:17:31 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״
 | 
					
						
							|  |  |  |  |     /// @param shape <20><>״
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     virtual void FillShape(Shape const& shape) = 0; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-08 00:17:31 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     /// @param rect <20><><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     virtual void FillRectangle(Rect const& rect) = 0; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-08 00:17:31 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD>Բ<EFBFBD>Ǿ<EFBFBD><C7BE><EFBFBD>
 | 
					
						
							|  |  |  |  |     /// @param rect <20><><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     /// @param radius Բ<>ǰ뾶
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     virtual void FillRoundedRectangle(Rect const& rect, Vec2 const& radius) = 0; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-08 00:17:31 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Բ
 | 
					
						
							|  |  |  |  |     /// @param center Բ<><D4B2>
 | 
					
						
							|  |  |  |  |     /// @param radius <20><>Բ<EFBFBD>뾶
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     virtual void FillEllipse(Point const& center, Vec2 const& radius) = 0; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-08 00:17:31 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     /// @param texture <20><><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     /// @param size <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD>С
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     virtual void CreateTexture(Texture& texture, math::Vec2T<uint32_t> size) = 0; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-08 00:17:31 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD>û<EFBFBD><C3BB>ƵIJü<C4B2><C3BC><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     /// @param clip_rect <20>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     virtual void PushClipRect(Rect const& clip_rect) = 0; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-08 00:17:31 +08:00
										 |  |  |  |     /// @brief ȡ<><C8A1><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>õĻ<C3B5><C4BB>Ʋü<C6B2><C3BC><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     virtual void PopClipRect() = 0; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-08 00:17:31 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     /// @param layer ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     virtual void PushLayer(LayerArea& layer) = 0; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-08 00:17:31 +08:00
										 |  |  |  |     /// @brief ȡ<><C8A1><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     virtual void PopLayer() = 0; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-08 00:17:31 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱦ<EFBFBD><C8BE><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     virtual void Clear() = 0; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-08 00:17:31 +08:00
										 |  |  |  |     /// @brief ʹ<>ô<EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱦ<EFBFBD><C8BE><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     /// @param clear_color <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     virtual void Clear(Color const& clear_color) = 0; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-08 00:17:31 +08:00
										 |  |  |  |     /// @brief <20><>ȡ<EFBFBD><C8A1>Ⱦ<EFBFBD><C8BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     virtual Size GetSize() const = 0; | 
					
						
							| 
									
										
										
										
											2020-02-08 00:17:31 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><>ȡ<EFBFBD><C8A1>ˢ<CBA2><CDB8><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     virtual float GetBrushOpacity() const; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-08 00:17:31 +08:00
										 |  |  |  |     /// @brief <20><>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0>ˢ
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     virtual BrushPtr GetCurrentBrush() const; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-08 00:17:31 +08:00
										 |  |  |  |     /// @brief <20><>ȡȫ<C8A1>ֶ<EFBFBD>ά<EFBFBD>任
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     virtual const Matrix3x2& GetGlobalTransform() const; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-08 00:17:31 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD>û<EFBFBD>ˢ<CBA2><CDB8><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     virtual void SetBrushOpacity(float opacity); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-08 00:17:31 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD>õ<EFBFBD>ǰ<EFBFBD><C7B0>ˢ
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     virtual void SetCurrentBrush(BrushPtr brush); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD>ÿ<EFBFBD><C3BF><EFBFBD><EFBFBD><EFBFBD>ģʽ
 | 
					
						
							|  |  |  |  |     virtual void SetAntialiasMode(bool enabled) = 0; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD><D6BF><EFBFBD><EFBFBD><EFBFBD>ģʽ
 | 
					
						
							|  |  |  |  |     virtual void SetTextAntialiasMode(TextAntialiasMode mode) = 0; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD>߽<EFBFBD><DFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     virtual bool CheckVisibility(Rect const& bounds, Matrix3x2 const& transform) = 0; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ⱦ<EFBFBD><C8BE><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD>С
 | 
					
						
							|  |  |  |  |     virtual void Resize(Size const& size) = 0; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵĶ<C4B5>ά<EFBFBD>任
 | 
					
						
							|  |  |  |  |     virtual void SetTransform(const Matrix3x2& matrix) = 0; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD>ȫ<EFBFBD>ֶ<EFBFBD>ά<EFBFBD>任
 | 
					
						
							|  |  |  |  |     virtual void SetGlobalTransform(const Matrix3x2& matrix); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD>ȫ<EFBFBD>ֶ<EFBFBD>ά<EFBFBD>任
 | 
					
						
							|  |  |  |  |     virtual void SetGlobalTransform(const Matrix3x2* matrix); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | public: | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><>Ⱦ<EFBFBD><C8BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
 | 
					
						
							|  |  |  |  |     struct Status | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         uint32_t primitives;  ///< <20><>ȾͼԪ<CDBC><D4AA><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |         Time     start;       ///< <20><>Ⱦ<EFBFBD><C8BE>ʼʱ<CABC><CAB1>
 | 
					
						
							|  |  |  |  |         Duration duration;    ///< <20><>Ⱦʱ<C8BE><CAB1>
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         Status(); | 
					
						
							|  |  |  |  |     }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>״̬<D7B4>ռ<EFBFBD><D5BC><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     void SetCollectingStatus(bool enable); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><>ȡ<EFBFBD><C8A1>Ⱦ<EFBFBD><C8BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
 | 
					
						
							|  |  |  |  |     Status const& GetStatus() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | protected: | 
					
						
							|  |  |  |  |     RenderContext(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȾͼԪ<CDBC><D4AA><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     void IncreasePrimitivesCount(uint32_t increase = 1) const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-09 18:41:59 +08:00
										 |  |  |  | protected: | 
					
						
							| 
									
										
										
										
											2020-02-03 14:15:30 +08:00
										 |  |  |  |     bool              antialias_; | 
					
						
							|  |  |  |  |     bool              fast_global_transform_; | 
					
						
							|  |  |  |  |     mutable bool      collecting_status_; | 
					
						
							|  |  |  |  |     float             brush_opacity_; | 
					
						
							|  |  |  |  |     TextAntialiasMode text_antialias_; | 
					
						
							|  |  |  |  |     BrushPtr          current_brush_; | 
					
						
							|  |  |  |  |     Rect              visible_size_; | 
					
						
							|  |  |  |  |     Matrix3x2         global_transform_; | 
					
						
							|  |  |  |  |     mutable Status    status_; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /** @} */ | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | inline RenderContext::Status::Status() | 
					
						
							|  |  |  |  |     : primitives(0) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | inline RenderContext::Status const& RenderContext::GetStatus() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return status_; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | }  // namespace kiwano
 |