don't include dlfcn.h on win32
[dia.git] / lib / beziershape.h
blobb2fd4682f6a6ec5881cbe671f96c9e1fcff5c041
1 /* Dia -- an diagram creation/manipulation program
2 * Copyright (C) 1999 Alexander Larsson
4 * beziershape.h - code to help implement bezier shapes
5 * Copyright (C) 2000 James Henstridge
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 #ifndef BEZIERSHAPE_H
22 #define BEZIERSHAPE_H
24 #include "diatypes.h"
25 #include "object.h"
26 /* for BezCornerType */
27 #include "bezier_conn.h"
29 #define HANDLE_CORNER (HANDLE_CUSTOM1)
31 /* This is a subclass of Object used to help implementing objects
32 * that form a polygon-like shape of line-segments.
34 struct _BezierShape {
35 /* Object must be first because this is a 'subclass' of it. */
36 Object object;
38 int numpoints; /* >= 2 */
39 BezPoint *points;
40 BezCornerType *corner_types;
41 ElementBBExtras extra_spacing;
44 void beziershape_update_data(BezierShape *bezier);
45 void beziershape_update_boundingbox(BezierShape *bezier);
46 void beziershape_simple_draw(BezierShape *bezier, DiaRenderer *renderer,
47 real width);
48 void beziershape_init(BezierShape *bezier, int num_points);
49 void beziershape_set_points(BezierShape *bezier, int num_points, BezPoint *points);
50 void beziershape_destroy(BezierShape *bezier);
51 void beziershape_copy(BezierShape *from, BezierShape *to);
52 void beziershape_save(BezierShape *bezier, ObjectNode obj_node);
53 /* NOTE: Does object_init() */
54 void beziershape_load(BezierShape *bezier, ObjectNode obj_node);
55 ObjectChange *beziershape_add_segment(BezierShape *bezier, int segment,
56 Point *point);
57 ObjectChange *beziershape_remove_segment(BezierShape *bezier, int point);
58 ObjectChange *beziershape_set_corner_type(BezierShape *bez, Handle *handle,
59 BezCornerType corner_type);
60 void beziershape_move_handle(BezierShape *bezier, Handle *id,
61 Point *to, HandleMoveReason reason);
62 void beziershape_move(BezierShape *bezier, Point *to);
63 real beziershape_distance_from(BezierShape *bezier, Point *point,
64 real line_width);
65 Handle *beziershape_closest_handle(BezierShape *bezier, Point *point);
66 Handle *beziershape_closest_major_handle(BezierShape *bezier, Point *point);
67 int beziershape_closest_segment(BezierShape *bezier, Point *point,
68 real line_width);
69 void beziershape_draw_control_lines(BezierShape *bez, DiaRenderer *renderer);
70 #endif /* BEZIER_SHAPE_H */