Matrices can be concatenated with other matrices. Concatenation is equivalent to sticking two matrices together such that a point first passes through one matrix and then the next during a transformation. The functions translateBy, scaleBy, and rotateBy are just concatenation shortcuts for translate, scale, and rotate matrices.
Think of concatenation as putting a transformation into a "list" of transformations. Later when transformPoint is called, the point is passed through each transform in order. For linear matrices, the "list" is compressed into a single matrix.
Concatenation is not commutative, that is if A and B are matrices, then A times B is not necessarily equal to B times A. For example, rotation matrix times a scale matrix does not necessarily give the same result as a scale matrix times a rotation matrix even though the component matrices are identical. This means it matters where the new transformation is placed in the "list". For this reason the 2D Graphics framework defines the notion of pre-multiplication and post-multiplication. Every function has a corresponding pre-multiply method with a prefix "pre" in front of it. The function that does not have the prefix has an implicit meaning of post-multiplication. The preRotateBy, preScaleBy, and preTranslateBy functions premultiply the specified transformation matrix by whatever values exist in the parameter list.
To create a sequence of arbitrary transformations rather than just translation, scaling, and rotation, use the concatWith function. Function concatWith concatenates two transformation matrices so that during the transformation each point passes first through one matrix and then the next. Function concatWith places the specified transformation matrix after the existing matrix.
Note: For speed, the two concatenated matrices are formed into one matrix internally.
You can use the preConcatWith function to place the specified transformation matrix before the existing matrix.