ftp.nice.ch/peanuts/GeneralData/Documents/adobe/DPS.Purple.HitDetect.tar.gz#/NX_HitDetect/Bezier.h

This is Bezier.h 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.
 */

/*
 *	Bezier.h
 *
 *	This class retains the points for a  bezier curve. Since this is the only
 *	graphical object class, many of the methods found here would probably
 *	be found in the generic graphic object class. The areas in particular that
 *	are special to a bezier are obtaining the scrolling rectangle and the
 *	constraining the drawing.  Special steps are necessary because if the
 *	first or last control point is selected then the second and third point
 *	are used in the calculations as well. 
 *
 *	Version:	2.0
 *	Author:	Ken Fromm
 *	History:
 *			03-07-91		Added this comment.
 */

#import "DrawingView.h"
#import <objc/Object.h>

#define COLOR					NX_BLACK
#define WIDTH					0.15

#define  PTS_BEZIER				4
#define  OPS_BEZIER				2

#define	LLX(pts)	(pts[0])
#define	LLY(pts)	(pts[1])
#define	URX(pts)	(pts[2])
#define	URY(pts)	(pts[3])

/*
 *  Instance variable - the pts array in path contains the 4 bounding
 *  box coordinates plus the 4 points that describe the Bezier.
 */
@interface Bezier:Object
{
	UPath	path;			/*  Holds the user path description. */
}

- initFrame:(NXRect *)frm;

- create:(const NXRect *)frm;

- (UPath *) getPath;
- copyPts:sourceId;

- getBounds:(NXRect *)bRect  withKnobs:(BOOL) flag;
- getPoint:(int) pt_num  :(NXPoint *) pt;
- getScrollRect:(int) pt_num  :(NXRect *) aRect;

- constrainPoint:(NXPoint *)aPt  andNumber:(int) pt_num  toView:aView;

- changePoint:(int) pt_num  :(const NXPoint *) pt;
- setPoint:(int) pt_num  :(const NXPoint *) pt;

- moveAll:(const NXPoint *) pt;

- (BOOL) hitControl:(const NXRect *)hitRect :(int *) pt_num  :(float) controlsize;
- (BOOL) hitObject:(UPath *) hitUpath;

- putControlUPath:(UPath *) drawUpath forRect:(NXRect *)r  :(NXPoint *) lastPoint;
- putControlLinesUPath:(UPath *) drawUpath  forRect:(NXRect *) r;

- drawObject:(NXRect *)r  withUcache:(BOOL)uFlag;

@end

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