| 
									
										
										
										
											2019-04-11 14:40:54 +08:00
										 |  |  |  | // Copyright (c) 2016-2018 Kiwano - Nomango
 | 
					
						
							| 
									
										
										
										
											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:
 | 
					
						
							|  |  |  |  | // 
 | 
					
						
							|  |  |  |  | // The above copyright notice and this permission notice shall be included in
 | 
					
						
							|  |  |  |  | // all copies or substantial portions of the Software.
 | 
					
						
							|  |  |  |  | // 
 | 
					
						
							|  |  |  |  | // 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>
 | 
					
						
							| 
									
										
										
										
											2019-12-27 23:42:51 +08:00
										 |  |  |  | #include <kiwano/renderer/Brush.h>
 | 
					
						
							| 
									
										
										
										
											2019-10-11 21:55:29 +08:00
										 |  |  |  | #include <kiwano/renderer/Geometry.h>
 | 
					
						
							| 
									
										
										
										
											2019-12-29 18:58:22 +08:00
										 |  |  |  | #include <kiwano/renderer/GeometrySink.h>
 | 
					
						
							| 
									
										
										
										
											2019-10-11 21:55:29 +08:00
										 |  |  |  | #include <kiwano/renderer/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
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 	KGE_DECLARE_SMART_PTR(ShapeActor); | 
					
						
							|  |  |  |  | 	KGE_DECLARE_SMART_PTR(LineActor); | 
					
						
							|  |  |  |  | 	KGE_DECLARE_SMART_PTR(RectActor); | 
					
						
							|  |  |  |  | 	KGE_DECLARE_SMART_PTR(RoundRectActor); | 
					
						
							|  |  |  |  | 	KGE_DECLARE_SMART_PTR(CircleActor); | 
					
						
							|  |  |  |  | 	KGE_DECLARE_SMART_PTR(EllipseActor); | 
					
						
							|  |  |  |  | 	KGE_DECLARE_SMART_PTR(PolygonActor); | 
					
						
							| 
									
										
										
										
											2019-12-27 23:42:51 +08:00
										 |  |  |  | 	KGE_DECLARE_SMART_PTR(PathShapeActor); | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	/**
 | 
					
						
							|  |  |  |  | 	* \addtogroup Actors | 
					
						
							|  |  |  |  | 	* @{ | 
					
						
							|  |  |  |  | 	*/ | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	/**
 | 
					
						
							|  |  |  |  | 	* \~chinese | 
					
						
							| 
									
										
										
										
											2019-12-27 23:42:51 +08:00
										 |  |  |  | 	* @brief <EFBFBD><EFBFBD>ά<EFBFBD><EFBFBD>״<EFBFBD><EFBFBD>ɫ | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 	*/ | 
					
						
							| 
									
										
										
										
											2019-08-13 23:21:20 +08:00
										 |  |  |  | 	class KGE_API ShapeActor | 
					
						
							| 
									
										
										
										
											2019-08-14 00:28:25 +08:00
										 |  |  |  | 		: public Actor | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 	public: | 
					
						
							| 
									
										
										
										
											2019-12-27 23:42:51 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ά<EFBFBD><CEAC>״<EFBFBD><D7B4>ɫ
 | 
					
						
							| 
									
										
										
										
											2019-08-13 23:21:20 +08:00
										 |  |  |  | 		ShapeActor(); | 
					
						
							| 
									
										
										
										
											2019-08-08 14:15:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-13 23:21:20 +08:00
										 |  |  |  | 		virtual ~ShapeActor(); | 
					
						
							| 
									
										
										
										
											2019-08-08 14:15:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							| 
									
										
										
										
											2019-12-27 23:42:51 +08:00
										 |  |  |  | 		/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD>仭ˢ
 | 
					
						
							|  |  |  |  | 		BrushPtr GetFillBrush() const; | 
					
						
							| 
									
										
										
										
											2019-08-08 14:15:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							| 
									
										
										
										
											2019-12-27 23:42:51 +08:00
										 |  |  |  | 		/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˢ
 | 
					
						
							|  |  |  |  | 		BrushPtr GetStrokeBrush() const; | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		float GetStrokeWidth() const; | 
					
						
							| 
									
										
										
										
											2019-08-08 14:15:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
 | 
					
						
							| 
									
										
										
										
											2020-01-10 11:43:07 +08:00
										 |  |  |  | 		const StrokeStyle& GetStrokeStyle() const; | 
					
						
							| 
									
										
										
										
											2019-08-20 21:15:15 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><>ȡ<EFBFBD><C8A1>״
 | 
					
						
							|  |  |  |  | 		Geometry GetGeometry() const; | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><>ȡ<EFBFBD>߽<EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2019-08-14 00:28:25 +08:00
										 |  |  |  | 		Rect GetBounds() const override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD>а<EFBFBD>Χ<EFBFBD><CEA7>
 | 
					
						
							| 
									
										
										
										
											2019-08-14 00:28:25 +08:00
										 |  |  |  | 		Rect GetBoundingBox() const override; | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20>жϵ<D0B6><CFB5>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>״<EFBFBD><D7B4>
 | 
					
						
							| 
									
										
										
										
											2019-08-20 21:15:15 +08:00
										 |  |  |  | 		bool ContainsPoint(const Point& point) const override; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
 | 
					
						
							| 
									
										
										
										
											2019-12-27 23:42:51 +08:00
										 |  |  |  | 		/// @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); | 
					
						
							| 
									
										
										
										
											2019-08-08 14:15:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							| 
									
										
										
										
											2019-12-27 23:42:51 +08:00
										 |  |  |  | 		/// @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); | 
					
						
							| 
									
										
										
										
											2019-08-08 14:15:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȣ<EFBFBD>Ĭ<EFBFBD><C4AC>Ϊ 1.0
 | 
					
						
							| 
									
										
										
										
											2019-09-29 22:23:13 +08:00
										 |  |  |  | 		void SetStrokeWidth(float width); | 
					
						
							| 
									
										
										
										
											2019-08-08 14:15:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
 | 
					
						
							| 
									
										
										
										
											2020-01-10 11:43:07 +08:00
										 |  |  |  | 		void SetStrokeStyle(const StrokeStyle& stroke_style); | 
					
						
							| 
									
										
										
										
											2019-08-08 14:15:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><><EFBFBD>ü<EFBFBD><C3BC><EFBFBD><EFBFBD><EFBFBD>״
 | 
					
						
							| 
									
										
										
										
											2019-08-26 10:22:58 +08:00
										 |  |  |  | 		void SetGeometry(Geometry const& geometry); | 
					
						
							| 
									
										
										
										
											2019-08-08 14:15:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-10 15:22:12 +08:00
										 |  |  |  | 		void OnRender(RenderContext& ctx) override; | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-27 23:42:51 +08:00
										 |  |  |  | 	protected: | 
					
						
							| 
									
										
										
										
											2020-01-16 18:33:42 +08:00
										 |  |  |  | 		bool CheckVisibility(RenderContext& ctx) const override; | 
					
						
							| 
									
										
										
										
											2019-12-27 23:42:51 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 	private: | 
					
						
							| 
									
										
										
										
											2019-12-27 23:42:51 +08:00
										 |  |  |  | 		BrushPtr	fill_brush_; | 
					
						
							|  |  |  |  | 		BrushPtr	stroke_brush_; | 
					
						
							| 
									
										
										
										
											2019-09-29 22:23:13 +08:00
										 |  |  |  | 		float		stroke_width_; | 
					
						
							| 
									
										
										
										
											2019-08-16 00:50:54 +08:00
										 |  |  |  | 		StrokeStyle	stroke_style_; | 
					
						
							| 
									
										
										
										
											2019-08-20 21:15:15 +08:00
										 |  |  |  | 		Rect		bounds_; | 
					
						
							| 
									
										
										
										
											2019-08-14 21:38:37 +08:00
										 |  |  |  | 		Geometry	geo_; | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 	}; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 	/// \~chinese
 | 
					
						
							|  |  |  |  | 	/// @brief <20>߶<EFBFBD>ͼ<EFBFBD>ν<EFBFBD>ɫ
 | 
					
						
							| 
									
										
										
										
											2019-08-13 23:21:20 +08:00
										 |  |  |  | 	class KGE_API LineActor | 
					
						
							|  |  |  |  | 		: public ShapeActor | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 	public: | 
					
						
							| 
									
										
										
										
											2019-08-13 23:21:20 +08:00
										 |  |  |  | 		LineActor(); | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-13 23:21:20 +08:00
										 |  |  |  | 		virtual ~LineActor(); | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><>ȡ<EFBFBD>߶<EFBFBD><DFB6><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		Point const& GetBeginPoint() const; | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><>ȡ<EFBFBD>߶<EFBFBD><DFB6>յ<EFBFBD>
 | 
					
						
							|  |  |  |  | 		Point const& GetEndPoint() const; | 
					
						
							| 
									
										
										
										
											2019-08-27 08:28:14 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><><EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD><DFB6><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		/// @param begin <20>߶<EFBFBD><DFB6><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		void SetBeginPoint(Point const& begin); | 
					
						
							| 
									
										
										
										
											2019-08-27 08:28:14 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><><EFBFBD><EFBFBD><EFBFBD>߶<EFBFBD><DFB6>յ<EFBFBD>
 | 
					
						
							|  |  |  |  | 		/// @param end <20>߶<EFBFBD><DFB6>յ<EFBFBD>
 | 
					
						
							|  |  |  |  | 		void SetEndPoint(Point const& end); | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><><EFBFBD>þ<EFBFBD><C3BE>δ<EFBFBD>С
 | 
					
						
							|  |  |  |  | 		/// @param begin <20>߶<EFBFBD><DFB6><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		/// @param end <20>߶<EFBFBD><DFB6>յ<EFBFBD>
 | 
					
						
							|  |  |  |  | 		void SetLine(Point const& begin, Point const& end); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	private: | 
					
						
							| 
									
										
										
										
											2019-08-27 08:28:14 +08:00
										 |  |  |  | 		Point begin_; | 
					
						
							|  |  |  |  | 		Point end_; | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 	}; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 	/// \~chinese
 | 
					
						
							|  |  |  |  | 	/// @brief <20><><EFBFBD>ν<EFBFBD>ɫ
 | 
					
						
							| 
									
										
										
										
											2019-08-13 23:21:20 +08:00
										 |  |  |  | 	class KGE_API RectActor | 
					
						
							|  |  |  |  | 		: public ShapeActor | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 	public: | 
					
						
							| 
									
										
										
										
											2019-08-13 23:21:20 +08:00
										 |  |  |  | 		RectActor(); | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-13 23:21:20 +08:00
										 |  |  |  | 		virtual ~RectActor(); | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><>ȡ<EFBFBD><C8A1><EFBFBD>δ<EFBFBD>С
 | 
					
						
							|  |  |  |  | 		Size const& GetRectSize() const; | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><><EFBFBD>þ<EFBFBD><C3BE>δ<EFBFBD>С
 | 
					
						
							|  |  |  |  | 		/// @param size <20><><EFBFBD>δ<EFBFBD>С
 | 
					
						
							| 
									
										
										
										
											2019-08-27 08:28:14 +08:00
										 |  |  |  | 		void SetRectSize(Size const& size); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 	private: | 
					
						
							| 
									
										
										
										
											2019-08-20 19:32:36 +08:00
										 |  |  |  | 		Size rect_size_; | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 	}; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	/// \~chinese
 | 
					
						
							|  |  |  |  | 	/// @brief Բ<>Ǿ<EFBFBD><C7BE>ν<EFBFBD>ɫ
 | 
					
						
							| 
									
										
										
										
											2019-08-13 23:21:20 +08:00
										 |  |  |  | 	class KGE_API RoundRectActor | 
					
						
							|  |  |  |  | 		: public ShapeActor | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 	public: | 
					
						
							| 
									
										
										
										
											2019-08-13 23:21:20 +08:00
										 |  |  |  | 		RoundRectActor(); | 
					
						
							| 
									
										
										
										
											2019-08-08 14:15:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-13 23:21:20 +08:00
										 |  |  |  | 		virtual ~RoundRectActor(); | 
					
						
							| 
									
										
										
										
											2019-08-08 14:15:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><>ȡԲ<C8A1>ǰ뾶
 | 
					
						
							|  |  |  |  | 		Vec2 GetRadius() const; | 
					
						
							| 
									
										
										
										
											2019-08-27 08:28:14 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><>ȡԲ<C8A1>Ǿ<EFBFBD><C7BE>δ<EFBFBD>С
 | 
					
						
							|  |  |  |  | 		Size GetRectSize() const; | 
					
						
							| 
									
										
										
										
											2019-08-27 08:28:14 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><><EFBFBD><EFBFBD>Բ<EFBFBD>ǰ뾶
 | 
					
						
							|  |  |  |  | 		/// @param radius Բ<>ǰ뾶
 | 
					
						
							|  |  |  |  | 		void SetRadius(Vec2 const& radius); | 
					
						
							| 
									
										
										
										
											2019-08-08 14:15:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><><EFBFBD><EFBFBD>Բ<EFBFBD>Ǿ<EFBFBD><C7BE>δ<EFBFBD>С
 | 
					
						
							|  |  |  |  | 		/// @param size Բ<>Ǿ<EFBFBD><C7BE>δ<EFBFBD>С
 | 
					
						
							|  |  |  |  | 		void SetRectSize(Size const& size); | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><><EFBFBD><EFBFBD>Բ<EFBFBD>Ǿ<EFBFBD><C7BE><EFBFBD>
 | 
					
						
							|  |  |  |  | 		/// @param size Բ<>Ǿ<EFBFBD><C7BE>δ<EFBFBD>С
 | 
					
						
							|  |  |  |  | 		/// @param radius Բ<>ǰ뾶
 | 
					
						
							|  |  |  |  | 		void SetRoundedRect(Size const& size, Vec2 const& radius); | 
					
						
							| 
									
										
										
										
											2019-08-08 14:15:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 	private: | 
					
						
							| 
									
										
										
										
											2019-08-20 19:32:36 +08:00
										 |  |  |  | 		Size rect_size_; | 
					
						
							| 
									
										
										
										
											2019-08-14 21:38:37 +08:00
										 |  |  |  | 		Vec2 radius_; | 
					
						
							| 
									
										
										
										
											2019-08-08 14:15:06 +08:00
										 |  |  |  | 	}; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 	/// \~chinese
 | 
					
						
							|  |  |  |  | 	/// @brief Բ<>ν<EFBFBD>ɫ
 | 
					
						
							| 
									
										
										
										
											2019-08-13 23:21:20 +08:00
										 |  |  |  | 	class KGE_API CircleActor | 
					
						
							|  |  |  |  | 		: public ShapeActor | 
					
						
							| 
									
										
										
										
											2019-08-08 14:15:06 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 	public: | 
					
						
							| 
									
										
										
										
											2019-08-13 23:21:20 +08:00
										 |  |  |  | 		CircleActor(); | 
					
						
							| 
									
										
										
										
											2019-08-08 14:15:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-13 23:21:20 +08:00
										 |  |  |  | 		virtual ~CircleActor(); | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><>ȡԲ<C8A1>ΰ뾶
 | 
					
						
							|  |  |  |  | 		float GetRadius() const; | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><><EFBFBD><EFBFBD>Բ<EFBFBD>ΰ뾶
 | 
					
						
							|  |  |  |  | 		/// @param radius Բ<>ΰ뾶
 | 
					
						
							| 
									
										
										
										
											2019-09-29 22:23:13 +08:00
										 |  |  |  | 		void SetRadius(float radius); | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 	private: | 
					
						
							| 
									
										
										
										
											2019-09-29 22:23:13 +08:00
										 |  |  |  | 		float radius_; | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 	}; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 	/// \~chinese
 | 
					
						
							|  |  |  |  | 	/// @brief <20><>Բ<EFBFBD><D4B2>ɫ
 | 
					
						
							| 
									
										
										
										
											2019-08-13 23:21:20 +08:00
										 |  |  |  | 	class KGE_API EllipseActor | 
					
						
							|  |  |  |  | 		: public ShapeActor | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 	public: | 
					
						
							| 
									
										
										
										
											2019-08-13 23:21:20 +08:00
										 |  |  |  | 		EllipseActor(); | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-13 23:21:20 +08:00
										 |  |  |  | 		virtual ~EllipseActor(); | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><>ȡ<EFBFBD><C8A1>Բ<EFBFBD>뾶
 | 
					
						
							|  |  |  |  | 		Vec2 GetRadius() const; | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Բ<EFBFBD>뾶
 | 
					
						
							|  |  |  |  | 		/// @param radius <20><>Բ<EFBFBD>뾶
 | 
					
						
							|  |  |  |  | 		void SetRadius(Vec2 const& radius); | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 	private: | 
					
						
							| 
									
										
										
										
											2019-08-14 21:38:37 +08:00
										 |  |  |  | 		Vec2 radius_; | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 	}; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 	/// \~chinese
 | 
					
						
							|  |  |  |  | 	/// @brief <20><><EFBFBD><EFBFBD><EFBFBD>ν<EFBFBD>ɫ
 | 
					
						
							| 
									
										
										
										
											2019-08-26 10:22:58 +08:00
										 |  |  |  | 	class KGE_API PolygonActor | 
					
						
							|  |  |  |  | 		: public ShapeActor | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 	public: | 
					
						
							|  |  |  |  | 		PolygonActor(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		virtual ~PolygonActor(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><><EFBFBD>ö<EFBFBD><C3B6><EFBFBD><EFBFBD>ζ˵<CEB6>
 | 
					
						
							|  |  |  |  | 		/// @param points <20><><EFBFBD><EFBFBD><EFBFBD>ζ˵㼯<CBB5><E3BCAF>
 | 
					
						
							|  |  |  |  | 		void SetVertices(Vector<Point> const& points); | 
					
						
							| 
									
										
										
										
											2019-08-26 10:22:58 +08:00
										 |  |  |  | 	}; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 	/// \~chinese
 | 
					
						
							|  |  |  |  | 	/// @brief ·<><C2B7>ͼ<EFBFBD>ν<EFBFBD>ɫ
 | 
					
						
							| 
									
										
										
										
											2019-12-27 23:42:51 +08:00
										 |  |  |  | 	class KGE_API PathShapeActor | 
					
						
							| 
									
										
										
										
											2019-08-13 23:21:20 +08:00
										 |  |  |  | 		: public ShapeActor | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 	public: | 
					
						
							| 
									
										
										
										
											2019-12-27 23:42:51 +08:00
										 |  |  |  | 		PathShapeActor(); | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-27 23:42:51 +08:00
										 |  |  |  | 		virtual ~PathShapeActor(); | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
 | 
					
						
							|  |  |  |  | 		/// @param begin_pos <20><>ʼ<EFBFBD><CABC>
 | 
					
						
							|  |  |  |  | 		void BeginPath(Point const& begin_pos = Point()); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
 | 
					
						
							|  |  |  |  | 		/// @param closed ·<><C2B7><EFBFBD>Ƿ<EFBFBD><C7B7>պ<EFBFBD>
 | 
					
						
							|  |  |  |  | 		void EndPath(bool closed = true); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>߶<EFBFBD>
 | 
					
						
							|  |  |  |  | 		/// @param point <20>߶ζ˵<CEB6>
 | 
					
						
							|  |  |  |  | 		void AddLine(Point const& point); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><><EFBFBD>Ӷ<EFBFBD><D3B6><EFBFBD><EFBFBD>߶<EFBFBD>
 | 
					
						
							|  |  |  |  | 		/// @param points <20>߶ζ˵㼯<CBB5><E3BCAF>
 | 
					
						
							|  |  |  |  | 		void AddLines(Vector<Point> const& points); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>η<EFBFBD><CEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 		/// @param point1 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߵĵ<DFB5>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD>
 | 
					
						
							|  |  |  |  | 		/// @param point2 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߵĵڶ<C4B5><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD>
 | 
					
						
							|  |  |  |  | 		/// @param point3 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ߵ<EFBFBD><DFB5>յ<EFBFBD>
 | 
					
						
							|  |  |  |  | 		void AddBezier(Point const& point1, Point const& point2, Point const& point3); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><><EFBFBD>ӻ<EFBFBD><D3BB><EFBFBD>
 | 
					
						
							|  |  |  |  | 		/// @param point <20><>ԲԲ<D4B2><D4B2>
 | 
					
						
							|  |  |  |  | 		/// @param radius <20><>Բ<EFBFBD>뾶
 | 
					
						
							|  |  |  |  | 		/// @param rotation <20><>Բ<EFBFBD><D4B2>ת<EFBFBD>Ƕ<EFBFBD>
 | 
					
						
							|  |  |  |  | 		/// @param clockwise ˳ʱ<CBB3><CAB1> or <20><>ʱ<EFBFBD><CAB1>
 | 
					
						
							|  |  |  |  | 		/// @param is_small <20>Ƿ<EFBFBD>ȡС<C8A1><D0A1> 180<38><30> <20>Ļ<EFBFBD>
 | 
					
						
							|  |  |  |  | 		void AddArc(Point const& point, Size const& radius, float rotation, bool clockwise = true, bool is_small = true); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		/// \~chinese
 | 
					
						
							|  |  |  |  | 		/// @brief <20><><EFBFBD><EFBFBD>·<EFBFBD><C2B7>
 | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 		void ClearPath(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 	private: | 
					
						
							| 
									
										
										
										
											2019-08-14 21:38:37 +08:00
										 |  |  |  | 		GeometrySink sink_; | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | 	}; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 	/** @} */ | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-27 23:42:51 +08:00
										 |  |  |  | 	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); | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-10 11:43:07 +08:00
										 |  |  |  | 	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_; } | 
					
						
							|  |  |  |  | 	inline const StrokeStyle&	ShapeActor::GetStrokeStyle() const				{ return stroke_style_; } | 
					
						
							|  |  |  |  | 	inline Geometry				ShapeActor::GetGeometry() const					{ return geo_; } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-10 11:43:07 +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); } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-10 11:43:07 +08:00
										 |  |  |  | 	inline Size const&			RectActor::GetRectSize() const					{ return rect_size_; } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-10 11:43:07 +08:00
										 |  |  |  | 	inline Vec2					RoundRectActor::GetRadius() const				{ return radius_; } | 
					
						
							|  |  |  |  | 	inline Size					RoundRectActor::GetRectSize() const				{ return GetSize(); } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-01-10 11:43:07 +08:00
										 |  |  |  | 	inline float				CircleActor::GetRadius() const					{ return radius_; } | 
					
						
							| 
									
										
										
										
											2019-12-23 18:05:08 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	inline Vec2			EllipseActor::GetRadius() const					{ return radius_; } | 
					
						
							| 
									
										
										
										
											2019-03-31 01:37:06 +08:00
										 |  |  |  | } |