mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 16:20:46 +00:00
Added new GS methods [concatenateWithMatrix:] and
[deltaPointInMatrixSpace:] to avoid the creation of a new NSAffineTransform in the backend. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@8496 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
528a627ccb
commit
b8a41ef24a
2 changed files with 30 additions and 0 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue