ftp.nice.ch/pub/next/text/apps/eText5.0.93.s.tar.gz#/eText5/Kludges.subproj/EPSWriting.m

This is EPSWriting.m in view mode; [Download] [Up]

///////////////////////////////////////////////////////////////////////////////
//	FILENAME:	EPSWriting.m
//	SUMMARY:	Implementation of a EPSWriting category to NXImage
//	SUPERCLASS:	Object:NXImage(EPSWriting)
//	INTERFACE:	None
//	AUTHOR:		Rohit Khare (_EPSWritingImageView by Sharon Zahkour of NeXT)
//	COPYRIGHT:	(c) 1994 California Institure of Technology, eText Project
///////////////////////////////////////////////////////////////////////////////
//  IMPLEMENTATION COMMENTS
//		If there exists an NXEPSImageRep, write out the EPS code.
//		If not, create an offscreen window, draw the NXImage and save as EPS.
///////////////////////////////////////////////////////////////////////////////
//	HISTORY
//	07/16/94:	Created. Derived from TIFFtoEPS.app.
///////////////////////////////////////////////////////////////////////////////

#import <appkit/appkit.h>
#import "EPSWriting.h"

@implementation NXImage (EPSWriting)
- writeEPS:(NXStream *)stream
{
	id	repList;
	int	i,j;
	id theRep=nil;
	char *theCode;
	int	len;

	// choose find EPSRep if possible.
	repList = [self representationList];
	theRep = nil;
	i = [repList count];
	for(j=0; j<i; j++){
	if ([[repList objectAt:j] isKindOf:[NXEPSImageRep class]])
		theRep = [repList objectAt:j];
	}		
	if (theRep && [theRep isKindOf:[NXEPSImageRep class]]) {			
		[theRep getEPS:&theCode length:&len];
		NXWrite(stream, theCode, len);
	} else {
		// we need to convert a bitmap to EPS.
		NXRect 	rect;
		id		iv;
		
		iv = [[_FormatWritingImageView new] useImage:self];
    	[iv getFrame:&rect];
    	[iv copyPSCodeInside:&rect to:stream]; 
	}
	return self;
}
@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.