Layer rename to LayerActor & LayerArea rename to Layer
This commit is contained in:
		
							parent
							
								
									f1b62daa9e
								
							
						
					
					
						commit
						a96dfc8299
					
				|  | @ -31,7 +31,7 @@ | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\DebugActor.h" /> |     <ClInclude Include="..\..\src\kiwano\2d\DebugActor.h" /> | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\FrameSequence.h" /> |     <ClInclude Include="..\..\src\kiwano\2d\FrameSequence.h" /> | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\ShapeActor.h" /> |     <ClInclude Include="..\..\src\kiwano\2d\ShapeActor.h" /> | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\Layer.h" /> |     <ClInclude Include="..\..\src\kiwano\2d\LayerActor.h" /> | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\Actor.h" /> |     <ClInclude Include="..\..\src\kiwano\2d\Actor.h" /> | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\Stage.h" /> |     <ClInclude Include="..\..\src\kiwano\2d\Stage.h" /> | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\Sprite.h" /> |     <ClInclude Include="..\..\src\kiwano\2d\Sprite.h" /> | ||||||
|  | @ -81,7 +81,7 @@ | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\Shape.h" /> |     <ClInclude Include="..\..\src\kiwano\render\Shape.h" /> | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\ShapeSink.h" /> |     <ClInclude Include="..\..\src\kiwano\render\ShapeSink.h" /> | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\GifImage.h" /> |     <ClInclude Include="..\..\src\kiwano\render\GifImage.h" /> | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\LayerArea.h" /> |     <ClInclude Include="..\..\src\kiwano\render\Layer.h" /> | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\RenderContext.h" /> |     <ClInclude Include="..\..\src\kiwano\render\RenderContext.h" /> | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\Renderer.h" /> |     <ClInclude Include="..\..\src\kiwano\render\Renderer.h" /> | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\StrokeStyle.h" /> |     <ClInclude Include="..\..\src\kiwano\render\StrokeStyle.h" /> | ||||||
|  | @ -109,7 +109,7 @@ | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\FrameSequence.cpp" /> |     <ClCompile Include="..\..\src\kiwano\2d\FrameSequence.cpp" /> | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\ShapeActor.cpp" /> |     <ClCompile Include="..\..\src\kiwano\2d\ShapeActor.cpp" /> | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\GifSprite.cpp" /> |     <ClCompile Include="..\..\src\kiwano\2d\GifSprite.cpp" /> | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\Layer.cpp" /> |     <ClCompile Include="..\..\src\kiwano\2d\LayerActor.cpp" /> | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\Actor.cpp" /> |     <ClCompile Include="..\..\src\kiwano\2d\Actor.cpp" /> | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\Stage.cpp" /> |     <ClCompile Include="..\..\src\kiwano\2d\Stage.cpp" /> | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\Sprite.cpp" /> |     <ClCompile Include="..\..\src\kiwano\2d\Sprite.cpp" /> | ||||||
|  | @ -154,7 +154,7 @@ | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\Shape.cpp" /> |     <ClCompile Include="..\..\src\kiwano\render\Shape.cpp" /> | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\ShapeSink.cpp" /> |     <ClCompile Include="..\..\src\kiwano\render\ShapeSink.cpp" /> | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\GifImage.cpp" /> |     <ClCompile Include="..\..\src\kiwano\render\GifImage.cpp" /> | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\LayerArea.cpp" /> |     <ClCompile Include="..\..\src\kiwano\render\Layer.cpp" /> | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\RenderContext.cpp" /> |     <ClCompile Include="..\..\src\kiwano\render\RenderContext.cpp" /> | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\Renderer.cpp" /> |     <ClCompile Include="..\..\src\kiwano\render\Renderer.cpp" /> | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\StrokeStyle.cpp" /> |     <ClCompile Include="..\..\src\kiwano\render\StrokeStyle.cpp" /> | ||||||
|  |  | ||||||
|  | @ -36,9 +36,6 @@ | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\Canvas.h"> |     <ClInclude Include="..\..\src\kiwano\2d\Canvas.h"> | ||||||
|       <Filter>2d</Filter> |       <Filter>2d</Filter> | ||||||
|     </ClInclude> |     </ClInclude> | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\Layer.h"> |  | ||||||
|       <Filter>2d</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\2d\Sprite.h"> |     <ClInclude Include="..\..\src\kiwano\2d\Sprite.h"> | ||||||
|       <Filter>2d</Filter> |       <Filter>2d</Filter> | ||||||
|     </ClInclude> |     </ClInclude> | ||||||
|  | @ -216,9 +213,6 @@ | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\GifImage.h"> |     <ClInclude Include="..\..\src\kiwano\render\GifImage.h"> | ||||||
|       <Filter>render</Filter> |       <Filter>render</Filter> | ||||||
|     </ClInclude> |     </ClInclude> | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\LayerArea.h"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClInclude> |  | ||||||
|     <ClInclude Include="..\..\src\kiwano\render\RenderContext.h"> |     <ClInclude Include="..\..\src\kiwano\render\RenderContext.h"> | ||||||
|       <Filter>render</Filter> |       <Filter>render</Filter> | ||||||
|     </ClInclude> |     </ClInclude> | ||||||
|  | @ -303,14 +297,17 @@ | ||||||
|     <ClInclude Include="..\..\src\kiwano\core\Exception.h"> |     <ClInclude Include="..\..\src\kiwano\core\Exception.h"> | ||||||
|       <Filter>core</Filter> |       <Filter>core</Filter> | ||||||
|     </ClInclude> |     </ClInclude> | ||||||
|  |     <ClInclude Include="..\..\src\kiwano\2d\LayerActor.h"> | ||||||
|  |       <Filter>2d</Filter> | ||||||
|  |     </ClInclude> | ||||||
|  |     <ClInclude Include="..\..\src\kiwano\render\Layer.h"> | ||||||
|  |       <Filter>render</Filter> | ||||||
|  |     </ClInclude> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
|   <ItemGroup> |   <ItemGroup> | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\Canvas.cpp"> |     <ClCompile Include="..\..\src\kiwano\2d\Canvas.cpp"> | ||||||
|       <Filter>2d</Filter> |       <Filter>2d</Filter> | ||||||
|     </ClCompile> |     </ClCompile> | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\Layer.cpp"> |  | ||||||
|       <Filter>2d</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\2d\Sprite.cpp"> |     <ClCompile Include="..\..\src\kiwano\2d\Sprite.cpp"> | ||||||
|       <Filter>2d</Filter> |       <Filter>2d</Filter> | ||||||
|     </ClCompile> |     </ClCompile> | ||||||
|  | @ -458,9 +455,6 @@ | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\GifImage.cpp"> |     <ClCompile Include="..\..\src\kiwano\render\GifImage.cpp"> | ||||||
|       <Filter>render</Filter> |       <Filter>render</Filter> | ||||||
|     </ClCompile> |     </ClCompile> | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\LayerArea.cpp"> |  | ||||||
|       <Filter>render</Filter> |  | ||||||
|     </ClCompile> |  | ||||||
|     <ClCompile Include="..\..\src\kiwano\render\RenderContext.cpp"> |     <ClCompile Include="..\..\src\kiwano\render\RenderContext.cpp"> | ||||||
|       <Filter>render</Filter> |       <Filter>render</Filter> | ||||||
|     </ClCompile> |     </ClCompile> | ||||||
|  | @ -515,5 +509,11 @@ | ||||||
|     <ClCompile Include="..\..\src\kiwano\core\Exception.cpp"> |     <ClCompile Include="..\..\src\kiwano\core\Exception.cpp"> | ||||||
|       <Filter>core</Filter> |       <Filter>core</Filter> | ||||||
|     </ClCompile> |     </ClCompile> | ||||||
|  |     <ClCompile Include="..\..\src\kiwano\2d\LayerActor.cpp"> | ||||||
|  |       <Filter>2d</Filter> | ||||||
|  |     </ClCompile> | ||||||
|  |     <ClCompile Include="..\..\src\kiwano\render\Layer.cpp"> | ||||||
|  |       <Filter>render</Filter> | ||||||
|  |     </ClCompile> | ||||||
|   </ItemGroup> |   </ItemGroup> | ||||||
| </Project> | </Project> | ||||||
|  | @ -35,7 +35,7 @@ using ImGuiPipeline = Function<void()>; | ||||||
|  * \~chinese |  * \~chinese | ||||||
|  * @brief ImGui图层 |  * @brief ImGui图层 | ||||||
|  */ |  */ | ||||||
| class ImGuiLayer : public Layer | class ImGuiLayer : public LayerActor | ||||||
| { | { | ||||||
| public: | public: | ||||||
|     /// \~chinese
 |     /// \~chinese
 | ||||||
|  |  | ||||||
|  | @ -95,13 +95,13 @@ void Canvas::SetBrushTransform(Matrix3x2 const& transform) | ||||||
|     ctx_->SetTransform(transform); |     ctx_->SetTransform(transform); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Canvas::PushLayerArea(LayerArea& area) | void Canvas::PushLayer(Layer& layer) | ||||||
| { | { | ||||||
|     KGE_ASSERT(ctx_); |     KGE_ASSERT(ctx_); | ||||||
|     ctx_->PushLayer(area); |     ctx_->PushLayer(layer); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Canvas::PopLayerArea() | void Canvas::PopLayer() | ||||||
| { | { | ||||||
|     KGE_ASSERT(ctx_); |     KGE_ASSERT(ctx_); | ||||||
|     ctx_->PopLayer(); |     ctx_->PopLayer(); | ||||||
|  |  | ||||||
|  | @ -240,12 +240,12 @@ public: | ||||||
| 
 | 
 | ||||||
|     /// \~chinese
 |     /// \~chinese
 | ||||||
|     /// @brief 添加一个图层
 |     /// @brief 添加一个图层
 | ||||||
|     /// @param area 图层区域
 |     /// @param layer 图层
 | ||||||
|     void PushLayerArea(LayerArea& area); |     void PushLayer(Layer& layer); | ||||||
| 
 | 
 | ||||||
|     /// \~chinese
 |     /// \~chinese
 | ||||||
|     /// @brief 删除最近添加的图层
 |     /// @brief 删除最近添加的图层
 | ||||||
|     void PopLayerArea(); |     void PopLayer(); | ||||||
| 
 | 
 | ||||||
|     /// \~chinese
 |     /// \~chinese
 | ||||||
|     /// @brief 添加一个裁剪区域
 |     /// @brief 添加一个裁剪区域
 | ||||||
|  |  | ||||||
|  | @ -19,47 +19,47 @@ | ||||||
| // THE SOFTWARE.
 | // THE SOFTWARE.
 | ||||||
| 
 | 
 | ||||||
| #pragma once | #pragma once | ||||||
| #include <kiwano/2d/Layer.h> | #include <kiwano/2d/LayerActor.h> | ||||||
| #include <kiwano/render/Renderer.h> | #include <kiwano/render/Renderer.h> | ||||||
| 
 | 
 | ||||||
| namespace kiwano | namespace kiwano | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
| LayerPtr Layer::Create() | LayerActorPtr LayerActor::Create() | ||||||
| { | { | ||||||
|     LayerPtr ptr = new (std::nothrow) Layer; |     LayerActorPtr ptr = new (std::nothrow) LayerActor; | ||||||
|     return ptr; |     return ptr; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Layer::Layer() | LayerActor::LayerActor() | ||||||
|     : swallow_(false) |     : swallow_(false) | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| Layer::~Layer() {} | LayerActor::~LayerActor() {} | ||||||
| 
 | 
 | ||||||
| void Layer::SetClipRect(Rect const& clip_rect) | void LayerActor::SetClipRect(Rect const& clip_rect) | ||||||
| { | { | ||||||
|     area_.SetAreaRect(clip_rect); |     layer_.SetClipRect(clip_rect); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Layer::SetOpacity(float opacity) | void LayerActor::SetOpacity(float opacity) | ||||||
| { | { | ||||||
|     // Actor::SetOpacity(opacity);
 |     // Actor::SetOpacity(opacity);
 | ||||||
|     area_.SetOpacity(opacity); |     layer_.SetOpacity(opacity); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Layer::SetMaskShape(ShapePtr mask) | void LayerActor::SetMaskShape(ShapePtr mask) | ||||||
| { | { | ||||||
|     area_.SetMaskShape(mask); |     layer_.SetMaskShape(mask); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Layer::SetMaskTransform(Matrix3x2 const& transform) | void LayerActor::SetMaskTransform(Matrix3x2 const& transform) | ||||||
| { | { | ||||||
|     area_.SetMaskTransform(transform); |     layer_.SetMaskTransform(transform); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool Layer::DispatchEvent(Event* evt) | bool LayerActor::DispatchEvent(Event* evt) | ||||||
| { | { | ||||||
|     if (!IsVisible()) |     if (!IsVisible()) | ||||||
|         return true; |         return true; | ||||||
|  | @ -71,18 +71,18 @@ bool Layer::DispatchEvent(Event* evt) | ||||||
|     return Actor::DispatchEvent(evt); |     return Actor::DispatchEvent(evt); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void Layer::Render(RenderContext& ctx) | void LayerActor::Render(RenderContext& ctx) | ||||||
| { | { | ||||||
|     ctx.PushLayer(area_); |     ctx.PushLayer(layer_); | ||||||
| 
 | 
 | ||||||
|     Actor::Render(ctx); |     Actor::Render(ctx); | ||||||
| 
 | 
 | ||||||
|     ctx.PopLayer(); |     ctx.PopLayer(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool Layer::CheckVisibility(RenderContext& ctx) const | bool LayerActor::CheckVisibility(RenderContext& ctx) const | ||||||
| { | { | ||||||
|     // Do not need to render Layer
 |     // Do not need to render LayerActor
 | ||||||
|     return false; |     return false; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -20,12 +20,12 @@ | ||||||
| 
 | 
 | ||||||
| #pragma once | #pragma once | ||||||
| #include <kiwano/2d/Actor.h> | #include <kiwano/2d/Actor.h> | ||||||
| #include <kiwano/render/LayerArea.h> | #include <kiwano/render/Layer.h> | ||||||
| #include <kiwano/render/RenderContext.h> | #include <kiwano/render/RenderContext.h> | ||||||
| 
 | 
 | ||||||
| namespace kiwano | namespace kiwano | ||||||
| { | { | ||||||
| KGE_DECLARE_SMART_PTR(Layer); | KGE_DECLARE_SMART_PTR(LayerActor); | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  * \addtogroup Actors |  * \addtogroup Actors | ||||||
|  | @ -36,16 +36,16 @@ KGE_DECLARE_SMART_PTR(Layer); | ||||||
|  * \~chinese |  * \~chinese | ||||||
|  * @brief 图层 |  * @brief 图层 | ||||||
|  */ |  */ | ||||||
| class KGE_API Layer : public Actor | class KGE_API LayerActor : public Actor | ||||||
| { | { | ||||||
| public: | public: | ||||||
|     /// \~chinese
 |     /// \~chinese
 | ||||||
|     /// @brief 创建图层
 |     /// @brief 创建图层
 | ||||||
|     static LayerPtr Create(); |     static LayerActorPtr Create(); | ||||||
| 
 | 
 | ||||||
|     Layer(); |     LayerActor(); | ||||||
| 
 | 
 | ||||||
|     virtual ~Layer(); |     virtual ~LayerActor(); | ||||||
| 
 | 
 | ||||||
|     /// \~chinese
 |     /// \~chinese
 | ||||||
|     /// @brief 是否开启消息吞没
 |     /// @brief 是否开启消息吞没
 | ||||||
|  | @ -79,11 +79,11 @@ public: | ||||||
|     /// \~chinese
 |     /// \~chinese
 | ||||||
|     /// @brief 设置图层区域
 |     /// @brief 设置图层区域
 | ||||||
|     /// @param area 图层区域属性
 |     /// @param area 图层区域属性
 | ||||||
|     void SetArea(LayerArea const& area); |     void SetLayer(Layer const& layer); | ||||||
| 
 | 
 | ||||||
|     /// \~chinese
 |     /// \~chinese
 | ||||||
|     /// @brief 获取图层区域
 |     /// @brief 获取图层区域
 | ||||||
|     LayerArea const& GetArea() const; |     Layer const& GetLayer() const; | ||||||
| 
 | 
 | ||||||
|     bool DispatchEvent(Event* evt) override; |     bool DispatchEvent(Event* evt) override; | ||||||
| 
 | 
 | ||||||
|  | @ -94,28 +94,28 @@ protected: | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     bool  swallow_; |     bool  swallow_; | ||||||
|     LayerArea area_; |     Layer layer_; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| /** @} */ | /** @} */ | ||||||
| 
 | 
 | ||||||
| inline bool Layer::IsSwallowEventsEnabled() const | inline bool LayerActor::IsSwallowEventsEnabled() const | ||||||
| { | { | ||||||
|     return swallow_; |     return swallow_; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| inline void Layer::SetSwallowEvents(bool enabled) | inline void LayerActor::SetSwallowEvents(bool enabled) | ||||||
| { | { | ||||||
|     swallow_ = enabled; |     swallow_ = enabled; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| inline void Layer::SetArea(LayerArea const& area) | inline void LayerActor::SetLayer(Layer const& layer) | ||||||
| { | { | ||||||
|     area_ = area; |     layer_ = layer; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| inline LayerArea const& Layer::GetArea() const | inline Layer const& LayerActor::GetLayer() const | ||||||
| { | { | ||||||
|     return area_; |     return layer_; | ||||||
| } | } | ||||||
| }  // namespace kiwano
 | }  // namespace kiwano
 | ||||||
|  | @ -62,12 +62,12 @@ void Transition::Init(StagePtr prev, StagePtr next) | ||||||
| 
 | 
 | ||||||
|     if (in_stage_) |     if (in_stage_) | ||||||
|     { |     { | ||||||
|         in_layer_.SetAreaRect(Rect{ Point(), window_size_ }); |         in_layer_.SetClipRect(Rect{ Point(), window_size_ }); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (out_stage_) |     if (out_stage_) | ||||||
|     { |     { | ||||||
|         out_layer_.SetAreaRect(Rect{ Point(), window_size_ }); |         out_layer_.SetClipRect(Rect{ Point(), window_size_ }); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -151,14 +151,14 @@ void BoxTransition::Update(Duration dt) | ||||||
| 
 | 
 | ||||||
|     if (process_ < .5f) |     if (process_ < .5f) | ||||||
|     { |     { | ||||||
|         out_layer_.SetAreaRect(Rect(window_size_.x * process_, window_size_.y * process_, |         out_layer_.SetClipRect(Rect(window_size_.x * process_, window_size_.y * process_, | ||||||
|                                     window_size_.x * (1 - process_), window_size_.y * (1 - process_))); |                                     window_size_.x * (1 - process_), window_size_.y * (1 - process_))); | ||||||
|     } |     } | ||||||
|     else |     else | ||||||
|     { |     { | ||||||
|         out_layer_.SetOpacity(0.f); |         out_layer_.SetOpacity(0.f); | ||||||
|         in_layer_.SetOpacity(1.f); |         in_layer_.SetOpacity(1.f); | ||||||
|         in_layer_.SetAreaRect(Rect(window_size_.x * (1 - process_), window_size_.y * (1 - process_), |         in_layer_.SetClipRect(Rect(window_size_.x * (1 - process_), window_size_.y * (1 - process_), | ||||||
|                                    window_size_.x * process_, window_size_.y * process_)); |                                    window_size_.x * process_, window_size_.y * process_)); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -20,7 +20,7 @@ | ||||||
| 
 | 
 | ||||||
| #pragma once | #pragma once | ||||||
| #include <kiwano/2d/Stage.h> | #include <kiwano/2d/Stage.h> | ||||||
| #include <kiwano/render/LayerArea.h> | #include <kiwano/render/Layer.h> | ||||||
| 
 | 
 | ||||||
| namespace kiwano | namespace kiwano | ||||||
| { | { | ||||||
|  | @ -102,8 +102,8 @@ protected: | ||||||
|     Size      window_size_; |     Size      window_size_; | ||||||
|     StagePtr  out_stage_; |     StagePtr  out_stage_; | ||||||
|     StagePtr  in_stage_; |     StagePtr  in_stage_; | ||||||
|     LayerArea out_layer_; |     Layer out_layer_; | ||||||
|     LayerArea in_layer_; |     Layer in_layer_; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| /**
 | /**
 | ||||||
|  |  | ||||||
|  | @ -70,7 +70,7 @@ | ||||||
| #include <kiwano/render/ShapeSink.h> | #include <kiwano/render/ShapeSink.h> | ||||||
| #include <kiwano/render/Texture.h> | #include <kiwano/render/Texture.h> | ||||||
| #include <kiwano/render/GifImage.h> | #include <kiwano/render/GifImage.h> | ||||||
| #include <kiwano/render/LayerArea.h> | #include <kiwano/render/Layer.h> | ||||||
| #include <kiwano/render/TextLayout.h> | #include <kiwano/render/TextLayout.h> | ||||||
| #include <kiwano/render/TextureCache.h> | #include <kiwano/render/TextureCache.h> | ||||||
| #include <kiwano/render/Renderer.h> | #include <kiwano/render/Renderer.h> | ||||||
|  | @ -86,7 +86,7 @@ | ||||||
| #include <kiwano/2d/Frame.h> | #include <kiwano/2d/Frame.h> | ||||||
| #include <kiwano/2d/FrameSequence.h> | #include <kiwano/2d/FrameSequence.h> | ||||||
| #include <kiwano/2d/GifSprite.h> | #include <kiwano/2d/GifSprite.h> | ||||||
| #include <kiwano/2d/Layer.h> | #include <kiwano/2d/LayerActor.h> | ||||||
| #include <kiwano/2d/ShapeActor.h> | #include <kiwano/2d/ShapeActor.h> | ||||||
| #include <kiwano/2d/Sprite.h> | #include <kiwano/2d/Sprite.h> | ||||||
| #include <kiwano/2d/Stage.h> | #include <kiwano/2d/Stage.h> | ||||||
|  |  | ||||||
|  | @ -330,7 +330,7 @@ void RenderContextImpl::PopClipRect() | ||||||
|     render_target_->PopAxisAlignedClip(); |     render_target_->PopAxisAlignedClip(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void RenderContextImpl::PushLayer(LayerArea& layer) | void RenderContextImpl::PushLayer(Layer& layer) | ||||||
| { | { | ||||||
|     KGE_ASSERT(render_target_ && "Render target has not been initialized!"); |     KGE_ASSERT(render_target_ && "Render target has not been initialized!"); | ||||||
|     if (!layer.IsValid()) |     if (!layer.IsValid()) | ||||||
|  | @ -356,7 +356,7 @@ void RenderContextImpl::PushLayer(LayerArea& layer) | ||||||
|             mask = layer.GetMaskShape()->GetGeometry(); |             mask = layer.GetMaskShape()->GetGeometry(); | ||||||
| 
 | 
 | ||||||
|         render_target_->PushLayer( |         render_target_->PushLayer( | ||||||
|             D2D1::LayerParameters(DX::ConvertToRectF(layer.GetAreaRect()), mask.get(), |             D2D1::LayerParameters(DX::ConvertToRectF(layer.GetClipRect()), mask.get(), | ||||||
|                                   antialias_ ? D2D1_ANTIALIAS_MODE_PER_PRIMITIVE : D2D1_ANTIALIAS_MODE_ALIASED, |                                   antialias_ ? D2D1_ANTIALIAS_MODE_PER_PRIMITIVE : D2D1_ANTIALIAS_MODE_ALIASED, | ||||||
|                                   DX::ConvertToMatrix3x2F(layer.GetMaskTransform()), layer.GetOpacity(), nullptr, |                                   DX::ConvertToMatrix3x2F(layer.GetMaskTransform()), layer.GetOpacity(), nullptr, | ||||||
|                                   D2D1_LAYER_OPTIONS_NONE), |                                   D2D1_LAYER_OPTIONS_NONE), | ||||||
|  |  | ||||||
|  | @ -70,7 +70,7 @@ public: | ||||||
| 
 | 
 | ||||||
|     void PopClipRect() override; |     void PopClipRect() override; | ||||||
| 
 | 
 | ||||||
|     void PushLayer(LayerArea& layer) override; |     void PushLayer(Layer& layer) override; | ||||||
| 
 | 
 | ||||||
|     void PopLayer() override; |     void PopLayer() override; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -18,13 +18,13 @@ | ||||||
| // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 | ||||||
| // THE SOFTWARE.
 | // THE SOFTWARE.
 | ||||||
| 
 | 
 | ||||||
| #include <kiwano/render/LayerArea.h> | #include <kiwano/render/Layer.h> | ||||||
| 
 | 
 | ||||||
| namespace kiwano | namespace kiwano | ||||||
| { | { | ||||||
| LayerArea::LayerArea() | Layer::Layer() | ||||||
|     : opacity_(1.f) |     : opacity_(1.f) | ||||||
|     , area_(Rect::Infinite()) |     , clip_rect_(Rect::Infinite()) | ||||||
| { | { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -33,18 +33,18 @@ namespace kiwano | ||||||
|  * \~chinese |  * \~chinese | ||||||
|  * @brief 图层区域 |  * @brief 图层区域 | ||||||
|  */ |  */ | ||||||
| class KGE_API LayerArea | class KGE_API Layer | ||||||
| { | { | ||||||
| public: | public: | ||||||
|     LayerArea(); |     Layer(); | ||||||
| 
 | 
 | ||||||
|     /// \~chinese
 |     /// \~chinese
 | ||||||
|     /// @brief 是否有效
 |     /// @brief 是否有效
 | ||||||
|     bool IsValid() const; |     bool IsValid() const; | ||||||
| 
 | 
 | ||||||
|     /// \~chinese
 |     /// \~chinese
 | ||||||
|     /// @brief 获取图层区域
 |     /// @brief 获取图层裁剪区域
 | ||||||
|     Rect const& GetAreaRect() const; |     Rect const& GetClipRect() const; | ||||||
| 
 | 
 | ||||||
|     /// \~chinese
 |     /// \~chinese
 | ||||||
|     /// @brief 获取图层透明度
 |     /// @brief 获取图层透明度
 | ||||||
|  | @ -59,8 +59,8 @@ public: | ||||||
|     Matrix3x2 const& GetMaskTransform() const; |     Matrix3x2 const& GetMaskTransform() const; | ||||||
| 
 | 
 | ||||||
|     /// \~chinese
 |     /// \~chinese
 | ||||||
|     /// @brief 设置图层区域
 |     /// @brief 设置图层裁剪区域
 | ||||||
|     void SetAreaRect(Rect const& area); |     void SetClipRect(Rect const& rect); | ||||||
| 
 | 
 | ||||||
|     /// \~chinese
 |     /// \~chinese
 | ||||||
|     /// @brief 设置图层透明度
 |     /// @brief 设置图层透明度
 | ||||||
|  | @ -75,7 +75,7 @@ public: | ||||||
|     void SetMaskTransform(Matrix3x2 const& matrix); |     void SetMaskTransform(Matrix3x2 const& matrix); | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|     Rect               area_; |     Rect      clip_rect_; | ||||||
|     float     opacity_; |     float     opacity_; | ||||||
|     ShapePtr  mask_; |     ShapePtr  mask_; | ||||||
|     Matrix3x2 mask_transform_; |     Matrix3x2 mask_transform_; | ||||||
|  | @ -93,58 +93,58 @@ private: | ||||||
| 
 | 
 | ||||||
| /** @} */ | /** @} */ | ||||||
| 
 | 
 | ||||||
| inline bool LayerArea::IsValid() const | inline bool Layer::IsValid() const | ||||||
| { | { | ||||||
|     return layer_ != nullptr; |     return layer_ != nullptr; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| inline Rect const& LayerArea::GetAreaRect() const | inline Rect const& Layer::GetClipRect() const | ||||||
| { | { | ||||||
|     return area_; |     return clip_rect_; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| inline float LayerArea::GetOpacity() const | inline float Layer::GetOpacity() const | ||||||
| { | { | ||||||
|     return opacity_; |     return opacity_; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| inline ShapePtr LayerArea::GetMaskShape() const | inline ShapePtr Layer::GetMaskShape() const | ||||||
| { | { | ||||||
|     return mask_; |     return mask_; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| inline Matrix3x2 const& LayerArea::GetMaskTransform() const | inline Matrix3x2 const& Layer::GetMaskTransform() const | ||||||
| { | { | ||||||
|     return mask_transform_; |     return mask_transform_; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| inline void LayerArea::SetAreaRect(Rect const& area) | inline void Layer::SetClipRect(Rect const& rect) | ||||||
| { | { | ||||||
|     area_ = area; |     clip_rect_ = rect; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| inline void LayerArea::SetOpacity(float opacity) | inline void Layer::SetOpacity(float opacity) | ||||||
| { | { | ||||||
|     opacity_ = opacity; |     opacity_ = opacity; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| inline void LayerArea::SetMaskShape(ShapePtr mask) | inline void Layer::SetMaskShape(ShapePtr mask) | ||||||
| { | { | ||||||
|     mask_ = mask; |     mask_ = mask; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| inline void LayerArea::SetMaskTransform(Matrix3x2 const& matrix) | inline void Layer::SetMaskTransform(Matrix3x2 const& matrix) | ||||||
| { | { | ||||||
|     mask_transform_ = matrix; |     mask_transform_ = matrix; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #if defined(KGE_WIN32) | #if defined(KGE_WIN32) | ||||||
| inline ComPtr<ID2D1Layer> LayerArea::GetLayer() const | inline ComPtr<ID2D1Layer> Layer::GetLayer() const | ||||||
| { | { | ||||||
|     return layer_; |     return layer_; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| inline void LayerArea::SetLayer(ComPtr<ID2D1Layer> layer) | inline void Layer::SetLayer(ComPtr<ID2D1Layer> layer) | ||||||
| { | { | ||||||
|     layer_ = layer; |     layer_ = layer; | ||||||
| } | } | ||||||
|  | @ -23,7 +23,7 @@ | ||||||
| #include <kiwano/core/Time.h> | #include <kiwano/core/Time.h> | ||||||
| #include <kiwano/render/Brush.h> | #include <kiwano/render/Brush.h> | ||||||
| #include <kiwano/render/Shape.h> | #include <kiwano/render/Shape.h> | ||||||
| #include <kiwano/render/LayerArea.h> | #include <kiwano/render/Layer.h> | ||||||
| #include <kiwano/render/TextLayout.h> | #include <kiwano/render/TextLayout.h> | ||||||
| #include <kiwano/render/Texture.h> | #include <kiwano/render/Texture.h> | ||||||
| #include <kiwano/render/DirectX/TextRenderer.h> | #include <kiwano/render/DirectX/TextRenderer.h> | ||||||
|  | @ -165,7 +165,7 @@ public: | ||||||
|     /// \~chinese
 |     /// \~chinese
 | ||||||
|     /// @brief 设置图层区域
 |     /// @brief 设置图层区域
 | ||||||
|     /// @param layer 图层区域
 |     /// @param layer 图层区域
 | ||||||
|     virtual void PushLayer(LayerArea& layer) = 0; |     virtual void PushLayer(Layer& layer) = 0; | ||||||
| 
 | 
 | ||||||
|     /// \~chinese
 |     /// \~chinese
 | ||||||
|     /// @brief 取消上一次设置的图层区域
 |     /// @brief 取消上一次设置的图层区域
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue