| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137 | 1×
1×
1×
1×
105×
105×
105×
1×
431×
20×
1×
60×
1×
1×
1×
60×
60×
60×
360×
360×
360×
60×
1×
50×
1×
1×
1×
913×
1×
1×
1×
1×
1×
125×
125×
105×
105×
105×
105×
105×
105×
105×
20×
1×
2101×
1×
150×
1×
150×
1×
60×
60×
1×
1×
50×
50×
50×
50×
50×
50×
50×
50×
300×
1×
1×
1×
1×
| define(["require", "exports", "./../drawing/pdf-drawing", "./../primitives/pdf-number"], function (require, exports, pdf_drawing_1, pdf_number_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var PdfTransformationMatrix = (function () {
function PdfTransformationMatrix(value) {
this.radDegFactor = 180.0 / Math.PI;
Eif (typeof value === 'undefined') {
this.transformationMatrix = new Matrix(1.00, 0.00, 0.00, 1.00, 0.00, 0.00);
}
else {
this.transformationMatrix = new Matrix(1.00, 0.00, 0.00, -1.00, 0.00, 0.00);
}
}
Object.defineProperty(PdfTransformationMatrix.prototype, "matrix", {
get: function () {
return this.transformationMatrix;
},
set: function (value) {
this.transformationMatrix = value;
},
enumerable: true,
configurable: true
});
PdfTransformationMatrix.prototype.translate = function (offsetX, offsetY) {
this.transformationMatrix.translate(offsetX, offsetY);
};
PdfTransformationMatrix.prototype.scale = function (scaleX, scaleY) {
this.transformationMatrix.elements[0] = scaleX;
this.transformationMatrix.elements[3] = scaleY;
};
PdfTransformationMatrix.prototype.rotate = function (angle) {
angle = (angle * Math.PI) / 180;
this.transformationMatrix.elements[0] = Math.cos(angle);
this.transformationMatrix.elements[1] = Math.sin(angle);
this.transformationMatrix.elements[2] = -Math.sin(angle);
this.transformationMatrix.elements[3] = Math.cos(angle);
};
PdfTransformationMatrix.prototype.toString = function () {
var builder = '';
var whitespace = ' ';
for (var i = 0, len = this.transformationMatrix.elements.length; i < len; i++) {
var temp = this.matrix.elements[i];
builder += pdf_number_1.PdfNumber.floatToString(this.transformationMatrix.elements[i]);
builder += whitespace;
}
return builder;
};
PdfTransformationMatrix.prototype.multiply = function (matrix) {
this.transformationMatrix.multiply(matrix.matrix);
};
PdfTransformationMatrix.degreesToRadians = function (degreesX) {
return this.degRadFactor * degreesX;
};
PdfTransformationMatrix.prototype.radiansToDegrees = function (radians) {
return this.radDegFactor * radians;
};
PdfTransformationMatrix.prototype.clone = function () {
return this;
};
PdfTransformationMatrix.degRadFactor = Math.PI / 180.0;
return PdfTransformationMatrix;
}());
exports.PdfTransformationMatrix = PdfTransformationMatrix;
var Matrix = (function () {
function Matrix(arg1, arg2, arg3, arg4, arg5, arg6) {
Iif (typeof arg1 === 'undefined') {
this.metrixElements = [];
}
else if (typeof arg1 === 'number') {
this.metrixElements = [];
this.metrixElements.push(arg1);
this.metrixElements.push(arg2);
this.metrixElements.push(arg3);
this.metrixElements.push(arg4);
this.metrixElements.push(arg5);
this.metrixElements.push(arg6);
}
else {
this.metrixElements = arg1;
}
}
Object.defineProperty(Matrix.prototype, "elements", {
get: function () {
return this.metrixElements;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Matrix.prototype, "offsetX", {
get: function () {
return this.metrixElements[4];
},
enumerable: true,
configurable: true
});
Object.defineProperty(Matrix.prototype, "offsetY", {
get: function () {
return this.metrixElements[5];
},
enumerable: true,
configurable: true
});
Matrix.prototype.translate = function (offsetX, offsetY) {
this.metrixElements[4] = offsetX;
this.metrixElements[5] = offsetY;
};
Matrix.prototype.transform = function (point) {
var x = point.x;
var y = point.y;
var x2 = x * this.elements[0] + y * this.elements[2] + this.offsetX;
var y2 = x * this.elements[1] + y * this.elements[3] + this.offsetY;
return new pdf_drawing_1.PointF(x2, y2);
};
Matrix.prototype.multiply = function (matrix) {
var tempMatrix = [];
tempMatrix.push(this.elements[0] * matrix.elements[0] + this.elements[1] * matrix.elements[2]);
tempMatrix[1] = (this.elements[0] * matrix.elements[1] + this.elements[1] * matrix.elements[3]);
tempMatrix[2] = (this.elements[2] * matrix.elements[0] + this.elements[3] * matrix.elements[2]);
tempMatrix[3] = (this.elements[2] * matrix.elements[1] + this.elements[3] * matrix.elements[3]);
tempMatrix[4] = (this.offsetX * matrix.elements[0] + this.offsetY * matrix.elements[2] + matrix.offsetX);
tempMatrix[5] = (this.offsetX * matrix.elements[1] + this.offsetY * matrix.elements[3] + matrix.offsetY);
for (var i = 0; i < tempMatrix.length; i++) {
this.elements[i] = tempMatrix[i];
}
};
Matrix.prototype.dispose = function () {
this.metrixElements = null;
};
Matrix.prototype.clone = function () {
var m = new Matrix(this.metrixElements);
return m;
};
return Matrix;
}());
exports.Matrix = Matrix;
});
|