8#include "drawing/brush.h"
9#include "drawing/color.h"
10#include "drawing/rectangle_f.h"
11#include "drawing/drawing2d/linear_gradient_mode.h"
12#include "drawing/drawing2d/matrix.h"
13#include "drawing/drawing2d/matrix_order.h"
14#include "drawing/drawing2d/wrap_mode.h"
18#ifdef ASPOSECPPLIB_BEING_BUILT
19#include <core/SkPoint.h>
20#include <core/SkColor.h>
21#include <core/SkScalar.h>
25ASPOSECPP_3RD_PARTY_TYPEDEF(SkColor, std::uint32_t);
27ASPOSECPP_3RD_PARTY_CLASS(SkPaint);
29ASPOSECPP_3RD_PARTY_STRUCT(SkPoint);
31ASPOSECPP_3RD_PARTY_TYPEDEF(SkScalar,
float);
33namespace System {
namespace Drawing {
namespace Drawing2D {
37 typedef std::array<SkPoint, 2> SkPoints;
39 ASPOSECPP_3RD_PARTY_TYPE_HOLDER_HIDDEN_TYPE(SkPoints, SkPoints, 2*2*
sizeof(
float),
float, SkPointsHolder);
175 typedef std::tuple<Detail::SkPointsHolder, RectangleF, float, bool> GradientInnerData;
186 static GradientInnerData CalculateInnerData(
const PointF& point1,
const PointF& point2);
191 static GradientInnerData CalculateInnerData(
const RectangleF& rect,
float angle,
bool isAngleScaleable);
196 void SetupInitialMatrix(
bool isAngleScaleable);
198 void InterpolateColors();
202 const Detail::SkPointsHolder m_points;
212 std::vector<SkColor> m_colors;
213 std::vector<float> m_factors;
215 std::vector<SkScalar> m_positions;
216 bool m_interpolation_colors =
false;
223 bool m_gamma_correction =
false;
A base class for classes that represent fillers used to fill the interiors of graphical shapes....
Definition: brush.h:18
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 linear gradient brush. Objects of this class should only be allocated using System::Make...
Definition: linear_gradient_brush.h:50
LinearGradientBrush(const Rectangle &rect, const Color &color1, const Color &color2, float angle, bool isAngleScaleable=false)
Constructs a new instance of LinearGradientBrush.
void set_Blend(const SharedPtr< Blend > &value)
Sets a blend that specifies factors and positions of base colors for this brush.
void set_LinearColors(const ArrayPtr< Color > &value)
Sets starting and ending colors of this gradient.
LinearGradientBrush(const Point &point1, const Point &point2, const Color &color1, const Color &color2)
Constructs a new instance of LinearGradientBrush.
ArrayPtr< Color > get_LinearColors() const
Returns starting and ending colors of this gradient.
SharedPtr< Brush > Clone() override
Creates a copy of the current object.
void SetSigmaBellShape(float focus, float scale=1.0f)
NOT IMPLEMENTED.
SharedPtr< Matrix > get_Transform() const
Returns a copy of a Matrix object that specifies the geometrical transformations for the brush repres...
void MultiplyTransform(const SharedPtr< Matrix > &matrix, MatrixOrder order=MatrixOrder::Prepend)
Multiplies current object's transform matrix by the specified matrix.
void set_InterpolationColors(const SharedPtr< ColorBlend > &value)
Sets a ColorBlend object that defines a multicolor linear gradient.
LinearGradientBrush(const PointF &point1, const PointF &point2, const Color &color1, const Color &color2)
Constructs a new instance of LinearGradientBrush.
void set_WrapMode(WrapMode value)
Sets the wrap mode.
LinearGradientBrush(const RectangleF &rect, const Color &color1, const Color &color2, LinearGradientMode linearGradientMode)
Constructs a new instance of LinearGradientBrush.
void Apply(SkPaint &paint, const SharedPtr< Drawing2D::Matrix > &matrix, bool apply_shift) override
Sets the properties of the current brush on the specified SkPaint object.
bool get_GammaCorrection() const
Returns a value indicating that gamma correction is enabled for this brush.
RectangleF get_Rectangle()
Returns a bounding rectangle.
void set_GammaCorrection(bool value)
Sets gamma correction status for this brush.
LinearGradientBrush(const Rectangle &rect, const Color &color1, const Color &color2, LinearGradientMode linearGradientMode)
Constructs a new instance of LinearGradientBrush.
void SetBlendTriangularShape(float focus, float scale=1.0f)
NOT IMPLEMENTED.
void TranslateTransform(float dx, float dy, Drawing2D::MatrixOrder order=Drawing2D::MatrixOrder::Prepend)
Translates current object's transform matrix.
SharedPtr< Blend > get_Blend() const
Returns a blend that specifies factors and positions of base colors for this brush.
WrapMode get_WrapMode() const
Returns the wrap mode.
void ResetTransform()
Resets current object's transformation matrix.
void RotateTransform(float angle, MatrixOrder order=MatrixOrder::Prepend)
Rotates current object's transform matrix.
LinearGradientBrush(const RectangleF &rect, const Color &color1, const Color &color2, float angle, bool isAngleScaleable=false)
Constructs a new instance of LinearGradientBrush.
void set_Transform(const SharedPtr< Matrix > &value)
Sets a Matrix object that specifies the geometrical transformations for the brush represented by the ...
SharedPtr< ColorBlend > get_InterpolationColors() const
Returns a ColorBlend object that defines a multicolor linear gradient.
void ScaleTransform(float sx, float sy, MatrixOrder order=MatrixOrder::Prepend)
Scales current object's transform matrix.
Represents a pair of single-precision floating point X and Y coordinates of a point on a 2-dimensiona...
Definition: point_f.h:14
Represents a pair of integer X and Y coordinates of a point on a 2-dimensional plane....
Definition: point.h:15
Represents a rectangular area of an image defined as single-precision floating point X and Y coordina...
Definition: rectangle_f.h:15
Represents a rectangular area of an image defined as integer X and Y coordinates of its upper left co...
Definition: rectangle.h:19
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
LinearGradientMode
Represents a linear gradient direction.
Definition: linear_gradient_mode.h:10
MatrixOrder
Specifies the order of matrix transform operations.
Definition: matrix_order.h:7
@ Prepend
The new operation is applied before the old operation.
WrapMode
Specifies how a texture or a gradient is tiled when it is smaller than the area being filled.
Definition: wrap_mode.h:9
@ Tile
Tiles the gradient or texture.
Definition: db_command.h:9