1 /*
2  Project: Graphos
3  GRBezierPath.h
4 
5  Copyright (C) 2000-2013 GNUstep Application Project
6 
7  Author: Enrico Sersale (original implementation)
8  Author: Ing. Riccardo Mottola
9 
10  This application is free software; you can redistribute it and/or
11  modify it under the terms of the GNU General Public
12  License as published by the Free Software Foundation; either
13  version 2 of the License, or (at your option) any later version.
14 
15  This application is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  Library General Public License for more details.
19 
20  You should have received a copy of the GNU General Public
21  License along with this library; if not, write to the Free
22  Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
23  */
24 
25 #import <Foundation/Foundation.h>
26 #import <AppKit/AppKit.h>
27 #import "GRPathObject.h"
28 #import "GRBezierControlPoint.h"
29 
30 
31 typedef struct
32 {
33     GRBezierControlPoint *cp;
34     NSPoint p;
35     double t;
36 } hitData;
37 
38 @interface GRBezierPath : GRPathObject
39 {
40     BOOL calculatingHandles;
41     NSMutableArray *controlPoints;
42 }
43 
44 - (void)addControlAtPoint:(NSPoint)aPoint;
45 - (void)addLineToPoint:(NSPoint)aPoint;
46 - (void)addCurveWithBezierHandlePosition:(NSPoint)handlePos;
47 
48 - (void)subdividePathAtPoint:(NSPoint)p splitIt:(BOOL)split;
49 - (void)deletePoint:(GRBezierControlPoint *)p;
50 
51 - (NSMutableArray *)controlPoints;
52 - (BOOL)isPoint:(GRBezierControlPoint *)cp1 onPoint:(GRBezierControlPoint *)cp2;
53 - (GRBezierControlPoint *)pointOnPoint:(GRBezierControlPoint *)aPoint;
54 - (void)confirmNewCurve;
55 
56 - (hitData)hitDataOfPathSegmentOwningPoint:(NSPoint)pt;
57 
58 - (void)moveAddingCoordsOfPoint:(NSPoint)p;
59 
60 - (void)setZoomFactor:(CGFloat)f;
61 
62 - (BOOL)onControlPoint:(NSPoint)p;
63 - (BOOL)onPathBorder:(NSPoint)p;
64 
65 - (GRBezierControlPoint *)firstPoint;
66 - (GRBezierControlPoint *)lastPoint;
67 
68 - (NSUInteger)indexOfPoint:(GRBezierControlPoint *)aPoint;
69 
70 
71 @end
72 
73