diff --git a/Headers/gnustep/gui/NSAffineTransform.h b/Headers/gnustep/gui/NSAffineTransform.h index fe71ce543..d395954a9 100644 --- a/Headers/gnustep/gui/NSAffineTransform.h +++ b/Headers/gnustep/gui/NSAffineTransform.h @@ -86,8 +86,10 @@ typedef struct { /* Returns anotherMatrix * self */ - (void) concatenateWith: (NSAffineTransform*)anotherMatrix; +- (void) concatenateWithMatrix: (const float[6])anotherMatrix; - (NSPoint) pointInMatrixSpace: (NSPoint)point; +- (NSPoint) deltaPointInMatrixSpace: (NSPoint)point; - (NSSize) sizeInMatrixSpace: (NSSize)size; - (NSRect) rectInMatrixSpace: (NSRect)rect; diff --git a/Source/NSAffineTransform.m b/Source/NSAffineTransform.m index 2bde2eaff..a6b7634f0 100644 --- a/Source/NSAffineTransform.m +++ b/Source/NSAffineTransform.m @@ -438,6 +438,24 @@ static NSAffineTransformStruct identityTransform = { [self appendTransform: other]; } +- (void) concatenateWithMatrix: (const float[6])concat +{ + float newA, newB, newC, newD, newTX, newTY; + + newA = concat[0] * A + concat[1] * C; + newB = concat[0] * B + concat[1] * D; + newC = concat[2] * A + concat[3] * C; + newD = concat[2] * B + concat[3] * D; + newTX = concat[4] * A + concat[5] * C + TX; + newTY = concat[4] * B + concat[5] * D + TY; + + A = newA; B = newB; + C = newC; D = newD; + TX = newTX; TY = newTY; + + rotationAngle = -1; +} + - (void)inverse { [self invert]; @@ -515,6 +533,16 @@ static NSAffineTransformStruct identityTransform = { return new; } +- (NSPoint) deltaPointInMatrixSpace: (NSPoint)point +{ + NSPoint new; + + new.x = A * point.x + C * point.y; + new.y = B * point.x + D * point.y; + + return new; +} + - (NSSize) sizeInMatrixSpace: (NSSize)size { NSSize new;