| 
									
										
										
										
											2019-04-11 14:40:54 +08:00
										 |  |  |  | // Copyright (c) 2016-2018 Kiwano - Nomango
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | //
 | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +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-03-31 01:37:06 +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-03-31 01:37:06 +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-10-11 21:55:29 +08:00
										 |  |  |  | #include <kiwano/2d/Actor.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>
 | 
					
						
							|  |  |  |  | #include <kiwano/render/ShapeSink.h>
 | 
					
						
							| 
									
										
										
										
											2020-01-17 16:55:47 +08:00
										 |  |  |  | #include <kiwano/render/StrokeStyle.h>
 | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-04-11 14:40:54 +08:00
										 |  |  |  | namespace kiwano | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2020-02-06 16:54:47 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | KGE_DECLARE_SMART_PTR(ShapeActor); | 
					
						
							|  |  |  |  | KGE_DECLARE_SMART_PTR(LineActor); | 
					
						
							|  |  |  |  | KGE_DECLARE_SMART_PTR(RectActor); | 
					
						
							| 
									
										
										
										
											2020-02-06 16:54:47 +08:00
										 |  |  |  | KGE_DECLARE_SMART_PTR(RoundedRectActor); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | KGE_DECLARE_SMART_PTR(CircleActor); | 
					
						
							|  |  |  |  | KGE_DECLARE_SMART_PTR(EllipseActor); | 
					
						
							|  |  |  |  | KGE_DECLARE_SMART_PTR(PolygonActor); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /**
 | 
					
						
							|  |  |  |  |  * \addtogroup Actors | 
					
						
							|  |  |  |  |  * @{ | 
					
						
							|  |  |  |  |  */ | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /**
 | 
					
						
							|  |  |  |  |  * \~chinese | 
					
						
							| 
									
										
										
										
											2020-02-06 16:54:47 +08:00
										 |  |  |  |  * @brief <EFBFBD><EFBFBD>״<EFBFBD><EFBFBD>ɫ | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |  */ | 
					
						
							|  |  |  |  | class KGE_API ShapeActor : public Actor | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | public: | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-06 16:54:47 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״<EFBFBD><D7B4>ɫ
 | 
					
						
							|  |  |  |  |     static ShapeActorPtr Create(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״<EFBFBD><D7B4>ɫ
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     ShapeActor(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     virtual ~ShapeActor(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD>仭ˢ
 | 
					
						
							|  |  |  |  |     BrushPtr GetFillBrush() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ
 | 
					
						
							|  |  |  |  |     BrushPtr GetStrokeBrush() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     float GetStrokeWidth() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
 | 
					
						
							| 
									
										
										
										
											2020-02-06 16:54:47 +08:00
										 |  |  |  |     StrokeStylePtr GetStrokeStyle() const; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><>ȡ<EFBFBD><C8A1>״
 | 
					
						
							| 
									
										
										
										
											2020-02-05 19:56:22 +08:00
										 |  |  |  |     ShapePtr GetShape() const; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><>ȡ<EFBFBD>߽<EFBFBD>
 | 
					
						
							|  |  |  |  |     Rect GetBounds() const override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD>а<EFBFBD>Χ<EFBFBD><CEA7>
 | 
					
						
							|  |  |  |  |     Rect GetBoundingBox() const override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20>жϵ<D0B6><CFB5>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>״<EFBFBD><D7B4>
 | 
					
						
							|  |  |  |  |     bool ContainsPoint(const Point& point) const override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
 | 
					
						
							|  |  |  |  |     /// @param color <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
 | 
					
						
							|  |  |  |  |     void SetFillColor(Color const& color); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>仭ˢ
 | 
					
						
							|  |  |  |  |     /// @param[in] brush <20><><EFBFBD>仭ˢ
 | 
					
						
							|  |  |  |  |     void SetFillBrush(BrushPtr brush); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
 | 
					
						
							|  |  |  |  |     /// @param color <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
 | 
					
						
							|  |  |  |  |     void SetStrokeColor(Color const& color); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ
 | 
					
						
							|  |  |  |  |     /// @param[in] brush <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ
 | 
					
						
							|  |  |  |  |     void SetStrokeBrush(BrushPtr brush); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȣ<EFBFBD>Ĭ<EFBFBD><C4AC>Ϊ 1.0
 | 
					
						
							|  |  |  |  |     void SetStrokeWidth(float width); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
 | 
					
						
							| 
									
										
										
										
											2020-02-06 16:54:47 +08:00
										 |  |  |  |     void SetStrokeStyle(StrokeStylePtr stroke_style); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-06 09:39:36 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״
 | 
					
						
							| 
									
										
										
										
											2020-02-05 19:56:22 +08:00
										 |  |  |  |     void SetShape(ShapePtr shape); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     void OnRender(RenderContext& ctx) override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | protected: | 
					
						
							|  |  |  |  |     bool CheckVisibility(RenderContext& ctx) const override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | private: | 
					
						
							| 
									
										
										
										
											2020-02-06 16:54:47 +08:00
										 |  |  |  |     BrushPtr       fill_brush_; | 
					
						
							|  |  |  |  |     BrushPtr       stroke_brush_; | 
					
						
							|  |  |  |  |     float          stroke_width_; | 
					
						
							|  |  |  |  |     StrokeStylePtr stroke_style_; | 
					
						
							|  |  |  |  |     Rect           bounds_; | 
					
						
							|  |  |  |  |     ShapePtr       shape_; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-06 16:54:47 +08:00
										 |  |  |  | /// @brief <20>߶ν<DFB6>ɫ
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | class KGE_API LineActor : public ShapeActor | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | public: | 
					
						
							| 
									
										
										
										
											2020-02-06 16:54:47 +08:00
										 |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD>߶ν<DFB6>ɫ
 | 
					
						
							|  |  |  |  |     /// @param begin <20>߶<EFBFBD><DFB6><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     /// @param end <20>߶<EFBFBD><DFB6>յ<EFBFBD>
 | 
					
						
							|  |  |  |  |     static LineActorPtr Create(Point const& begin, Point const& end); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     LineActor(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     virtual ~LineActor(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><>ȡ<EFBFBD>߶<EFBFBD><DFB6><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     Point const& GetBeginPoint() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><>ȡ<EFBFBD>߶<EFBFBD><DFB6>յ<EFBFBD>
 | 
					
						
							|  |  |  |  |     Point const& GetEndPoint() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD><DFB6><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     /// @param begin <20>߶<EFBFBD><DFB6><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     void SetBeginPoint(Point const& begin); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD><DFB6>յ<EFBFBD>
 | 
					
						
							|  |  |  |  |     /// @param end <20>߶<EFBFBD><DFB6>յ<EFBFBD>
 | 
					
						
							|  |  |  |  |     void SetEndPoint(Point const& end); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							| 
									
										
										
										
											2020-02-06 16:54:47 +08:00
										 |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD><DFB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     /// @param begin <20>߶<EFBFBD><DFB6><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  |     /// @param end <20>߶<EFBFBD><DFB6>յ<EFBFBD>
 | 
					
						
							|  |  |  |  |     void SetLine(Point const& begin, Point const& end); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | private: | 
					
						
							|  |  |  |  |     Point begin_; | 
					
						
							|  |  |  |  |     Point end_; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /// \~chinese
 | 
					
						
							|  |  |  |  | /// @brief <20><><EFBFBD>ν<EFBFBD>ɫ
 | 
					
						
							|  |  |  |  | class KGE_API RectActor : public ShapeActor | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | public: | 
					
						
							| 
									
										
										
										
											2020-02-06 16:54:47 +08:00
										 |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ν<EFBFBD>ɫ
 | 
					
						
							|  |  |  |  |     /// @param size <20><><EFBFBD>δ<EFBFBD>С
 | 
					
						
							|  |  |  |  |     static RectActorPtr Create(Size const& size); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     RectActor(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     virtual ~RectActor(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD>δ<EFBFBD>С
 | 
					
						
							|  |  |  |  |     Size const& GetRectSize() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><><EFBFBD>þ<EFBFBD><C3BE>δ<EFBFBD>С
 | 
					
						
							|  |  |  |  |     /// @param size <20><><EFBFBD>δ<EFBFBD>С
 | 
					
						
							|  |  |  |  |     void SetRectSize(Size const& size); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | private: | 
					
						
							|  |  |  |  |     Size rect_size_; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /// \~chinese
 | 
					
						
							|  |  |  |  | /// @brief Բ<>Ǿ<EFBFBD><C7BE>ν<EFBFBD>ɫ
 | 
					
						
							| 
									
										
										
										
											2020-02-06 16:54:47 +08:00
										 |  |  |  | class KGE_API RoundedRectActor : public ShapeActor | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | public: | 
					
						
							| 
									
										
										
										
											2020-02-06 16:54:47 +08:00
										 |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD>Բ<EFBFBD>Ǿ<EFBFBD><C7BE>ν<EFBFBD>ɫ
 | 
					
						
							|  |  |  |  |     /// @param size Բ<>Ǿ<EFBFBD><C7BE>δ<EFBFBD>С
 | 
					
						
							|  |  |  |  |     /// @param radius Բ<>ǰ뾶
 | 
					
						
							|  |  |  |  |     static RoundedRectActorPtr Create(Size const& size, Vec2 const& radius); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     RoundedRectActor(); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-06 16:54:47 +08:00
										 |  |  |  |     virtual ~RoundedRectActor(); | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><>ȡԲ<C8A1>ǰ뾶
 | 
					
						
							|  |  |  |  |     Vec2 GetRadius() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><>ȡԲ<C8A1>Ǿ<EFBFBD><C7BE>δ<EFBFBD>С
 | 
					
						
							|  |  |  |  |     Size GetRectSize() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD>Բ<EFBFBD>ǰ뾶
 | 
					
						
							|  |  |  |  |     /// @param radius Բ<>ǰ뾶
 | 
					
						
							|  |  |  |  |     void SetRadius(Vec2 const& radius); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD>Բ<EFBFBD>Ǿ<EFBFBD><C7BE>δ<EFBFBD>С
 | 
					
						
							|  |  |  |  |     /// @param size Բ<>Ǿ<EFBFBD><C7BE>δ<EFBFBD>С
 | 
					
						
							|  |  |  |  |     void SetRectSize(Size const& size); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD>Բ<EFBFBD>Ǿ<EFBFBD><C7BE><EFBFBD>
 | 
					
						
							|  |  |  |  |     /// @param size Բ<>Ǿ<EFBFBD><C7BE>δ<EFBFBD>С
 | 
					
						
							|  |  |  |  |     /// @param radius Բ<>ǰ뾶
 | 
					
						
							|  |  |  |  |     void SetRoundedRect(Size const& size, Vec2 const& radius); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | private: | 
					
						
							|  |  |  |  |     Size rect_size_; | 
					
						
							|  |  |  |  |     Vec2 radius_; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /// \~chinese
 | 
					
						
							|  |  |  |  | /// @brief Բ<>ν<EFBFBD>ɫ
 | 
					
						
							|  |  |  |  | class KGE_API CircleActor : public ShapeActor | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | public: | 
					
						
							| 
									
										
										
										
											2020-02-06 16:54:47 +08:00
										 |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD>Բ<EFBFBD>ν<EFBFBD>ɫ
 | 
					
						
							|  |  |  |  |     /// @param radius Բ<>ΰ뾶
 | 
					
						
							|  |  |  |  |     static CircleActorPtr Create(float radius); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     CircleActor(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     virtual ~CircleActor(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><>ȡԲ<C8A1>ΰ뾶
 | 
					
						
							|  |  |  |  |     float GetRadius() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD>Բ<EFBFBD>ΰ뾶
 | 
					
						
							|  |  |  |  |     /// @param radius Բ<>ΰ뾶
 | 
					
						
							|  |  |  |  |     void SetRadius(float radius); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | private: | 
					
						
							|  |  |  |  |     float radius_; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /// \~chinese
 | 
					
						
							|  |  |  |  | /// @brief <20><>Բ<EFBFBD><D4B2>ɫ
 | 
					
						
							|  |  |  |  | class KGE_API EllipseActor : public ShapeActor | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | public: | 
					
						
							| 
									
										
										
										
											2020-02-06 16:54:47 +08:00
										 |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Բ<EFBFBD><D4B2>ɫ
 | 
					
						
							|  |  |  |  |     /// @param radius <20><>Բ<EFBFBD>뾶
 | 
					
						
							|  |  |  |  |     static EllipseActorPtr Create(Vec2 const& radius); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     EllipseActor(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     virtual ~EllipseActor(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><>ȡ<EFBFBD><C8A1>Բ<EFBFBD>뾶
 | 
					
						
							|  |  |  |  |     Vec2 GetRadius() const; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Բ<EFBFBD>뾶
 | 
					
						
							|  |  |  |  |     /// @param radius <20><>Բ<EFBFBD>뾶
 | 
					
						
							|  |  |  |  |     void SetRadius(Vec2 const& radius); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | private: | 
					
						
							|  |  |  |  |     Vec2 radius_; | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /// \~chinese
 | 
					
						
							|  |  |  |  | /// @brief <20><><EFBFBD><EFBFBD><EFBFBD>ν<EFBFBD>ɫ
 | 
					
						
							|  |  |  |  | class KGE_API PolygonActor : public ShapeActor | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | public: | 
					
						
							| 
									
										
										
										
											2020-02-06 16:54:47 +08:00
										 |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ν<EFBFBD>ɫ
 | 
					
						
							|  |  |  |  |     /// @param points <20><><EFBFBD><EFBFBD><EFBFBD>ζ˵㼯<CBB5><E3BCAF>
 | 
					
						
							|  |  |  |  |     static PolygonActorPtr Create(Vector<Point> const& points); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  |     PolygonActor(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     virtual ~PolygonActor(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |     /// \~chinese
 | 
					
						
							|  |  |  |  |     /// @brief <20><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ζ˵<CEB6>
 | 
					
						
							|  |  |  |  |     /// @param points <20><><EFBFBD><EFBFBD><EFBFBD>ζ˵㼯<CBB5><E3BCAF>
 | 
					
						
							|  |  |  |  |     void SetVertices(Vector<Point> const& points); | 
					
						
							|  |  |  |  | }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | /** @} */ | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | inline void ShapeActor::SetStrokeColor(Color const& color) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     if (!stroke_brush_) | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         stroke_brush_ = new Brush; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |     stroke_brush_->SetColor(color); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | inline void ShapeActor::SetFillColor(Color const& color) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     if (!fill_brush_) | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         fill_brush_ = new Brush; | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  |     fill_brush_->SetColor(color); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | inline void ShapeActor::SetFillBrush(BrushPtr brush) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     fill_brush_ = brush; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | inline void ShapeActor::SetStrokeBrush(BrushPtr brush) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     stroke_brush_ = brush; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | inline BrushPtr ShapeActor::GetFillBrush() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return fill_brush_; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | inline BrushPtr ShapeActor::GetStrokeBrush() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return stroke_brush_; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | inline float ShapeActor::GetStrokeWidth() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return stroke_width_; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2020-02-06 16:54:47 +08:00
										 |  |  |  | inline StrokeStylePtr ShapeActor::GetStrokeStyle() const | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  |     return stroke_style_; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2020-02-05 19:56:22 +08:00
										 |  |  |  | inline ShapePtr ShapeActor::GetShape() const | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2020-02-05 19:56:22 +08:00
										 |  |  |  |     return shape_; | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | inline Point const& LineActor::GetBeginPoint() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return begin_; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | inline Point const& LineActor::GetEndPoint() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return end_; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | inline void LineActor::SetBeginPoint(Point const& begin) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     SetLine(begin, end_); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | inline void LineActor::SetEndPoint(Point const& end) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     SetLine(begin_, end); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | inline Size const& RectActor::GetRectSize() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return rect_size_; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-02-06 16:54:47 +08:00
										 |  |  |  | inline Vec2 RoundedRectActor::GetRadius() const | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  |     return radius_; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2020-02-06 16:54:47 +08:00
										 |  |  |  | inline Size RoundedRectActor::GetRectSize() const | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  |     return GetSize(); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | inline float CircleActor::GetRadius() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return radius_; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | inline Vec2 EllipseActor::GetRadius() const | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     return radius_; | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | } | 
					
						
							| 
									
										
										
										
											2020-01-21 10:09:55 +08:00
										 |  |  |  | }  // namespace kiwano
 |