How to undo image scaled in xcode

0 votes
635 views
asked Jan 1, 2013 in xCode by sahana (2,250 points)

Im working on application in which i scale ,rotate and translate image. Im saving angle while rotating for undo. Similarly im saving centerX and centerY for translation undo. But saving scaling parameter results into undesired results. Please tell me how to undo scaled image. Thanks

1 Answer

0 votes
answered Jan 1, 2013 by john (4,220 points)
-(CGFloat)getCurrentScale {
    CGAffineTransform t = image.transform;
    CGFloat a, c, b, d;
    a = t.a;
    c = t.c;
    b = t.b;
    d = t.d;
    CGFloat scaleX = sqrt(powf(a,2)+powf(c,2));
    return scaleX;
}
...