mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 20:01:11 +00:00
Implemented canInitWithData:, imageUnfilteredFileTypes
and imageUnfilteredPasteboardTypes. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@10119 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
32317597eb
commit
ce1ca29ea5
1 changed files with 39 additions and 0 deletions
|
@ -26,11 +26,50 @@
|
|||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSData.h>
|
||||
#include <AppKit/NSPasteboard.h>
|
||||
#include <AppKit/NSEPSImageRep.h>
|
||||
|
||||
@implementation NSEPSImageRep
|
||||
|
||||
+ (BOOL) canInitWithData: (NSData *)data
|
||||
{
|
||||
char buffer[2];
|
||||
|
||||
[data getBytes: buffer length: 2];
|
||||
|
||||
// Simple check for Postscript
|
||||
if (buffer[0] == '%' && buffer[1] == '!')
|
||||
return YES;
|
||||
else
|
||||
return NO;
|
||||
}
|
||||
|
||||
+ (NSArray *) imageUnfilteredFileTypes
|
||||
{
|
||||
static NSArray *types = nil;
|
||||
|
||||
if (types == nil)
|
||||
{
|
||||
types = [[NSArray alloc] initWithObjects: @"eps", nil];
|
||||
}
|
||||
|
||||
return types;
|
||||
}
|
||||
|
||||
+ (NSArray *) imageUnfilteredPasteboardTypes
|
||||
{
|
||||
static NSArray *types = nil;
|
||||
|
||||
if (types == nil)
|
||||
{
|
||||
types = [[NSArray alloc] initWithObjects: NSPostScriptPboardType, nil];
|
||||
}
|
||||
|
||||
return types;
|
||||
}
|
||||
|
||||
// Initializing a New Instance
|
||||
+ (id) imageRepWithData: (NSData *)epsData
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue