Documentation.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@18309 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
gcasa 2004-01-04 07:26:50 +00:00
parent 81837807cd
commit 10fa98ab2f
2 changed files with 73 additions and 0 deletions

View file

@ -1,3 +1,8 @@
2004-01-04 02:32 Gregory John Casamento <greg_casamento@yahoo.com>
* Source/NSApplication.m: Documentation.
* Source/NSAffineTransform.m: Documentation.
2004-01-03 23:36 Gregory John Casamento <greg_casamento@yahoo.com> 2004-01-03 23:36 Gregory John Casamento <greg_casamento@yahoo.com>
* Source/GSNibTemplates.m: Removed some uneeded includes. * Source/GSNibTemplates.m: Removed some uneeded includes.

View file

@ -1,5 +1,9 @@
/** <title>NSAffineTransform.m</title> /** <title>NSAffineTransform.m</title>
<abstract>
This class provides a way to perform affine transforms. It provides
a matrix for transforming from one coordinate system to another.
</abstract>
Copyright (C) 1996,1999 Free Software Foundation, Inc. Copyright (C) 1996,1999 Free Software Foundation, Inc.
Author: Ovidiu Predescu <ovidiu@net-community.com> Author: Ovidiu Predescu <ovidiu@net-community.com>
@ -59,6 +63,9 @@ static NSAffineTransformStruct identityTransform = {
1.0, 0.0, 0.0, 1.0, 0.0, 0.0 1.0, 0.0, 0.0, 1.0, 0.0, 0.0
}; };
/**
* Return an autoreleased instance of this class.
*/
+ (NSAffineTransform*) transform + (NSAffineTransform*) transform
{ {
NSAffineTransform *t; NSAffineTransform *t;
@ -68,6 +75,9 @@ static NSAffineTransformStruct identityTransform = {
return AUTORELEASE(t); return AUTORELEASE(t);
} }
/**
* Return an autoreleased instance of this class.
*/
+ (id) new + (id) new
{ {
NSAffineTransform *t; NSAffineTransform *t;
@ -77,6 +87,11 @@ static NSAffineTransformStruct identityTransform = {
return t; return t;
} }
/**
* Appends one transform matrix to another. It does this by performing a
* matrix multiplication of the receiver with aTransform. The resulting
* matrix then replaces the receiver.
*/
- (void) appendTransform: (NSAffineTransform*)aTransform - (void) appendTransform: (NSAffineTransform*)aTransform
{ {
float newA, newB, newC, newD, newTX, newTY; float newA, newB, newC, newD, newTX, newTY;
@ -93,6 +108,10 @@ static NSAffineTransformStruct identityTransform = {
TX = newTX; TY = newTY; TX = newTX; TY = newTY;
} }
/**
* Concatenates the receiver's matrix with the one in the current graphics
* context.
*/
- (void) concat - (void) concat
{ {
float m[6]; float m[6];
@ -105,18 +124,27 @@ static NSAffineTransformStruct identityTransform = {
PSconcat(m); PSconcat(m);
} }
/**
* Initialize the transformation matrix.
*/
- (id) init - (id) init
{ {
matrix = identityTransform; matrix = identityTransform;
return self; return self;
} }
/**
* Initialize the receiever's instance with the instance represented by aTransform.
*/
- (id) initWithTransform: (NSAffineTransform*)aTransform - (id) initWithTransform: (NSAffineTransform*)aTransform
{ {
matrix = aTransform->matrix; matrix = aTransform->matrix;
return self; return self;
} }
/**
* Calculates the inverse of the receiver's matrix and replaces the receiever's matrix with it.
*/
- (void) invert - (void) invert
{ {
float newA, newB, newC, newD, newTX, newTY; float newA, newB, newC, newD, newTX, newTY;
@ -163,6 +191,10 @@ static NSAffineTransformStruct identityTransform = {
TX = newTX; TY = newTY; TX = newTX; TY = newTY;
} }
/**
* Rotates the transformation matrix of the receiver counter-clockwise
* by the number of degrees specified by angle.
*/
- (void) rotateByDegrees: (float)angle - (void) rotateByDegrees: (float)angle
{ {
float newA, newB, newC, newD; float newA, newB, newC, newD;
@ -177,6 +209,10 @@ static NSAffineTransformStruct identityTransform = {
C = newC; D = newD; C = newC; D = newD;
} }
/**
* Rotates the transformation matrix of the receiver counter-clockwise
* by the number of radians specified by angle.
*/
- (void) rotateByRadians: (float)angleRad - (void) rotateByRadians: (float)angleRad
{ {
float newA, newB, newC, newD; float newA, newB, newC, newD;
@ -190,12 +226,20 @@ static NSAffineTransformStruct identityTransform = {
C = newC; D = newD; C = newC; D = newD;
} }
/**
* Scales the transformation matrix of the reciever by the factor specified
* by scale.
*/
- (void) scaleBy: (float)scale - (void) scaleBy: (float)scale
{ {
A *= scale; B *= scale; A *= scale; B *= scale;
C *= scale; D *= scale; C *= scale; D *= scale;
} }
/**
* Scales the X axis of the receiver's transformation matrix by scaleX and
* the Y axis of the transformation matrix by scaleY.
*/
- (void) scaleXBy: (float)scaleX yBy: (float)scaleY - (void) scaleXBy: (float)scaleX yBy: (float)scaleY
{ {
A *= scaleX; B *= scaleX; A *= scaleX; B *= scaleX;
@ -207,6 +251,12 @@ static NSAffineTransformStruct identityTransform = {
GSSetCTM(GSCurrentContext(), self); GSSetCTM(GSCurrentContext(), self);
} }
/**
* <p>
* Sets the structure which represents the matrix of the reciever.
* The struct is of the form:</p>
* <p>{m11, m12, m21, m22, tX, tY}</p>
*/
- (void) setTransformStruct: (NSAffineTransformStruct)val - (void) setTransformStruct: (NSAffineTransformStruct)val
{ {
matrix = val; matrix = val;
@ -220,6 +270,10 @@ static NSAffineTransformStruct identityTransform = {
return AUTORELEASE(path); return AUTORELEASE(path);
} }
/**
* Transforms a single point based on the transformation matrix.
* Returns the resulting point.
*/
- (NSPoint) transformPoint: (NSPoint)aPoint - (NSPoint) transformPoint: (NSPoint)aPoint
{ {
NSPoint new; NSPoint new;
@ -230,6 +284,10 @@ static NSAffineTransformStruct identityTransform = {
return new; return new;
} }
/**
* Transforms the NSSize represented by aSize using the reciever's
* transformation matrix. Returns the resulting NSSize.
*/
- (NSSize) transformSize: (NSSize)aSize - (NSSize) transformSize: (NSSize)aSize
{ {
NSSize new; NSSize new;
@ -244,11 +302,20 @@ static NSAffineTransformStruct identityTransform = {
return new; return new;
} }
/**
* <p>
* Returns the structure which represents the matrix of the reciever.
* The struct is of the form:</p>
* <p>{m11, m12, m21, m22, tX, tY}</p>
*/
- (NSAffineTransformStruct) transformStruct - (NSAffineTransformStruct) transformStruct
{ {
return matrix; return matrix;
} }
/**
* Scales the receiver's matrix based on the factors tranX and tranY.
*/
- (void) translateXBy: (float)tranX yBy: (float)tranY - (void) translateXBy: (float)tranX yBy: (float)tranY
{ {
TX += tranX; TX += tranX;
@ -328,6 +395,7 @@ static NSAffineTransformStruct identityTransform = {
TY = newTY; TY = newTY;
} }
- (void) makeIdentityMatrix - (void) makeIdentityMatrix
{ {
matrix = identityTransform; matrix = identityTransform;