You will have to deal with matrix transformations.
Each linear operation can be represented by a 3x3 matrix and a 3x1 vector, which you can apply at a point in the plane. If p is a point, M is a matrix, and q is another, then each linear transformation can be represented as Mp + q.
If you have a 2d point, then its vector will be [x; y; 1] (vertical vector), and the matrix can take several forms.
For translations, the matrix is ββonly an identity matrix. Vector q is a shift vector.
For scaling, M is similar to
[a 0 0] M = [0 b 0] [0 0 1]
where a and b are the scaling factors for x and y, respectively. Vector q is zero.
To rotate, say, at an angle a, you get
[cos(a) -sin(a) 0] M = [sin(a) cos(a) 0] [ 0 0 1]
and q is null again.
There are also skew matrices. So, if you need to apply three consecutive transformations, you will have to apply such linear transformations. Your problem is that you have to deal with the origin, so you have to subtract the vector o from p, than apply M, add q, and then o again.
Say you have this conversion (M1, q1, o1) and (M2, q2, o2). When you apply the first, you get
p1 = M1 * (p - o1) + q1 + o1
Then you need to apply the second transformation:
p2 = M2 * (p1 - o2) + q2 + o2
As a result, you will receive:
p2 = M2 * (M1 * (p - o1) + q1 + o1 - o2) + q2 + o2
And so on and finally the third (M3, q3, o3).
A mess? It looks like. But everything can be simplified a little if you know how matrices look.
Now do the math and apply it to transform: matrix(a, b, c, d, tx, ty) .