mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 15:10:38 +00:00
Added coding methods.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@8276 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
181976dcb5
commit
c3b0028f40
1 changed files with 39 additions and 18 deletions
|
@ -34,6 +34,7 @@
|
|||
|
||||
#include <AppKit/config.h>
|
||||
#include <AppKit/NSAffineTransform.h>
|
||||
#include <AppKit/NSBezierPath.h>
|
||||
#include <AppKit/PSOperators.h>
|
||||
|
||||
/* Private definitions */
|
||||
|
@ -67,7 +68,7 @@ static NSAffineTransformStruct identityTransform = {
|
|||
t = (NSAffineTransform*)NSAllocateObject(self, 0, NSDefaultMallocZone());
|
||||
t->matrix = identityTransform;
|
||||
t->rotationAngle = 0.0;
|
||||
return [t autorelease];
|
||||
return AUTORELEASE(t);
|
||||
}
|
||||
|
||||
+ (id) new
|
||||
|
@ -312,24 +313,9 @@ static NSAffineTransformStruct identityTransform = {
|
|||
TY += tranY;
|
||||
}
|
||||
|
||||
|
||||
+ matrixFrom: (const float[6])_matrix
|
||||
{
|
||||
NSAffineTransform *m = [[self alloc] autorelease];
|
||||
|
||||
[m setMatrix: _matrix];
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
- (id) copyWithZone: (NSZone*)zone
|
||||
{
|
||||
NSAffineTransform *new;
|
||||
|
||||
new = (NSAffineTransform*)NSAllocateObject(isa, 0, zone);
|
||||
new->matrix = matrix;
|
||||
new->rotationAngle = rotationAngle;
|
||||
return new;
|
||||
return NSCopyObject(self, 0, zone);
|
||||
}
|
||||
|
||||
- (BOOL) isEqual: (id)anObject
|
||||
|
@ -345,6 +331,41 @@ static NSAffineTransformStruct identityTransform = {
|
|||
return NO;
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
float replace[6];
|
||||
|
||||
[aCoder decodeArrayOfObjCType: @encode(float)
|
||||
count: 6
|
||||
at: replace];
|
||||
[self setMatrix: replace];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
float replace[6];
|
||||
|
||||
[self getMatrix: replace];
|
||||
[aCoder encodeArrayOfObjCType: @encode(float)
|
||||
count: 6
|
||||
at: replace];
|
||||
}
|
||||
|
||||
@end /* NSAffineTransform */
|
||||
|
||||
@implementation NSAffineTransform (GNUstep)
|
||||
|
||||
+ matrixFrom: (const float[6])_matrix
|
||||
{
|
||||
NSAffineTransform *m = AUTORELEASE([self alloc]);
|
||||
|
||||
[m setMatrix: _matrix];
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
- (void) scaleBy: (float)sx :(float)sy
|
||||
{
|
||||
A *= sx; B *= sx;
|
||||
|
@ -558,5 +579,5 @@ static NSAffineTransformStruct identityTransform = {
|
|||
replace[5] = matrix.ty;
|
||||
}
|
||||
|
||||
@end /* NSAffineTransform */
|
||||
@end /* NSAffineTransform (GNUstep) */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue