mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 10:01:14 +00:00
Added some basic implementation for this class.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@10112 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
cd17aabe87
commit
5cf3aef11e
2 changed files with 42 additions and 27 deletions
|
@ -29,13 +29,16 @@
|
|||
#ifndef _GNUstep_H_NSEPSImageRep
|
||||
#define _GNUstep_H_NSEPSImageRep
|
||||
|
||||
#include <Foundation/NSGeometry.h>
|
||||
#include <AppKit/NSImageRep.h>
|
||||
|
||||
@class NSData;
|
||||
|
||||
@interface NSEPSImageRep : NSImageRep <NSCoding>
|
||||
@interface NSEPSImageRep : NSImageRep
|
||||
{
|
||||
// Attributes
|
||||
NSRect _bounds;
|
||||
NSData *_epsData;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -55,12 +58,6 @@
|
|||
//
|
||||
- (void)prepareGState;
|
||||
|
||||
//
|
||||
// NSCoding protocol
|
||||
//
|
||||
- (void)encodeWithCoder:aCoder;
|
||||
- initWithCoder:aDecoder;
|
||||
|
||||
@end
|
||||
|
||||
#endif // _GNUstep_H_NSEPSImageRep
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <gnustep/gui/config.h>
|
||||
#include <Foundation/NSData.h>
|
||||
#include <AppKit/NSEPSImageRep.h>
|
||||
|
||||
@implementation NSEPSImageRep
|
||||
|
@ -34,54 +34,72 @@
|
|||
// Initializing a New Instance
|
||||
+ (id) imageRepWithData: (NSData *)epsData
|
||||
{
|
||||
//[self notImplemented: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
+ (NSArray *) imageRepsWithData: (NSData *)epsData
|
||||
{
|
||||
//[self notImplemented: _cmd];
|
||||
return nil;
|
||||
return [[self alloc] initWithData: epsData];
|
||||
}
|
||||
|
||||
- (id) initWithData: (NSData *)epsData
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
|
||||
_epsData = epsData;
|
||||
// Set bounds from parsed header
|
||||
//_bounds = NSMakeRect();
|
||||
return self;
|
||||
}
|
||||
|
||||
// Getting Image Data
|
||||
- (NSRect) boundingBox
|
||||
{
|
||||
NSRect rect;
|
||||
[self notImplemented: _cmd];
|
||||
return rect;
|
||||
return _bounds;
|
||||
}
|
||||
|
||||
- (NSData *) EPSRepresentation
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
return nil;
|
||||
return _epsData;
|
||||
}
|
||||
|
||||
- (void) prepareGState
|
||||
{
|
||||
// This is for subclasses only
|
||||
}
|
||||
|
||||
// Drawing the Image
|
||||
- (void) prepareGState
|
||||
- (BOOL) draw
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
|
||||
[self prepareGState];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
// NSCopying protocol
|
||||
- (id) copyWithZone: (NSZone *)zone
|
||||
{
|
||||
NSEPSImageRep *copy = [super copyWithZone: zone];
|
||||
|
||||
copy->_epsData = [_epsData copyWithZone: zone];
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
// NSCoding protocol
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
NSData *data = [self EPSRepresentation];
|
||||
|
||||
[super encodeWithCoder: aCoder];
|
||||
[data encodeWithCoder: aCoder];
|
||||
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
[self notImplemented: _cmd];
|
||||
return self;
|
||||
NSData *data;
|
||||
|
||||
self = [super initWithCoder: aDecoder];
|
||||
data = [aDecoder decodeObject];
|
||||
return [self initWithData: data];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue