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

Inherits System::Object.

Public Member Functions

 Matrix ()
 Constructs a new instance of Matrix class that represents an identity matrix. More...
 
 Matrix (float m11, float m12, float m21, float m22, float dx, float dy)
 
 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...
 
 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 ~Matrix ()
 Destructor. More...
 
System::ArrayPtr< float > get_Elements () const
 
float get_OffsetX () const
 Returns the X translation value of the matrix represented by the current object. More...
 
float get_OffsetY () const
 Returns the Y translation value of the matrix represented by the current object. More...
 
bool get_IsIdentity () const
 Determines if the matrix represented by the current object is an identity matrix. More...
 
bool get_IsInvertible () const
 Determines if the matrix represented by the current object is invertible. More...
 
void Invert ()
 Inverts the matrix represented by the current object. More...
 
void Reset ()
 Resets the matrix represented by the current object so that it becomes an identity matrix. More...
 
void Multiply (const SharedPtr< Matrix > &matrix)
 
void Multiply (const SharedPtr< Matrix > &matrix, MatrixOrder order)
 
void Rotate (float angle)
 
void Rotate (float angle, MatrixOrder order)
 
void RotateAt (float angle, const PointF &point)
 
void RotateAt (float angle, const PointF &point, MatrixOrder order)
 
void Scale (float scaleX, float scaleY)
 
void Scale (float scaleX, float scaleY, MatrixOrder order)
 
void Shear (float shearX, float shearY)
 
void Shear (float shearX, float shearY, MatrixOrder order)
 
void Translate (float offsetX, float offsetY)
 
void Translate (float offsetX, float offsetY, MatrixOrder order)
 
void TransformPoints (const ArrayPtr< Point > &pts)
 
void TransformPoints (const ArrayPtr< PointF > &pts)
 
void TransformVectors (const ArrayPtr< Point > &pts)
 
void TransformVectors (const ArrayPtr< PointF > &pts)
 
void VectorTransformPoints (const ArrayPtr< Point > &pts)
 
bool Equals (ptr obj) override
 
SharedPtr< MatrixClone () const
 
void Dispose ()
 Releases all operating system resources acquired by the current object. More...
 
- Public Member Functions inherited from System::Object
 Object ()
 Creates object. Initializes all internal data structures. More...
 
virtual ~Object ()
 Destroys object. Frees all internal data structures. More...
 
 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 refernce counter. More...
 
void Lock ()
 Implements C# lock() statement locking. Call directly or use LockContext sentry object. More...
 
void Unlock ()
 Implements C# lock() statement unlocking. Call directly or use LockContext sentry object. More...
 
virtual int GetHashCode () const
 Analog of C# Object.GetHashCode() method. Enables hashing of custom objects. More...
 
virtual String ToString () ASPOSE_CONST
 Analog of C# Object.ToString() method. Enables converting custom objects to string. More...
 
virtual ptr MemberwiseClone () const
 Analog of C# Object.MemberwiseClone() method. Enables cloning custom types. More...
 
virtual const TypeInfoGetType () const
 Gets actual type of object. Analog of C# System.Object.GetType() call. More...
 
virtual bool Is (const TypeInfo &targetType) const
 Check if object represents an instance of type described by targetType. Analog of C# 'is' operator. More...
 
virtual void SetTemplateWeakPtr (unsigned int argument)
 Set n'th template argument a weak pointer (rather than shared). Allows switching pointers in containers to weak mode. More...
 
template<>
bool Equals (float const &objA, float const &objB)
 
template<>
bool Equals (double const &objA, double const &objB)
 
template<>
bool ReferenceEquals (String const &str, std::nullptr_t)
 
template<>
bool ReferenceEquals (String const &str1, String const &str2)
 

Additional Inherited Members

- Public Types inherited from System::Object
typedef SmartPtr< Objectptr
 Alias for smart pointer type. More...
 
typedef System::Details::SharedMembersType shared_members_type
 structure to keep list of shared pointers contained in object. 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 ()
 Impleemnts 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]

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

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

◆ Matrix() [2/4]

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]

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]

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 System::Drawing::Drawing2D::Matrix::~Matrix ( )
virtual

Destructor.

Member Function Documentation

◆ Clone()

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()

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()

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

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

◆ get_IsInvertible()

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

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

◆ get_OffsetX()

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

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

◆ get_OffsetY()

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

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

◆ Invert()

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

Inverts the matrix represented by the current object.

◆ Multiply() [1/2]

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]

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()

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

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

◆ Rotate() [1/2]

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]

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]

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]

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]

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]

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]

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]

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/2]

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/2]

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

◆ TransformVectors() [1/2]

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/2]

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

◆ Translate() [1/2]

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]

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()

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