Stroke.h
1 //////////////////////////////////////////////////////////////////////////
2 // Copyright 2001-2019 Aspose Pty Ltd. All Rights Reserved.
3 //
4 // This file is part of Aspose.Words. The source code in this file
5 // is only intended as a supplement to the documentation, and is provided
6 // "as is", without warranty of any kind, either expressed or implied.
7 //////////////////////////////////////////////////////////////////////////
8 #pragma once
9 
10 
11 #include <system/shared_ptr.h>
12 #include <system/object.h>
13 #include <system/array.h>
14 #include <drawing/color.h>
15 
16 #include "Aspose.Words.Cpp/Model/Drawing/ShapeLineStyle.h"
17 #include "Aspose.Words.Cpp/Model/Drawing/JoinStyle.h"
18 #include "Aspose.Words.Cpp/Model/Drawing/EndCap.h"
19 #include "Aspose.Words.Cpp/Model/Drawing/DashStyle.h"
20 #include "Aspose.Words.Cpp/Model/Drawing/ArrowWidth.h"
21 #include "Aspose.Words.Cpp/Model/Drawing/ArrowType.h"
22 #include "Aspose.Words.Cpp/Model/Drawing/ArrowLength.h"
23 #include "Aspose.Words.Cpp/aspose_words_api_defs.h"
24 
25 namespace Aspose { namespace Words { namespace ApsBuilder { namespace Shapes { class PenFactory; } } } }
26 namespace Aspose { namespace Words { namespace ApsBuilder { namespace Shapes { class InternalColorResolver; } } } }
27 namespace Aspose { namespace Words { namespace RW { namespace Html { namespace Writer { class HtmlImageWriter; } } } } }
28 namespace Aspose { namespace Words { namespace Drawing { class Shape; } } }
29 namespace Aspose { namespace Words { namespace ApsBuilder { namespace Shapes { class ShapeApsBuilder; } } } }
30 namespace Aspose { namespace Words { namespace ApsBuilder { namespace Shapes { class ShapeBoundsFinder; } } } }
31 namespace Aspose { namespace Words { namespace RW { namespace Html { namespace Css { namespace New { class CssBorderNew; } } } } } }
32 namespace Aspose { namespace Words { namespace Drawing { namespace Core { enum class LineFillType; } } } }
33 namespace Aspose { namespace Drawing { class DrColor; } }
34 namespace Aspose { namespace Drawing { class DrLineCapsStyle; } }
35 namespace Aspose { namespace Words { namespace Drawing { namespace Core { class IStroke; } } } }
36 namespace Aspose { namespace Drawing { enum class DrLineEndType; } }
37 namespace Aspose { namespace Drawing { enum class DrLineEndSize; } }
38 namespace Aspose { namespace Drawing { enum class DrLineEndingCapType; } }
39 
40 namespace Aspose {
41 
42 namespace Words {
43 
44 namespace Drawing {
45 
46 
47 /// <summary>
48 /// Defines a stroke for a shape.
49 /// </summary>
50 /// <remarks>
51 /// <p>Use the <see cref="Aspose::Words::Drawing::Shape::get_Stroke" /> property to access stroke properties of a shape.
52 /// You do not create instances of the <see cref="Aspose::Words::Drawing::Stroke" /> class directly.</p>
53 /// <seealso cref="Aspose::Words::Drawing::Shape::get_Stroke" />
54 /// </remarks>
55 class Stroke : public System::Object
56 {
57  typedef Stroke ThisType;
58  typedef System::Object BaseType;
59 
60  typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
61  ASPOSE_WORDS_SHARED_RTTI_INFO_DECL();
62 
64  friend class Aspose::Words::ApsBuilder::Shapes::PenFactory;
65  friend class Aspose::Words::ApsBuilder::Shapes::InternalColorResolver;
66  friend class Aspose::Words::RW::Html::Writer::HtmlImageWriter;
67  friend class Aspose::Words::Drawing::Shape;
68  friend class Aspose::Words::ApsBuilder::Shapes::ShapeApsBuilder;
69  friend class Aspose::Words::ApsBuilder::Shapes::ShapeBoundsFinder;
70  friend class Aspose::Words::RW::Html::Css::New::CssBorderNew;
71 
72 public:
73 
74  /// <summary>
75  /// Defines whether the path will be stroked.
76  /// </summary>
77  /// <remarks>
78  /// <p>The default value is <b>true</b>.</p>
79  /// </remarks>
80  ASPOSE_WORDS_SHARED_API bool get_On();
81  /// Setter for Aspose::Words::Drawing::Stroke::get_On
82  ASPOSE_WORDS_SHARED_API void set_On(bool value);
83  /// <summary>
84  /// Defines the brush thickness that strokes the path of a shape in points.
85  /// </summary>
86  /// <remarks>
87  /// <p>The default value is 0.75.</p>
88  /// </remarks>
89  ASPOSE_WORDS_SHARED_API double get_Weight();
90  /// Setter for Aspose::Words::Drawing::Stroke::get_Weight
91  ASPOSE_WORDS_SHARED_API void set_Weight(double value);
92  /// <summary>
93  /// Defines the color of a stroke.
94  /// </summary>
95  /// <remarks>
96  /// <p>The default value is
97  /// <see cref="System::Drawing::Color::get_Black" />.</p>
98  /// </remarks>
99  ASPOSE_WORDS_SHARED_API System::Drawing::Color get_Color();
100  /// Setter for Aspose::Words::Drawing::Stroke::get_Color
101  ASPOSE_WORDS_SHARED_API void set_Color(System::Drawing::Color value);
102  /// <summary>
103  /// Defines a second color for a stroke.
104  /// </summary>
105  /// <remarks>
106  /// <p>The default value is
107  /// <see cref="System::Drawing::Color::get_White" />.</p>
108  /// </remarks>
109  ASPOSE_WORDS_SHARED_API System::Drawing::Color get_Color2();
110  /// Setter for Aspose::Words::Drawing::Stroke::get_Color2
111  ASPOSE_WORDS_SHARED_API void set_Color2(System::Drawing::Color value);
112  /// <summary>
113  /// Specifies the dot and dash pattern for a stroke.
114  /// </summary>
115  /// <remarks>
116  /// <p>The default value is <see cref="Aspose::Words::Drawing::DashStyle::Solid" />.</p>
117  /// </remarks>
118  ASPOSE_WORDS_SHARED_API Aspose::Words::Drawing::DashStyle get_DashStyle();
119  /// Setter for Aspose::Words::Drawing::Stroke::get_DashStyle
120  ASPOSE_WORDS_SHARED_API void set_DashStyle(Aspose::Words::Drawing::DashStyle value);
121  /// <summary>
122  /// Defines the join style of a polyline.
123  /// </summary>
124  /// <remarks>
125  /// <p>The default value is <see cref="Aspose::Words::Drawing::JoinStyle::Round" />.</p>
126  /// </remarks>
127  ASPOSE_WORDS_SHARED_API Aspose::Words::Drawing::JoinStyle get_JoinStyle();
128  /// Setter for Aspose::Words::Drawing::Stroke::get_JoinStyle
129  ASPOSE_WORDS_SHARED_API void set_JoinStyle(Aspose::Words::Drawing::JoinStyle value);
130  /// <summary>
131  /// Defines the cap style for the end of a stroke.
132  /// </summary>
133  /// <remarks>
134  /// <p>The default value is <see cref="Aspose::Words::Drawing::EndCap::Flat" />.</p>
135  /// </remarks>
136  ASPOSE_WORDS_SHARED_API Aspose::Words::Drawing::EndCap get_EndCap();
137  /// Setter for Aspose::Words::Drawing::Stroke::get_EndCap
138  ASPOSE_WORDS_SHARED_API void set_EndCap(Aspose::Words::Drawing::EndCap value);
139  /// <summary>
140  /// Defines the line style of the stroke.
141  /// </summary>
142  /// <remarks>
143  /// <p>The default value is <see cref="Aspose::Words::Drawing::ShapeLineStyle::Single" />.</p>
144  /// </remarks>
145  ASPOSE_WORDS_SHARED_API Aspose::Words::Drawing::ShapeLineStyle get_LineStyle();
146  /// Setter for Aspose::Words::Drawing::Stroke::get_LineStyle
147  ASPOSE_WORDS_SHARED_API void set_LineStyle(Aspose::Words::Drawing::ShapeLineStyle value);
148  /// <summary>
149  /// Defines the arrowhead for the start of a stroke.
150  /// </summary>
151  /// <remarks>
152  /// <p>The default value is <see cref="Aspose::Words::Drawing::ArrowType::None" />.</p>
153  /// </remarks>
154  ASPOSE_WORDS_SHARED_API Aspose::Words::Drawing::ArrowType get_StartArrowType();
155  /// Setter for Aspose::Words::Drawing::Stroke::get_StartArrowType
156  ASPOSE_WORDS_SHARED_API void set_StartArrowType(Aspose::Words::Drawing::ArrowType value);
157  /// <summary>
158  /// Defines the arrowhead for the end of a stroke.
159  /// </summary>
160  /// <remarks>
161  /// <p>The default value is <see cref="Aspose::Words::Drawing::ArrowType::None" />.</p>
162  /// </remarks>
163  ASPOSE_WORDS_SHARED_API Aspose::Words::Drawing::ArrowType get_EndArrowType();
164  /// Setter for Aspose::Words::Drawing::Stroke::get_EndArrowType
165  ASPOSE_WORDS_SHARED_API void set_EndArrowType(Aspose::Words::Drawing::ArrowType value);
166  /// <summary>
167  /// Defines the arrowhead width for the start of a stroke.
168  /// </summary>
169  /// <remarks>
170  /// <p>The default value is <see cref="Aspose::Words::Drawing::ArrowWidth::Medium" />.</p>
171  /// </remarks>
172  ASPOSE_WORDS_SHARED_API Aspose::Words::Drawing::ArrowWidth get_StartArrowWidth();
173  /// Setter for Aspose::Words::Drawing::Stroke::get_StartArrowWidth
174  ASPOSE_WORDS_SHARED_API void set_StartArrowWidth(Aspose::Words::Drawing::ArrowWidth value);
175  /// <summary>
176  /// Defines the arrowhead length for the start of a stroke.
177  /// </summary>
178  /// <remarks>
179  /// <p>The default value is <see cref="Aspose::Words::Drawing::ArrowLength::Medium" />.</p>
180  /// </remarks>
181  ASPOSE_WORDS_SHARED_API Aspose::Words::Drawing::ArrowLength get_StartArrowLength();
182  /// Setter for Aspose::Words::Drawing::Stroke::get_StartArrowLength
183  ASPOSE_WORDS_SHARED_API void set_StartArrowLength(Aspose::Words::Drawing::ArrowLength value);
184  /// <summary>
185  /// Defines the arrowhead width for the end of a stroke.
186  /// </summary>
187  /// <remarks>
188  /// <p>The default value is <see cref="Aspose::Words::Drawing::ArrowWidth::Medium" />.</p>
189  /// </remarks>
190  ASPOSE_WORDS_SHARED_API Aspose::Words::Drawing::ArrowWidth get_EndArrowWidth();
191  /// Setter for Aspose::Words::Drawing::Stroke::get_EndArrowWidth
192  ASPOSE_WORDS_SHARED_API void set_EndArrowWidth(Aspose::Words::Drawing::ArrowWidth value);
193  /// <summary>
194  /// Defines the arrowhead length for the end of a stroke.
195  /// </summary>
196  /// <remarks>
197  /// <p>The default value is <see cref="Aspose::Words::Drawing::ArrowLength::Medium" />.</p>
198  /// </remarks>
199  ASPOSE_WORDS_SHARED_API Aspose::Words::Drawing::ArrowLength get_EndArrowLength();
200  /// Setter for Aspose::Words::Drawing::Stroke::get_EndArrowLength
201  ASPOSE_WORDS_SHARED_API void set_EndArrowLength(Aspose::Words::Drawing::ArrowLength value);
202  /// <summary>
203  /// Defines the amount of transparency of a stroke. Valid range is from 0 to 1.
204  /// </summary>
205  /// <remarks>
206  /// <p>The default value is 1.</p>
207  /// </remarks>
208  ASPOSE_WORDS_SHARED_API double get_Opacity();
209  /// Setter for Aspose::Words::Drawing::Stroke::get_Opacity
210  ASPOSE_WORDS_SHARED_API void set_Opacity(double value);
211  /// <summary>
212  /// Defines the image for a stroke image or pattern fill.
213  /// </summary>
214  ASPOSE_WORDS_SHARED_API System::ArrayPtr<uint8_t> get_ImageBytes();
215 
216 protected:
217 
218  System::SharedPtr<Aspose::Drawing::DrColor> get_ColorInternal();
219  void set_ColorInternal(System::SharedPtr<Aspose::Drawing::DrColor> value);
220  System::SharedPtr<Aspose::Drawing::DrColor> get_Color2Internal();
221  void set_Color2Internal(System::SharedPtr<Aspose::Drawing::DrColor> value);
222  Aspose::Words::Drawing::Core::LineFillType get_LineFillType();
223  void set_LineFillType(Aspose::Words::Drawing::Core::LineFillType value);
224  System::SharedPtr<Aspose::Drawing::DrLineCapsStyle> get_LineCapsStyle();
225 
226  Stroke(System::SharedPtr<Aspose::Words::Drawing::Shape> shape);
227 
228  ASPOSE_WORDS_SHARED_API System::Object::shared_members_type GetSharedMembers() override;
229 
230 private:
231 
232  System::SharedPtr<Aspose::Words::Drawing::Core::IStroke> get_StrokeCore();
233  bool get_IsVmlOutline();
234 
235  System::WeakPtr<Aspose::Words::Drawing::Shape> mShape;
236  System::SharedPtr<Aspose::Words::Drawing::Core::IStroke> mStrokeCoreCache;
237  System::SharedPtr<Aspose::Drawing::DrLineCapsStyle> mCapStyle;
238 
239  void BuildCapsStyle();
240  static Aspose::Drawing::DrLineEndType ToDrLineEndType(Aspose::Words::Drawing::ArrowType type);
241  static Aspose::Drawing::DrLineEndSize ToDrLineEndSizeFromWidth(Aspose::Words::Drawing::ArrowWidth width);
242  static Aspose::Drawing::DrLineEndSize ToDrLineEndSizeFromLength(Aspose::Words::Drawing::ArrowLength length);
243  static Aspose::Drawing::DrLineEndingCapType ToDrLineEndingCapType(Aspose::Words::Drawing::EndCap endCap);
244 
245 };
246 
247 }
248 }
249 }
Definition: IFontData.h:19
Insert line breaks after every 76th character.
Definition: Border.h:65
#define FRIEND_FUNCTION_System_MakeObject
Macro to befriend MakeObject function.
Definition: smart_ptr.h:1366