Opait PDF Library
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Properties | List of all members
Opait.Pdf.Api.PdfMatrix Class Reference

Represents a double precision 3x3 affine transformation matrix. An affine matrix can be represented by 6 numbers in the first two columns. [A, C, 0]
[B, D, 0] [E, F, 1] More...

Inheritance diagram for Opait.Pdf.Api.PdfMatrix:

Public Member Functions

 PdfMatrix (double a=1, double b=0, double c=0, double d=1, double e=0, double f=0)
 Initializes a new instance of the PdfMatrix class with the specified elements. More...
 
 PdfMatrix (PdfMatrix m)
 Initializes a new instance of the PdfMatrix class from another specified PdfMatrix. More...
 
 PdfMatrix (IReadOnlyList< double > e)
 Initializes a new instance using an array of elements More...
 
 PdfMatrix (string matrix)
 Initializes a new instance using a serialized, and space separated, string. Compatible with the output from the ToString() metheod. More...
 
PdfMatrix Scale (double sx, double sy)
 Applies the specified scale vector to this PdfMatrix by prepending the scale vector. More...
 
PdfMatrix Translate (double tx, double ty)
 Applies the specified translation vector to this PdfMatrix by prepending the translation vector. More...
 
PdfMatrix Rotate (double angle)
 Prepends to this PdfMatrix a clockwise rotation, around the origin and by the specified angle. More...
 
PdfMatrix Shear (double x, double y)
 Applies the specified shear vector to this PdfMatrix by prepending the shear vector. More...
 
PdfMatrix Invert ()
 Inverts this PdfMatrix. PdfMatrix must be invertible. More...
 
double[] ToArray ()
 Converts the matrix to an array of 6 double precision numbers. More...
 
float[] ToPixAffine ()
 Converts the matrix to array of 6 floats in the order that is expected by Leptonica affine transforms. More...
 
PdfPoint Transform (PdfPoint point)
 Transform a point using this PdfMatrix. More...
 
PdfRectangle Transform (PdfRectangle rect)
 Transform a rectangle using this PdfMatrix. More...
 
PdfMatrix Concatenate (PdfMatrix x)
 Concatenates this PdfMatrix by the specified matrix, by prepending the specified PdfMatrix. More...
 
override string ToString ()
 Converts this PdfMatrix to a human-readable string. More...
 
bool Equals (PdfMatrix other)
 Specifies whether this PdfMatrix contains the same values as the specified PdfMatrix. More...
 
override bool Equals (object obj)
 Specifies whether this PdfMatrix contains the same values as the specified Object. More...
 
override int GetHashCode ()
 Returns the hash code for this PdfMatrix. More...
 

Static Public Member Functions

static PdfMatrix RotationMatrix (double angle)
 Creates a PdfMatrix to represent a rotation by the specified angle. More...
 
static PdfMatrix RotationAtMatrix (double translateX, double translateY, double angle)
 Creates a PdfMatrix to represent a translation followed by rotation by the specified values. More...
 
static PdfMatrix ScalingMatrix (double sx, double sy)
 Creates a PdfMatrix to represent scaling by the specified amounts. More...
 
static PdfMatrix TranslationMatrix (double tx, double ty)
 Creates a PdfMatrix to represent translation by the specified amounts. More...
 
static PdfMatrix ShearMatrix (double x, double y)
 Creates a PdfMatrix to represent shearing by the specified amounts. More...
 
static PdfMatrix RotateFlipMatrix (int[] args, double width, double height)
 Creates a PDF matrix from parameters of a rotate/flip operation. More...
 
static PdfMatrix FlipMatrix (bool horizontal, bool vertical)
 Creates a PdfMatrix to represent flipping horizontally, vertically or both. More...
 
static PdfMatrix Create (double scaleX, double scaleY, double translateX, double translateY, double angle)
 Creates a PdfMatrix with the specified attributes. More...
 
static PdfMatrix Multiply (PdfMatrix x, PdfMatrix y)
 Compute a new transformation matrix by multiplying two existing matrices. More...
 

Public Attributes

double A
 Gets the M11 element of the affine matrix.
 
double B
 Gets the M21 element of the affine matrix.
 
double C
 Gets the M12 element of the affine matrix.
 
double D
 Gets the M22 element of the affine matrix.
 
double E
 Gets the DX element of the affine matrix.
 
double F
 Gets the DY element of the affine matrix.
 

Static Public Attributes

static readonly PdfMatrix IdentityMatrix = new PdfMatrix()
 A PdfMatrix that represents the identity matrix.
 

Properties

bool IsIdentity [get]
 Gets a value indicating whether this PdfMatrix is the identity matrix.
 
double OffsetX [get]
 Gets the x translation value of this PdfMatrix.
 
double OffsetY [get]
 Gets the y translation value of this PdfMatrix.
 
double ScaleX [get]
 Gets the horizontal scaling factor of this PdfMatrix.
 
double ScaleY [get]
 Gets the vertical scaling factor of this PdfMatrix.
 
bool IsInvertible [get]
 Gets a value indicating whether this PdfMatrix is invertible.
 
double Determinant [get]
 Returns the determinant of the rotation matrix.
 
PdfMatrix Inverse [get]
 Gets the inverse of the current matrix.
 

Detailed Description

Represents a double precision 3x3 affine transformation matrix. An affine matrix can be represented by 6 numbers in the first two columns. [A, C, 0]
[B, D, 0] [E, F, 1]

Constructor & Destructor Documentation

◆ PdfMatrix() [1/4]

Opait.Pdf.Api.PdfMatrix.PdfMatrix ( double  a = 1,
double  b = 0,
double  c = 0,
double  d = 1,
double  e = 0,
double  f = 0 
)

Initializes a new instance of the PdfMatrix class with the specified elements.

Parameters
aThe M11 element.
bThe M21 element.
cThe M12 element.
dThe M22 element.
eThe DX element.
fThe DY element.

◆ PdfMatrix() [2/4]

Opait.Pdf.Api.PdfMatrix.PdfMatrix ( PdfMatrix  m)

Initializes a new instance of the PdfMatrix class from another specified PdfMatrix.

Parameters
mPdfMatrix to initialize from.

◆ PdfMatrix() [3/4]

Opait.Pdf.Api.PdfMatrix.PdfMatrix ( IReadOnlyList< double >  e)

Initializes a new instance using an array of elements

Parameters
eAn array of 4 or 6 elements.

◆ PdfMatrix() [4/4]

Opait.Pdf.Api.PdfMatrix.PdfMatrix ( string  matrix)

Initializes a new instance using a serialized, and space separated, string. Compatible with the output from the ToString() metheod.

Parameters
matrixThe serialized version of the matrix.

Member Function Documentation

◆ Concatenate()

PdfMatrix Opait.Pdf.Api.PdfMatrix.Concatenate ( PdfMatrix  x)

Concatenates this PdfMatrix by the specified matrix, by prepending the specified PdfMatrix.

Parameters
xThe PdfMatrix to concatenate with.
Returns
The result of the transformation.

◆ Create()

static PdfMatrix Opait.Pdf.Api.PdfMatrix.Create ( double  scaleX,
double  scaleY,
double  translateX,
double  translateY,
double  angle 
)
static

Creates a PdfMatrix with the specified attributes.

Parameters
scaleXThe horizontal scale factor.
scaleYThe vertical scale factor.
translateXThe horizontal displacement.
translateYThe vertical displacement.
angleThe angle of rotation.
Returns
The transformation matrix.

◆ Equals() [1/2]

override bool Opait.Pdf.Api.PdfMatrix.Equals ( object  obj)

Specifies whether this PdfMatrix contains the same values as the specified Object.

Parameters
objThe Object to test.
Returns
'true' if obj is a PdfMatrix and has the same values as this PdfMatrix, otherwise, 'false'.

◆ Equals() [2/2]

bool Opait.Pdf.Api.PdfMatrix.Equals ( PdfMatrix  other)

Specifies whether this PdfMatrix contains the same values as the specified PdfMatrix.

Parameters
otherThe PdfMatrix to test.
Returns
'true' if the test PdfMatrix and has the same values as this PdfMatrix, otherwise, 'false'.

◆ FlipMatrix()

static PdfMatrix Opait.Pdf.Api.PdfMatrix.FlipMatrix ( bool  horizontal,
bool  vertical 
)
static

Creates a PdfMatrix to represent flipping horizontally, vertically or both.

Parameters
horizontalWhether to flip horizontally about the vertical axis.
verticalWhether to flip vertically about the horizontal axis.
Returns
The flip PDF matrix.

◆ GetHashCode()

override int Opait.Pdf.Api.PdfMatrix.GetHashCode ( )

Returns the hash code for this PdfMatrix.

Returns
The hash code for this PdfMatrix.

◆ Invert()

PdfMatrix Opait.Pdf.Api.PdfMatrix.Invert ( )

Inverts this PdfMatrix. PdfMatrix must be invertible.

Returns
The inverted matrix.

◆ Multiply()

static PdfMatrix Opait.Pdf.Api.PdfMatrix.Multiply ( PdfMatrix  x,
PdfMatrix  y 
)
static

Compute a new transformation matrix by multiplying two existing matrices.

Parameters
xFirst matrix.
ySecond matrix.
Returns
Result of multiplying the first matrix by the second matrix.

◆ Rotate()

PdfMatrix Opait.Pdf.Api.PdfMatrix.Rotate ( double  angle)

Prepends to this PdfMatrix a clockwise rotation, around the origin and by the specified angle.

Parameters
angleRotation angle.
Returns
The result of the transformation.

◆ RotateFlipMatrix()

static PdfMatrix Opait.Pdf.Api.PdfMatrix.RotateFlipMatrix ( int[]  args,
double  width,
double  height 
)
static

Creates a PDF matrix from parameters of a rotate/flip operation.

Parameters
argsThe 4 arguments of rotate/flip.
widthThe width of the page to transform.
heightThe height of the page to transform.
Returns
The rotate/flip matrix.

◆ RotationAtMatrix()

static PdfMatrix Opait.Pdf.Api.PdfMatrix.RotationAtMatrix ( double  translateX,
double  translateY,
double  angle 
)
static

Creates a PdfMatrix to represent a translation followed by rotation by the specified values.

Parameters
translateXThe horizontal displacement.
translateYThe vertical displacement.
angleThe rotation angle.
Returns
The rotation PdfMatrix at the specified point.

◆ RotationMatrix()

static PdfMatrix Opait.Pdf.Api.PdfMatrix.RotationMatrix ( double  angle)
static

Creates a PdfMatrix to represent a rotation by the specified angle.

Parameters
angleThe rotation angle.
Returns
The rotation PdfMatrix.

◆ Scale()

PdfMatrix Opait.Pdf.Api.PdfMatrix.Scale ( double  sx,
double  sy 
)

Applies the specified scale vector to this PdfMatrix by prepending the scale vector.

Parameters
sxHorizontal scaling.
syVertical scaling.
Returns
The result of the transformation.

◆ ScalingMatrix()

static PdfMatrix Opait.Pdf.Api.PdfMatrix.ScalingMatrix ( double  sx,
double  sy 
)
static

Creates a PdfMatrix to represent scaling by the specified amounts.

Parameters
sxThe horizontal scaling.
syThe vertical scaling.
Returns
The scaling matrix.

◆ Shear()

PdfMatrix Opait.Pdf.Api.PdfMatrix.Shear ( double  x,
double  y 
)

Applies the specified shear vector to this PdfMatrix by prepending the shear vector.

Parameters
xThe horizontal shear.
yThe vertical shear.
Returns
The result of the transformation.

◆ ShearMatrix()

static PdfMatrix Opait.Pdf.Api.PdfMatrix.ShearMatrix ( double  x,
double  y 
)
static

Creates a PdfMatrix to represent shearing by the specified amounts.

Parameters
xHorizontal shear factor.
yVertical shear factor.
Returns
The searing PdfMatrix.

◆ ToArray()

double[] Opait.Pdf.Api.PdfMatrix.ToArray ( )

Converts the matrix to an array of 6 double precision numbers.

Returns
The matrix elements as an array of 6 double precision numbers.

◆ ToPixAffine()

float[] Opait.Pdf.Api.PdfMatrix.ToPixAffine ( )

Converts the matrix to array of 6 floats in the order that is expected by Leptonica affine transforms.

Returns
An array of 6 floats representing the affine matrix.

◆ ToString()

override string Opait.Pdf.Api.PdfMatrix.ToString ( )

Converts this PdfMatrix to a human-readable string.

Returns
A string that shows A, B, C, D, E and F parameters of the transormation matrix.

◆ Transform() [1/2]

PdfPoint Opait.Pdf.Api.PdfMatrix.Transform ( PdfPoint  point)

Transform a point using this PdfMatrix.

Parameters
pointThe point to transform.
Returns
The transformed point.

◆ Transform() [2/2]

PdfRectangle Opait.Pdf.Api.PdfMatrix.Transform ( PdfRectangle  rect)

Transform a rectangle using this PdfMatrix.

Parameters
rectThe rectangle to transform.
Returns
The transformed rectangle.

◆ Translate()

PdfMatrix Opait.Pdf.Api.PdfMatrix.Translate ( double  tx,
double  ty 
)

Applies the specified translation vector to this PdfMatrix by prepending the translation vector.

Parameters
txHorizontal displacement.
tyVertical displacement.
Returns
The result of the transformation.

◆ TranslationMatrix()

static PdfMatrix Opait.Pdf.Api.PdfMatrix.TranslationMatrix ( double  tx,
double  ty 
)
static

Creates a PdfMatrix to represent translation by the specified amounts.

Parameters
txThe horizontal displacement.
tyThe vertical displacement.
Returns
The translation PdfMatrix.