System::Drawing::Drawing2D::Matrix Class Reference

Represents a 3x3 matrix that defines transform operations. Objects of this class should only be allocated using System::MakeObject() function. Never create instance of this type on stack or using operator new, as it will result in runtime errors and/or assertion faults. Always wrap this class into System::SmartPtr pointer and use this pointer to pass it to functions as argument. More...

Inherits System::Object.

Public Member Functions

ASPOSECPP_SHARED_API Matrix ()
 Constructs a new instance of Matrix class that represents an identity matrix. More...
 
ASPOSECPP_SHARED_API Matrix (float m11, float m12, float m21, float m22, float dx, float dy)
 Constructs a new instance of Matrix class and initializes it with the specified values. More...
 
ASPOSECPP_SHARED_API Matrix (const Rectangle &rect, const ArrayPtr< Point > &plgpts)
 Constructs a new instance of the Matrix class to the geometric transform defined by the specified rectangle and array of points. More...
 
ASPOSECPP_SHARED_API Matrix (const RectangleF &rect, const ArrayPtr< PointF > &plgpts)
 Constructs a new instance of the Matrix class to the geometric transform defined by the specified rectangle and array of points. More...
 
virtual ASPOSECPP_SHARED_API ~Matrix ()
 Destructor. More...
 
ASPOSECPP_SHARED_API System::ArrayPtr< float > get_Elements () const
 Returns an arry containing the elements of the matrix in the following order: m11, m12, m21, m22, dx, dy. More...
 
ASPOSECPP_SHARED_API float get_OffsetX () const
 Returns the X translation value of the matrix represented by the current object. More...
 
ASPOSECPP_SHARED_API float get_OffsetY () const
 Returns the Y translation value of the matrix represented by the current object. More...
 
ASPOSECPP_SHARED_API bool get_IsIdentity () const
 Determines if the matrix represented by the current object is an identity matrix. More...
 
ASPOSECPP_SHARED_API bool get_IsInvertible () const
 Determines if the matrix represented by the current object is invertible. More...
 
ASPOSECPP_SHARED_API void Invert ()
 Inverts the matrix represented by the current object. More...
 
ASPOSECPP_SHARED_API void Reset ()
 Resets the matrix represented by the current object so that it becomes an identity matrix. More...
 
ASPOSECPP_SHARED_API void Multiply (const SharedPtr< Matrix > &matrix)
 Multiplies the matrix represented by the current object by the specified matrix. More...
 
ASPOSECPP_SHARED_API void Multiply (const SharedPtr< Matrix > &matrix, MatrixOrder order)
 Multiplies the matrix represented by the current object by the specified matrix. More...
 
ASPOSECPP_SHARED_API void Rotate (float angle)
 Rotates the matrix represented by the current object clockwise by the specified angle. More...
 
ASPOSECPP_SHARED_API void Rotate (float angle, MatrixOrder order)
 Rotates the matrix represented by the current object clockwise around the origin by the specified angle. More...
 
ASPOSECPP_SHARED_API void RotateAt (float angle, const PointF &point)
 Rotates the matrix represented by the current object clockwise around the specified point by the specified angle. More...
 
ASPOSECPP_SHARED_API void RotateAt (float angle, const PointF &point, MatrixOrder order)
 Rotates the matrix represented by the current object clockwise around the specified point by the specified angle. More...
 
ASPOSECPP_SHARED_API void Scale (float scaleX, float scaleY)
 Applies the specified scale vector to the matrix represented by the current object. More...
 
ASPOSECPP_SHARED_API void Scale (float scaleX, float scaleY, MatrixOrder order)
 Applies the specified scale vector to the matrix represented by the current object. More...
 
ASPOSECPP_SHARED_API void Shear (float shearX, float shearY)
 Applies the specified shear vector to the matrix represented by the current object. More...
 
ASPOSECPP_SHARED_API void Shear (float shearX, float shearY, MatrixOrder order)
 Applies the specified shear vector to the matrix represented by the current object. More...
 
ASPOSECPP_SHARED_API void Translate (float offsetX, float offsetY)
 Applies the specified translate vector to the matrix represented by the current object. More...
 
ASPOSECPP_SHARED_API void Translate (float offsetX, float offsetY, MatrixOrder order)
 Applies the specified translate vector to the matrix represented by the current object. More...
 
ASPOSECPP_SHARED_API void TransformPoints (const ArrayPtr< Point > &pts)
 Applies the geometric transformation defined by the matrix represented by the current object to the specified points. More...
 
ASPOSECPP_SHARED_API void TransformPoints (const System::Details::ArrayView< Point > &pts)
 Applies the geometric transformation defined by the matrix represented by the current object to the specified points. More...
 
ASPOSECPP_SHARED_API void TransformPoints (const ArrayPtr< PointF > &pts)
 Applies the geometric transformation defined by the matrix represented by the current object to the specified points. More...
 
ASPOSECPP_SHARED_API void TransformPoints (const System::Details::ArrayView< PointF > &pts)
 Applies the geometric transformation defined by the matrix represented by the current object to the specified points. More...
 
ASPOSECPP_SHARED_API void TransformVectors (const ArrayPtr< Point > &pts)
 Applies only the scale and rotate components of the matrix represented by the current object to the specified points. More...
 
ASPOSECPP_SHARED_API void TransformVectors (const System::Details::ArrayView< Point > &pts)
 Applies only the scale and rotate components of the matrix represented by the current object to the specified points. More...
 
ASPOSECPP_SHARED_API void TransformVectors (const ArrayPtr< PointF > &pts)
 Applies only the scale and rotate components of the matrix represented by the current object to the specified points. More...
 
ASPOSECPP_SHARED_API void TransformVectors (const System::Details::ArrayView< PointF > &pts)
 Applies only the scale and rotate components of the matrix represented by the current object to the specified points. More...
 
ASPOSECPP_SHARED_API void VectorTransformPoints (const ArrayPtr< Point > &pts)
 Multiplies each vector in an array by the matrix represented by the current object. More...
 
ASPOSECPP_SHARED_API void VectorTransformPoints (const System::Details::ArrayView< Point > &pts)
 Multiplies each vector in an array by the matrix represented by the current object. More...
 
bool Equals (ptr obj) override
 Tests whether the specified object is a Matrix and is identical to this object. More...
 
ASPOSECPP_SHARED_API SharedPtr< MatrixClone () const
 Creates a copy of the current object. More...
 
void Dispose ()
 Releases all operating system resources acquired by the current object. More...
 
- Public Member Functions inherited from System::Object
ASPOSECPP_SHARED_API Object ()
 Creates object. Initializes all internal data structures. More...
 
virtual ASPOSECPP_SHARED_API ~Object ()
 Destroys object. Frees all internal data structures. More...
 
ASPOSECPP_SHARED_API Object (Object const &x)
 Copy constructor. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
Objectoperator= (Object const &x)
 Assignment operator. Doesn't copy anything, really, just initializes new object and enables copy constructing subclasses. More...
 
ObjectSharedRefAdded ()
 Increments shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int SharedRefRemovedSafe ()
 Decrements and returns shared reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
int RemovedSharedRefs (int count)
 Decreases shared reference count by specified value. More...
 
Detail::SmartPtrCounter * WeakRefAdded ()
 Increments weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
void WeakRefRemoved ()
 Decrements weak reference count. Shouldn't be called directly; instead, use smart pointers or ThisProtector. More...
 
Detail::SmartPtrCounter * GetCounter ()
 Gets reference counter data structure associated with the object. More...
 
int SharedCount () const
 Gets current value of shared reference counter. More...
 
ASPOSECPP_SHARED_API void Lock ()
 Implements C# lock() statement locking. Call directly or use LockContext sentry object. More...
 
ASPOSECPP_SHARED_API void Unlock ()
 Implements C# lock() statement unlocking. Call directly or use LockContext sentry object. More...
 
virtual ASPOSECPP_SHARED_API int32_t GetHashCode () const
 Analog of C# Object.GetHashCode() method. Enables hashing of custom objects. More...
 
virtual ASPOSECPP_SHARED_API String ToString () const
 Analog of C# Object.ToString() method. Enables converting custom objects to string. More...
 
virtual ASPOSECPP_SHARED_API ptr MemberwiseClone () const
 Analog of C# Object.MemberwiseClone() method. Enables cloning custom types. More...
 
virtual ASPOSECPP_SHARED_API const TypeInfoGetType () const
 Gets actual type of object. Analog of C# System.Object.GetType() call. More...
 
virtual ASPOSECPP_SHARED_API bool Is (const TypeInfo &targetType) const
 Check if object represents an instance of type described by targetType. Analog of C# 'is' operator. More...
 
virtual ASPOSECPP_SHARED_API void SetTemplateWeakPtr (uint32_t argument)
 Set n'th template argument a weak pointer (rather than shared). Allows switching pointers in containers to weak mode. More...
 
virtual ASPOSECPP_SHARED_API bool FastCast (const Details::FastRttiBase &helper, void **out_ptr) const
 For internal purposes only. More...
 
template<>
bool Equals (float const &objA, float const &objB)
 Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN. More...
 
template<>
bool Equals (double const &objA, double const &objB)
 Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN. More...
 
template<>
bool ReferenceEquals (String const &str, std::nullptr_t)
 Specialization of Object::ReferenceEquals for case of string and nullptr. More...
 
template<>
bool ReferenceEquals (String const &str1, String const &str2)
 Specialization of Object::ReferenceEquals for case of strings. More...
 

Additional Inherited Members

- Public Types inherited from System::Object
typedef SmartPtr< Objectptr
 Alias for smart pointer type. More...
 
- Static Public Member Functions inherited from System::Object
static bool ReferenceEquals (ptr const &objA, ptr const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, T const &objB)
 Compares objects by reference. More...
 
template<typename T >
static std::enable_if<!IsSmartPtr< T >::value, bool >::type ReferenceEquals (T const &objA, std::nullptr_t)
 Reference-compares value type object with nullptr. More...
 
template<typename T1 , typename T2 >
static std::enable_if< IsSmartPtr< T1 >::value &&IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares reference type objects in C# style. More...
 
template<typename T1 , typename T2 >
static std::enable_if<!IsSmartPtr< T1 >::value &&!IsSmartPtr< T2 >::value, bool >::type Equals (T1 const &objA, T2 const &objB)
 Compares value type objects in C# style. More...
 
static const TypeInfoType ()
 Implements C# typeof(System.Object) construct. More...
 

Detailed Description

Represents a 3x3 matrix that defines transform operations. Objects of this class should only be allocated using System::MakeObject() function. Never create instance of this type on stack or using operator new, as it will result in runtime errors and/or assertion faults. Always wrap this class into System::SmartPtr pointer and use this pointer to pass it to functions as argument.

Constructor & Destructor Documentation

◆ Matrix() [1/4]

ASPOSECPP_SHARED_API System::Drawing::Drawing2D::Matrix::Matrix ( )

Constructs a new instance of Matrix class that represents an identity matrix.

◆ Matrix() [2/4]

ASPOSECPP_SHARED_API System::Drawing::Drawing2D::Matrix::Matrix ( float  m11,
float  m12,
float  m21,
float  m22,
float  dx,
float  dy 
)

Constructs a new instance of Matrix class and initializes it with the specified values.

Parameters
m11The value of the 1-st row 1-st column
m12The value of the 1-st row 2-nd column
m21The value of the 2-nd row 1-st column
m22The value of the 2-nd row 2-nd column
dxThe value of the 3-rd row 1-st column
dyThe value of the 3-rd row 2-nd column

◆ Matrix() [3/4]

ASPOSECPP_SHARED_API System::Drawing::Drawing2D::Matrix::Matrix ( const Rectangle rect,
const ArrayPtr< Point > &  plgpts 
)

Constructs a new instance of the Matrix class to the geometric transform defined by the specified rectangle and array of points.

◆ Matrix() [4/4]

ASPOSECPP_SHARED_API System::Drawing::Drawing2D::Matrix::Matrix ( const RectangleF rect,
const ArrayPtr< PointF > &  plgpts 
)

Constructs a new instance of the Matrix class to the geometric transform defined by the specified rectangle and array of points.

◆ ~Matrix()

virtual ASPOSECPP_SHARED_API System::Drawing::Drawing2D::Matrix::~Matrix ( )
virtual

Destructor.

Member Function Documentation

◆ Clone()

ASPOSECPP_SHARED_API SharedPtr<Matrix> System::Drawing::Drawing2D::Matrix::Clone ( ) const

Creates a copy of the current object.

Returns
A Matrix object which is an exact copy of the current object.

◆ Dispose()

void System::Drawing::Drawing2D::Matrix::Dispose ( )
inline

Releases all operating system resources acquired by the current object.

◆ Equals()

bool System::Drawing::Drawing2D::Matrix::Equals ( ptr  obj)
overridevirtual

Tests whether the specified object is a Matrix and is identical to this object.

Parameters
objThe object to test

Reimplemented from System::Object.

◆ get_Elements()

ASPOSECPP_SHARED_API System::ArrayPtr<float> System::Drawing::Drawing2D::Matrix::get_Elements ( ) const

Returns an arry containing the elements of the matrix in the following order: m11, m12, m21, m22, dx, dy.

◆ get_IsIdentity()

ASPOSECPP_SHARED_API bool System::Drawing::Drawing2D::Matrix::get_IsIdentity ( ) const

Determines if the matrix represented by the current object is an identity matrix.

◆ get_IsInvertible()

ASPOSECPP_SHARED_API bool System::Drawing::Drawing2D::Matrix::get_IsInvertible ( ) const

Determines if the matrix represented by the current object is invertible.

◆ get_OffsetX()

ASPOSECPP_SHARED_API float System::Drawing::Drawing2D::Matrix::get_OffsetX ( ) const

Returns the X translation value of the matrix represented by the current object.

◆ get_OffsetY()

ASPOSECPP_SHARED_API float System::Drawing::Drawing2D::Matrix::get_OffsetY ( ) const

Returns the Y translation value of the matrix represented by the current object.

◆ Invert()

ASPOSECPP_SHARED_API void System::Drawing::Drawing2D::Matrix::Invert ( )

Inverts the matrix represented by the current object.

◆ Multiply() [1/2]

ASPOSECPP_SHARED_API void System::Drawing::Drawing2D::Matrix::Multiply ( const SharedPtr< Matrix > &  matrix)

Multiplies the matrix represented by the current object by the specified matrix.

Parameters
matrixThe matrix to multiply the matrix represented by the current object by

◆ Multiply() [2/2]

ASPOSECPP_SHARED_API void System::Drawing::Drawing2D::Matrix::Multiply ( const SharedPtr< Matrix > &  matrix,
MatrixOrder  order 
)

Multiplies the matrix represented by the current object by the specified matrix.

Parameters
matrixThe matrix to multiply the matrix represented by the current object by
orderThe multiplication order

◆ Reset()

ASPOSECPP_SHARED_API void System::Drawing::Drawing2D::Matrix::Reset ( )

Resets the matrix represented by the current object so that it becomes an identity matrix.

◆ Rotate() [1/2]

ASPOSECPP_SHARED_API void System::Drawing::Drawing2D::Matrix::Rotate ( float  angle)

Rotates the matrix represented by the current object clockwise by the specified angle.

Parameters
angleThe angle to rotate the matrix by

◆ Rotate() [2/2]

ASPOSECPP_SHARED_API void System::Drawing::Drawing2D::Matrix::Rotate ( float  angle,
MatrixOrder  order 
)

Rotates the matrix represented by the current object clockwise around the origin by the specified angle.

Parameters
angleThe angle to rotate the matrix by
orderThe order in which the rotation is applied

◆ RotateAt() [1/2]

ASPOSECPP_SHARED_API void System::Drawing::Drawing2D::Matrix::RotateAt ( float  angle,
const PointF point 
)

Rotates the matrix represented by the current object clockwise around the specified point by the specified angle.

Parameters
angleThe angle to rotate the matrix by
pointSpecifies the center of rotation

◆ RotateAt() [2/2]

ASPOSECPP_SHARED_API void System::Drawing::Drawing2D::Matrix::RotateAt ( float  angle,
const PointF point,
MatrixOrder  order 
)

Rotates the matrix represented by the current object clockwise around the specified point by the specified angle.

Parameters
angleThe angle to rotate the matrix by
pointSpecifies the center of rotation
orderThe order in which the rotation is applied

◆ Scale() [1/2]

ASPOSECPP_SHARED_API void System::Drawing::Drawing2D::Matrix::Scale ( float  scaleX,
float  scaleY 
)

Applies the specified scale vector to the matrix represented by the current object.

Parameters
scaleXThe value by which to scale the matrix in x-axis direction
scaleYThe value by which to scale the matrix in y-axis direction

◆ Scale() [2/2]

ASPOSECPP_SHARED_API void System::Drawing::Drawing2D::Matrix::Scale ( float  scaleX,
float  scaleY,
MatrixOrder  order 
)

Applies the specified scale vector to the matrix represented by the current object.

Parameters
scaleXThe value by which to scale the matrix in x-axis direction
scaleYThe value by which to scale the matrix in y-axis direction
orderThe order in which the scale vector is applied to the matrix

◆ Shear() [1/2]

ASPOSECPP_SHARED_API void System::Drawing::Drawing2D::Matrix::Shear ( float  shearX,
float  shearY 
)

Applies the specified shear vector to the matrix represented by the current object.

Parameters
shearXThe horizontal shear factor
shearYThe vertical shear factor

◆ Shear() [2/2]

ASPOSECPP_SHARED_API void System::Drawing::Drawing2D::Matrix::Shear ( float  shearX,
float  shearY,
MatrixOrder  order 
)

Applies the specified shear vector to the matrix represented by the current object.

Parameters
shearXThe horizontal shear factor
shearYThe vertical shear factor
orderThe order in which the shear vector is applied to the matrix

◆ TransformPoints() [1/4]

ASPOSECPP_SHARED_API void System::Drawing::Drawing2D::Matrix::TransformPoints ( const ArrayPtr< Point > &  pts)

Applies the geometric transformation defined by the matrix represented by the current object to the specified points.

Parameters
ptsAn array containing the points to transform

◆ TransformPoints() [2/4]

ASPOSECPP_SHARED_API void System::Drawing::Drawing2D::Matrix::TransformPoints ( const System::Details::ArrayView< Point > &  pts)

Applies the geometric transformation defined by the matrix represented by the current object to the specified points.

Parameters
ptsAn array view containing the points to transform

◆ TransformPoints() [3/4]

ASPOSECPP_SHARED_API void System::Drawing::Drawing2D::Matrix::TransformPoints ( const ArrayPtr< PointF > &  pts)

Applies the geometric transformation defined by the matrix represented by the current object to the specified points.

Parameters
ptsAn array containing the points to transform

◆ TransformPoints() [4/4]

ASPOSECPP_SHARED_API void System::Drawing::Drawing2D::Matrix::TransformPoints ( const System::Details::ArrayView< PointF > &  pts)

Applies the geometric transformation defined by the matrix represented by the current object to the specified points.

Parameters
ptsAn array view containing the points to transform

◆ TransformVectors() [1/4]

ASPOSECPP_SHARED_API void System::Drawing::Drawing2D::Matrix::TransformVectors ( const ArrayPtr< Point > &  pts)

Applies only the scale and rotate components of the matrix represented by the current object to the specified points.

Parameters
ptsAn array containing the points to transform

◆ TransformVectors() [2/4]

ASPOSECPP_SHARED_API void System::Drawing::Drawing2D::Matrix::TransformVectors ( const System::Details::ArrayView< Point > &  pts)

Applies only the scale and rotate components of the matrix represented by the current object to the specified points.

Parameters
ptsAn array view containing the points to transform

◆ TransformVectors() [3/4]

ASPOSECPP_SHARED_API void System::Drawing::Drawing2D::Matrix::TransformVectors ( const ArrayPtr< PointF > &  pts)

Applies only the scale and rotate components of the matrix represented by the current object to the specified points.

Parameters
ptsAn array containing the points to transform

◆ TransformVectors() [4/4]

ASPOSECPP_SHARED_API void System::Drawing::Drawing2D::Matrix::TransformVectors ( const System::Details::ArrayView< PointF > &  pts)

Applies only the scale and rotate components of the matrix represented by the current object to the specified points.

Parameters
ptsAn array view containing the points to transform

◆ Translate() [1/2]

ASPOSECPP_SHARED_API void System::Drawing::Drawing2D::Matrix::Translate ( float  offsetX,
float  offsetY 
)

Applies the specified translate vector to the matrix represented by the current object.

Parameters
offsetXThe X value by which the matrix is translated
offsetYThe Y value by which the matrix is translated

◆ Translate() [2/2]

ASPOSECPP_SHARED_API void System::Drawing::Drawing2D::Matrix::Translate ( float  offsetX,
float  offsetY,
MatrixOrder  order 
)

Applies the specified translate vector to the matrix represented by the current object.

Parameters
offsetXThe X value by which the matrix is translated
offsetYThe Y value by which the matrix is translated
orderThe order in which the translation vector is applied to the matrix

◆ VectorTransformPoints() [1/2]

ASPOSECPP_SHARED_API void System::Drawing::Drawing2D::Matrix::VectorTransformPoints ( const ArrayPtr< Point > &  pts)

Multiplies each vector in an array by the matrix represented by the current object.

Parameters
ptsAn array containing the points to transform

◆ VectorTransformPoints() [2/2]

ASPOSECPP_SHARED_API void System::Drawing::Drawing2D::Matrix::VectorTransformPoints ( const System::Details::ArrayView< Point > &  pts)

Multiplies each vector in an array by the matrix represented by the current object.

Parameters
ptsAn array view containing the points to transform