Base the new image reps off of GSImageMagickImageRep since both formats are supported by that image rep. The subclasses will access specific features not exposed in the GSImageMagickImageRep for those formats

This commit is contained in:
Gregory John Casamento 2019-11-29 11:04:03 -05:00
parent 4afa52fb1e
commit 2050631ca6
4 changed files with 12 additions and 65 deletions

View file

@ -26,6 +26,7 @@
#define _NSPDFImageRep_h_GNUSTEP_GUI_INCLUDE
#include <AppKit/NSImageRep.h>
#include "GNUstepGUI/GSImageMagickImageRep.h"
#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST)
@ -33,9 +34,8 @@
extern "C" {
#endif
@interface NSPDFImageRep : NSImageRep
@interface NSPDFImageRep : GSImageMagickImageRep
{
NSData *_imageData;
NSRect _bounds;
NSInteger _pageCount;
NSInteger _currentPage;

View file

@ -27,6 +27,8 @@
#include <AppKit/NSImageRep.h>
#include <Foundation/NSGeometry.h>
#import "GNUstepGUI/GSImageMagickImageRep.h"
#if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST)
@ -36,9 +38,8 @@ extern "C" {
@class NSData;
@interface NSPICTImageRep : NSImageRep
@interface NSPICTImageRep : GSImageMagickImageRep
{
NSData *_imageData;
NSData *_pictRepresentation;
NSRect _boundingBox;
NSUInteger _position;

View file

@ -35,7 +35,9 @@
self = [super init];
if(self != nil)
{
ASSIGNCOPY(_imageData, imageData);
#if HAVE_IMAGEMAGICK
#endif
}
return self;
}

View file

@ -24,46 +24,6 @@
#include <AppKit/NSPICTImageRep.h>
#define BYTE unsigned char
#define DWORD unsigned int
#define WORD unsigned short
#define SHORT short
struct PICT_Header
{
// Initial header
SHORT file_size;
SHORT x_top_left;
SHORT y_top_left;
SHORT x_lower_right;
SHORT y_lower_right;
// Version 2
SHORT version_operator;
SHORT version_num;
// picSize
WORD pic_size;
WORD image_top;
WORD image_left;
WORD image_bottom;
WORD image_right;
// picFrame v2
WORD version;
WORD pic_version;
WORD reserved_header_opcode;
WORD header_opcode;
DWORD picture_size_bytes;
DWORD original_horizontal_resolution;
DWORD original_vertical_resolution;
WORD x_value_of_top_left_of_image;
WORD y_value_of_top_left_of_image;
WORD x_value_of_lower_right_of_image;
WORD y_value_of_lower_right_of_image;
DWORD reserved;
};
@implementation NSPICTImageRep
+ (instancetype) imageRepWithData: (NSData *)imageData
@ -80,18 +40,12 @@ struct PICT_Header
- (instancetype) initWithData: (NSData *)imageData
{
self = [super init];
self = [super initWithData: imageData];
if (self != nil)
{
BOOL result = NO;
ASSIGNCOPY(_imageData, imageData);
result = [self _readHeader];
if (result == NO)
{
RELEASE(self);
return nil;
}
#if HAVE_IMAGEMAGICK
#endif
}
return self;
}
@ -106,15 +60,5 @@ struct PICT_Header
return [_pictRepresentation copy];
}
- (BOOL) _drawPICT
{
return NO;
}
- (BOOL) draw
{
return [self _drawPICT];
}
@end