mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 20:40:47 +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
8b3ddcb199
commit
fdfab261a1
2 changed files with 30 additions and 0 deletions
|
@ -86,8 +86,10 @@ typedef struct {
|
||||||
|
|
||||||
/* Returns anotherMatrix * self */
|
/* Returns anotherMatrix * self */
|
||||||
- (void) concatenateWith: (NSAffineTransform*)anotherMatrix;
|
- (void) concatenateWith: (NSAffineTransform*)anotherMatrix;
|
||||||
|
- (void) concatenateWithMatrix: (const float[6])anotherMatrix;
|
||||||
|
|
||||||
- (NSPoint) pointInMatrixSpace: (NSPoint)point;
|
- (NSPoint) pointInMatrixSpace: (NSPoint)point;
|
||||||
|
- (NSPoint) deltaPointInMatrixSpace: (NSPoint)point;
|
||||||
- (NSSize) sizeInMatrixSpace: (NSSize)size;
|
- (NSSize) sizeInMatrixSpace: (NSSize)size;
|
||||||
- (NSRect) rectInMatrixSpace: (NSRect)rect;
|
- (NSRect) rectInMatrixSpace: (NSRect)rect;
|
||||||
|
|
||||||
|
|
|
@ -438,6 +438,24 @@ static NSAffineTransformStruct identityTransform = {
|
||||||
[self appendTransform: other];
|
[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
|
- (void)inverse
|
||||||
{
|
{
|
||||||
[self invert];
|
[self invert];
|
||||||
|
@ -515,6 +533,16 @@ static NSAffineTransformStruct identityTransform = {
|
||||||
return new;
|
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) sizeInMatrixSpace: (NSSize)size
|
||||||
{
|
{
|
||||||
NSSize new;
|
NSSize new;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue