don't include dlfcn.h on win32
[dia.git] / lib / bezier_conn.h
blob1758bf8403c2ad2af769e2754dac53fc625d897f
1 /* Dia -- an diagram creation/manipulation program
2 * Copyright (C) 1999 Alexander Larsson
4 * BezierConn Copyright (C) 1999 James Henstridge
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef BEZIER_CONN_H
21 #define BEZIER_CONN_H
23 #include "diatypes.h"
24 #include "object.h"
25 #include "boundingbox.h"
27 typedef enum {
28 BEZ_CORNER_SYMMETRIC,
29 BEZ_CORNER_SMOOTH,
30 BEZ_CORNER_CUSP
31 } BezCornerType;
33 /* This is a subclass of Object used to help implementing objects
34 * that connect points with polygonal line-segments.
36 struct _BezierConn {
37 /* Object must be first because this is a 'subclass' of it. */
38 Object object;
40 int numpoints; /* >= 2 */
41 BezPoint *points;
42 BezCornerType *corner_types;
43 PolyBBExtras extra_spacing;
46 void bezierconn_update_data(BezierConn *bez);
47 void bezierconn_update_boundingbox(BezierConn *bez);
48 void bezierconn_simple_draw(BezierConn *bez, DiaRenderer *renderer,
49 real width);
50 void bezierconn_draw_control_lines(BezierConn *bez, DiaRenderer *renderer);
51 void bezierconn_init(BezierConn *bez, int num_points);
52 void bezierconn_set_points(BezierConn *poly, int num_points, BezPoint *points);
53 void bezierconn_destroy(BezierConn *bez);
54 void bezierconn_copy(BezierConn *from, BezierConn *to);
55 void bezierconn_save(BezierConn *bez, ObjectNode obj_node);
56 void bezierconn_load(BezierConn *bez, ObjectNode obj_node); /* NOTE: Does object_init() */
57 ObjectChange *bezierconn_add_segment(BezierConn *bez, int segment, Point *point);
58 ObjectChange *bezierconn_remove_segment(BezierConn *bez, int point);
59 ObjectChange *bezierconn_set_corner_type(BezierConn *bez,
60 Handle *handle,
61 BezCornerType style);
62 void bezierconn_move_handle(BezierConn *bez, Handle *id,
63 Point *to, HandleMoveReason reason);
64 void bezierconn_move(BezierConn *bez, Point *to);
65 real bezierconn_distance_from(BezierConn *bez, Point *point,
66 real line_width);
67 Handle *bezierconn_closest_handle(BezierConn *bez, Point *point);
68 Handle *bezierconn_closest_major_handle(BezierConn *bez, Point *point);
69 int bezierconn_closest_segment(BezierConn *bez, Point *point,
70 real line_width);
71 #endif /* BEZIER_CONN_H */