summaryrefslogtreecommitdiff
path: root/platform/java/com/artifex/mupdf/fitz/Matrix.java
blob: ede57ccc47cc297d68ff4ac930984fead61f21e4 (plain)
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
package com.artifex.mupdf.fitz;

public class Matrix
{
	public float a;
	public float b;
	public float c;
	public float d;
	public float e;
	public float f;

	public Matrix(float a, float b, float c, float d, float e, float f)
	{
		this.a = a;
		this.b = b;
		this.c = c;
		this.d = d;
		this.e = e;
		this.f = f;
	}

	public Matrix(float a, float d)
	{
		this.a = a;
		this.b = 0;
		this.c = 0;
		this.d = d;
		this.e = 0;
		this.f = 0;
	}

	public Matrix(float a)
	{
		this.a = a;
		this.b = 0;
		this.c = 0;
		this.d = a;
		this.e = 0;
		this.f = 0;
	}

	public Matrix concat(Matrix m)
	{
		float a = this.a * m.a + this.b * m.c;
		float b = this.a * m.b + this.b * m.d;
		float c = this.c * m.a + this.d * m.c;
		float d = this.c * m.b + this.d * m.d;
		float e = this.e * m.a + this.f * m.c + m.e;
		this.f = this.e * m.b + this.f * m.d + m.f;

		this.a = a;
		this.b = b;
		this.c = c;
		this.d = d;
		this.e = e;

		return this;
	}
}