CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
pen.h
1
2#ifndef _aspose_drawing_pen_h_
3#define _aspose_drawing_pen_h_
4
5#include "drawing/color.h"
6#include "drawing/brush.h"
7#include "drawing/drawing2d/line_cap.h"
8#include "drawing/drawing2d/line_join.h"
9#include "drawing/drawing2d/dash_cap.h"
10#include "drawing/drawing2d/dash_style.h"
11#include "drawing/drawing2d/pen_alignment.h"
12#include "drawing/drawing2d/matrix.h"
13#include "drawing/drawing2d/matrix_order.h"
14#include "drawing/drawing2d/pen_type.h"
15#include "system/exceptions.h"
16#include <cstdint>
17
18#ifdef ASPOSECPPLIB_BEING_BUILT
19#include "core/SkColor.h"
20#include "core/SkPath.h"
21#include "core/SkPathEffect.h"
22#endif
23
25ASPOSECPP_3RD_PARTY_TYPEDEF(SkColor, std::uint32_t);
27ASPOSECPP_3RD_PARTY_CLASS(SkPaint);
29ASPOSECPP_3RD_PARTY_CLASS(SkPath);
31ASPOSECPP_3RD_PARTY_CLASS(SkPathEffect);
33ASPOSECPP_3RD_PARTY_TYPEDEF(SkScalar, float);
34
35template <typename T> class sk_sp;
36
37namespace System { namespace Drawing {
38
39namespace Drawing2D { class CustomLineCap; }
40namespace Drawing2D { class GraphicsPath; }
41namespace Details { namespace Skia { class SkPaints; } }
42
47class ASPOSECPP_SHARED_CLASS Pen : public Object
48{
49public:
52 ASPOSECPP_SHARED_API Pen(const Color & color);
56 ASPOSECPP_SHARED_API Pen(const Color & color, float width);
59 ASPOSECPP_SHARED_API Pen(const SharedPtr<Brush>& brush);
63 ASPOSECPP_SHARED_API Pen(const SharedPtr<Brush>& brush, float width);
64
66 ASPOSECPP_SHARED_API Drawing2D::PenAlignment get_Alignment() const;
69 ASPOSECPP_SHARED_API void set_Alignment(Drawing2D::PenAlignment value);
70
72 ASPOSECPP_SHARED_API float get_Width() const;
75 ASPOSECPP_SHARED_API void set_Width(float value);
76
78 ASPOSECPP_SHARED_API Drawing2D::LineCap get_StartCap() const;
81 ASPOSECPP_SHARED_API void set_StartCap(Drawing2D::LineCap value);
82
84 ASPOSECPP_SHARED_API Drawing2D::LineCap get_EndCap() const;
87 ASPOSECPP_SHARED_API void set_EndCap(Drawing2D::LineCap value);
88
90 ASPOSECPP_SHARED_API Drawing2D::LineJoin get_LineJoin() const;
93 ASPOSECPP_SHARED_API void set_LineJoin(Drawing2D::LineJoin value);
94
96 ASPOSECPP_SHARED_API float get_MiterLimit() const;
99 ASPOSECPP_SHARED_API void set_MiterLimit(float value);
100
102 ASPOSECPP_SHARED_API float get_DashOffset() const;
105 ASPOSECPP_SHARED_API void set_DashOffset(float value);
106
108 ASPOSECPP_SHARED_API Drawing2D::DashCap get_DashCap() const;
111 ASPOSECPP_SHARED_API void set_DashCap(Drawing2D::DashCap value);
112
114 ASPOSECPP_SHARED_API Drawing2D::DashStyle get_DashStyle() const;
117 ASPOSECPP_SHARED_API void set_DashStyle(Drawing2D::DashStyle value);
118
120 ASPOSECPP_SHARED_API System::ArrayPtr<float> get_DashPattern() const;
123 ASPOSECPP_SHARED_API void set_DashPattern(const System::ArrayPtr<float>& value);
124
126 ASPOSECPP_SHARED_API System::ArrayPtr<float> get_CompoundArray() const;
129 ASPOSECPP_SHARED_API void set_CompoundArray(const System::ArrayPtr<float>& value);
130
137 ASPOSECPP_SHARED_API void set_Transform(const SharedPtr<Drawing2D::Matrix>& value);
138
141 ASPOSECPP_SHARED_API void set_CustomStartCap(const SharedPtr<Drawing2D::CustomLineCap>& value);
144 ASPOSECPP_SHARED_API void set_CustomEndCap(const SharedPtr<Drawing2D::CustomLineCap>& value);
145
148 ASPOSECPP_SHARED_API void set_Brush(const SharedPtr<Brush>& brush);
150 ASPOSECPP_SHARED_API SharedPtr<Brush> get_Brush();
151
154 ASPOSECPP_SHARED_API void set_Color(const Color & color);
156 ASPOSECPP_SHARED_API Color get_Color() const;
158 ASPOSECPP_SHARED_API SharedPtr<Pen> Clone();
159
161 ASPOSECPP_SHARED_API void ResetTransform();
162
167
171 ASPOSECPP_SHARED_API void RotateTransform(float angle, Drawing2D::MatrixOrder order = Drawing2D::MatrixOrder::Prepend);
176 ASPOSECPP_SHARED_API void ScaleTransform(float sx, float sy, Drawing2D::MatrixOrder order = Drawing2D::MatrixOrder::Prepend);
181 ASPOSECPP_SHARED_API void TranslateTransform(float dx, float dy, Drawing2D::MatrixOrder order = Drawing2D::MatrixOrder::Prepend);
184 ASPOSECPP_SHARED_API void SetLineCap(Drawing2D::LineCap startCap, Drawing2D::LineCap endCap, Drawing2D::DashCap dashCap);
187 ASPOSECPP_SHARED_API Drawing2D::PenType get_PenType() const;
189 void Dispose() { };
190
191protected:
192 friend class Graphics;
199 virtual ASPOSECPP_SHARED_API void Apply(SkPaint &paint, const SharedPtr<Drawing2D::Matrix>& matrix, bool antialiased = false,
200 bool is_closed_path = false);
201
202private:
204 void Init();
208 System::ArrayPtr<float> GetPatternForDashStyle(Drawing2D::DashStyle value);
209
211 Details::Skia::SkPaints MakeCustomCaps(const SkPaint& base_paint, float& start_cap_inset, float& end_cap_inset,
212 float scale_x, float scale_y) const;
213
215 Details::Skia::SkPaints MakeMainEffects(const SkPaint& base_paint, const SharedPtr<Drawing2D::Matrix>& matrix,
216 float phase, float start_cap_inset, float end_cap_inset,
217 bool is_closed_path) const;
219 Details::Skia::SkPaints MakeCompoundEffect(const SkPaint& base_paint, sk_sp<SkPathEffect> dash_path_effect) const;
220
226 void AppendCapsPath(const SkPath* src_path, SkPath* dest_path, SharedPtr<Drawing2D::CustomLineCap> start_cap,
228
232 void ApplyOutlineEffect(const SkPath* src_path, SkPath* dest_path) const;
233
236 bool IsApplyDashCaps(bool is_closed_path) const;
237
238private:
240 SharedPtr<Brush> m_brush;
242 SkScalar m_sk_width;
243
244 float m_sk_miter_limit = 10.0f;
245 float m_dash_offset = 0;
246
248 Drawing2D::DashCap m_dash_cap;
250 Drawing2D::LineCap m_start_cap;
252 Drawing2D::LineCap m_end_cap;
254 Drawing2D::DashStyle m_dash_style;
256 Drawing2D::LineJoin m_line_join;
258 Drawing2D::PenAlignment m_pen_alignment;
259
261 ArrayPtr<float> m_dash_pattern;
263 ArrayPtr<float> m_compound_array;
264
266 SharedPtr<Drawing2D::CustomLineCap> m_custom_start_cap;
269
271 SharedPtr<Drawing2D::Matrix> m_transform_matrix;
272};
273
274}} // System::Drawing
275
276#endif // _aspose_drawing_pen_h_
Represents a color. This type should be allocated on stack and passed to functions by value or by ref...
Definition: color.h:24
Represents a set of connected lines and curves. Objects of this class should only be allocated using ...
Definition: graphics_path.h:80
Represents a drawing surface. Objects of this class should only be allocated using System::MakeObject...
Definition: graphics.h:68
Represents properties such as color, width etc. of the lines and curves being drawn....
Definition: pen.h:48
SharedPtr< Drawing2D::Matrix > get_Transform()
Returns a copy of a Matrix object that specifies the geometrical transformations for the pen represne...
Pen(const SharedPtr< Brush > &brush)
Constructs a new Pen object and initializes it with the specified Brush object.
void set_EndCap(Drawing2D::LineCap value)
Sets the ending line cap of the current Pen object.
void SetLineCap(Drawing2D::LineCap startCap, Drawing2D::LineCap endCap, Drawing2D::DashCap dashCap)
NOT IMPLEMENTED.
void set_DashCap(Drawing2D::DashCap value)
Sets a value that specifies the cap used at the both ends of a dashed line.
float get_MiterLimit() const
Returns the limit of the thickness of the join on a mitered corner.
void set_Brush(const SharedPtr< Brush > &brush)
Sets this pen's Brush object.
void ResetTransform()
Resets the current object's transform matrix so that it becomes an identity matrix.
void set_Transform(const SharedPtr< Drawing2D::Matrix > &value)
Sets a Matrix object that specifies the geometrical transformations for the pen represneted by the cu...
void set_Color(const Color &color)
Sets this pen's color.
void MultiplyTransform(const SharedPtr< Drawing2D::Matrix > &matrix, Drawing2D::MatrixOrder order=Drawing2D::MatrixOrder::Prepend)
Multiplies current object's transform matrix by the specified matrix.
void Dispose()
Releases all operating resources acquired by the current object.
Definition: pen.h:189
void set_DashOffset(float value)
Sets the distance from the start of a line to the beginning of a dash pattern.
float get_DashOffset() const
Returns the distance from the start of a line to the beginning of a dash pattern.
System::ArrayPtr< float > get_CompoundArray() const
Returns an array of values that specifies a compound pen.
SharedPtr< Brush > get_Brush()
Returns this pen's Brush object.
virtual void Apply(SkPaint &paint, const SharedPtr< Drawing2D::Matrix > &matrix, bool antialiased=false, bool is_closed_path=false)
Sets the properties of the current pen on the specified SkPaint object.
void set_DashStyle(Drawing2D::DashStyle value)
Sets a value that specifies the dash style of the current Pen object.
void set_MiterLimit(float value)
Sets the limit of the thickness of the join on a mitered corner.
void set_CustomStartCap(const SharedPtr< Drawing2D::CustomLineCap > &value)
Sets the custom start line cap.
Pen(const Color &color, float width)
Constructs a new Pen object representing the specified color and width.
void RotateTransform(float angle, Drawing2D::MatrixOrder order=Drawing2D::MatrixOrder::Prepend)
Rotates the local geometric transformation by the specified angle in the specified order.
void set_CompoundArray(const System::ArrayPtr< float > &value)
Sets an array of values that specifies a compound pen.
void set_LineJoin(Drawing2D::LineJoin value)
Sets a value that specifies how the lines drawn by this Pen object are joined.
void set_Alignment(Drawing2D::PenAlignment value)
Sets the alignment of the current Pen object.
void set_Width(float value)
Sets the width of the current Pen object.
void ScaleTransform(float sx, float sy, Drawing2D::MatrixOrder order=Drawing2D::MatrixOrder::Prepend)
Scales the local geometric transformation by the specified factors in the specified order.
Drawing2D::PenType get_PenType() const
NOT IMPLEMENTED.
Color get_Color() const
Returns this pen's color.
Drawing2D::LineJoin get_LineJoin() const
Returns a value that indicates how the lines drawn by this Pen object are joined.
void TranslateTransform(float dx, float dy, Drawing2D::MatrixOrder order=Drawing2D::MatrixOrder::Prepend)
Translates the local geometric transformation by the specified dimensions in the specified order.
void set_StartCap(Drawing2D::LineCap value)
Sets the starting line cap of the current Pen object.
Pen(const SharedPtr< Brush > &brush, float width)
Constructs a new Pen object and initializes it with the specified Brush object.
SharedPtr< Pen > Clone()
Returns a copy of the current object.
Drawing2D::LineCap get_StartCap() const
Returns a value that indicates the starting line cap of the current Pen object.
System::ArrayPtr< float > get_DashPattern() const
Returns an array indicating custom dash pattern in a dashed line.
void set_DashPattern(const System::ArrayPtr< float > &value)
Sets an array specifying custom dash pattern in a dashed line. The array consists of numbers that spe...
Drawing2D::LineCap get_EndCap() const
Returns a value that indicates the ending line cap of the current Pen object.
Drawing2D::DashStyle get_DashStyle() const
Returns a value that indicates the dash style of the current Pen object.
float get_Width() const
Returns the width of the current Pen object.
Drawing2D::PenAlignment get_Alignment() const
Returns a value that indicates the alignment of the current Pen object.
void set_CustomEndCap(const SharedPtr< Drawing2D::CustomLineCap > &value)
Sets the custom end line cap.
Drawing2D::DashCap get_DashCap() const
Returns a value that indicates the cap used at the both ends of a dashed line.
Pen(const Color &color)
Constructs a new Pen object representing the specified color.
Base class that enables using methods available for System.Object class in C#. All non-trivial classe...
Definition: object.h:62
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
DashCap
Specifies the type of a cap used at the both ends of a dash in a dashed line.
Definition: dash_cap.h:9
LineCap
Indicates the available cap styles with which a Pen object can end a line.
Definition: line_cap.h:9
PenType
Specifies a type of a fill Pen object uses.
Definition: pen_type.h:8
DashStyle
Specifies the style of a dashed line.
Definition: dash_style.h:9
LineJoin
Specifies how consequent lines or curves are joined.
Definition: line_join.h:9
PenAlignment
Specifies the alignment of a Pen object relative to an abstract reference 0-width line.
Definition: pen_alignment.h:7
MatrixOrder
Specifies the order of matrix transform operations.
Definition: matrix_order.h:7
@ Prepend
The new operation is applied before the old operation.
Definition: db_command.h:9