Export GSImageMagickImageRep.h so that it can to used externally

This commit is contained in:
Gregory John Casamento 2019-11-30 06:21:51 -05:00
parent b13662baac
commit eda8ed07eb
4 changed files with 17 additions and 2 deletions

View file

@ -26,7 +26,7 @@
#define _NSPDFImageRep_h_GNUSTEP_GUI_INCLUDE
#include <AppKit/NSImageRep.h>
#include "GNUstepGUI/GSImageMagickImageRep.h"
#include <GNUstepGUI/GSImageMagickImageRep.h>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST)

View file

@ -497,6 +497,7 @@ GSPrintOperation.h \
GSEPSPrintOperation.h \
GSPDFPrintOperation.h \
GSModelLoaderFactory.h \
GSImageMagickImageRep.h \
GSInstantiator.h \
GSSoundSink.h \
GSSoundSource.h \

View file

@ -69,6 +69,8 @@ static Class NSImageRep_class = NULL;
imageReps = [[NSMutableArray alloc] initWithCapacity: 4];
[imageReps addObject: [NSBitmapImageRep class]];
#if HAVE_IMAGEMAGICK
[imageReps addObject: [NSPDFImageRep class]];
[imageReps addObject: [NSPICTImageRep class]];
[imageReps addObject: [GSImageMagickImageRep class]];
#endif
}

View file

@ -1,7 +1,7 @@
/* Implementation of class NSPDFImageRep
Copyright (C) 2019 Free Software Foundation, Inc.
By: heron
By: Gregory Casamento <greg.casamento@gmail.com>
Date: Fri Nov 15 04:24:27 EST 2019
This file is part of the GNUstep Library.
@ -23,8 +23,20 @@
*/
#include <AppKit/NSPDFImageRep.h>
#include <Foundation/NSString.h>
#include <Foundation/NSData.h>
@implementation NSPDFImageRep
+ (BOOL) canInitWithData: (NSData *)imageData
{
NSData *header = [imageData subdataWithRange: NSMakeRange(0,4)];
NSString *str = [[NSString alloc] initWithData: header encoding: NSUTF8StringEncoding];
AUTORELEASE(str);
return [str isEqualToString: @"%PDF"] &&
[super canInitWithData: imageData];
}
+ (instancetype) imageRepWithData: (NSData *)imageData
{
return AUTORELEASE([[self alloc] initWithData: imageData]);