ftp.nice.ch/peanuts/GeneralData/Documents/adobe/DPS.Purple.Scroll.tar.gz#/NX_Scroll/iinterpreterhooks.m

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

/*
 * (a)  (C) 1990 by Adobe Systems Incorporated. All rights reserved.
 *
 * (b)  If this Sample Code is distributed as part of the Display PostScript
 *	System Software Development Kit from Adobe Systems Incorporated,
 *	then this copy is designated as Development Software and its use is
 *	subject to the terms of the License Agreement attached to such Kit.
 *
 * (c)  If this Sample Code is distributed independently, then the following
 *	terms apply:
 *
 * (d)  This file may be freely copied and redistributed as long as:
 *	1) Parts (a), (d), (e) and (f) continue to be included in the file,
 *	2) If the file has been modified in any way, a notice of such
 *      modification is conspicuously indicated.
 *
 * (e)  PostScript, Display PostScript, and Adobe are registered trademarks of
 *	Adobe Systems Incorporated.
 * 
 * (f) THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO
 *	CHANGE WITHOUT NOTICE, AND SHOULD NOT BE CONSTRUED
 *	AS A COMMITMENT BY ADOBE SYSTEMS INCORPORATED.
 *	ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY
 *	OR LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO
 *	WARRANTY OF ANY KIND (EXPRESS, IMPLIED OR STATUTORY)
 *	WITH RESPECT TO THIS INFORMATION, AND EXPRESSLY
 *	DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, 
 *	FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT
 *	OF THIRD PARTY RIGHTS.
 */

/*
 *	iinterpreterhooks.m
 *
 *	Version:	2.0
 *	Author:	Ken Anderson, Ken Fromm
 *	History:
 *			03-07-91		Added this comment.
 */

#import "Graphic.h"
#import "ScrollApp.h"
#import <objc/List.h>

extern void 	initGparms();

static UPath	*uPath;
static GParms  gParms;
static id		currentList;

void ii_resetPathStruct()
{
	uPath->num_pts = 0;
	uPath->num_ops = 0;
}

void ii_initPathStruct()
{
	uPath = [NXApp  getUpathBuffer];
	ii_resetPathStruct();
	currentList = NULL;
}

void ii_initGraphicStruct()
{
	initGparms(&gParms);
}

void ii_setgray(float  aval)
{
	gParms.color = NXConvertGrayToColor(aval);
}

void ii_setlinewidth(float  aval)
{
	gParms.linewidth = aval;
}

void ii_setlinejoin(int  aval)
{
	gParms.linejoin = (unsigned char) aval;
}

void ii_setdash()
{
	/* setdash not implemented */
}

void ii_setmiterlimit(float  aval)
{
	gParms.miterlimit = aval;
}

void ii_setlinecap(int  aval)
{
	gParms.linecap = (unsigned char) aval;
}

void ii_setrgbcolor(float  r, float g, float b)
{
	gParms.color = NXConvertRGBToColor(r, g, b);
}

void ii_insertPathCoord(NXPoint *aPt, int num_pts, char dps_op, NXPoint *currentpoint)
{
	int	i;

	for (i = 0;  i < num_pts; i++, aPt++)
	{
		uPath->pts[uPath->num_pts++] = aPt->x;
		uPath->pts[uPath->num_pts++] = aPt->y;
	}

	uPath->ops[uPath->num_ops++] = dps_op;		
}

void ii_insertPath(int  path_type, NXRect *bounds)
{
	id		aGraphic;

	NXRect	bbox;

	if (uPath->num_ops > 0)
	{
		bbox = *bounds;
		if (path_type == STROKE)
			NXInsetRect(&bbox, -gParms.linewidth/2, -gParms.linewidth/2);

		aGraphic = [Graphic new];
		gParms.path_type = (unsigned char) path_type;
		[aGraphic  installGparms:&gParms];
		[aGraphic  installUpath:uPath  andBounds:&bbox];

		if (!currentList)
			currentList = [List new];

		[currentList  addObject:aGraphic];
	}
}

void ii_insertPage(int  page)
{	
	[[NXApp getDrawingView]  insertList:currentList];

	currentList = NULL;
}

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