Can anyone give me some idea on how to solve this problem for use on an iPhone app. Users can rotate and flip image thumbnails but I want to save these transformations so I can apply them to the full size image later. I want to be able to work out the simplest transformation from a string off all transformations applied. I’ve include some examples below.
flipH+flipV = r180
flipH+flipV+flipH = flipV
flipV+flipH+flipV = flipH
r90CW+flipH+flipV+flipH+r180CCW = flipH+r90CCW
I understand you are worried by the cost of applying each transformation in a sequence to your image; as opposed to this, you would like to store a composed transformation and apply it just once.
If this is correct, then you can use the methods that are listed under the “Modifying Affine Transformations ” section in CGAffineTransform Reference. I.e., you would start with a basic identity transform:
then you would apply all of your transform in sequence and build a composed transform:
that you can apply to your image.
EDIT:
Composing 2 transformations means multiplying 2 matrices. If you just compose rotations, you will get a rotation matrix with different values (0s are kept in the same locations); if you compose translation and rotation, then you will get a new matrix with 2 more values (as compared to a rotation matrix). Have a look at this explanation, which is very visual.
Affine transforms are entirely ok for any iOS version (they are really a basic thing), including iOS 5.