More honesty about bug 144394, it's not quite fixed yet.
[dia.git] / lib / beziershape.h
bloba0e854d0aed3bb49e11f5afafdc26c4ef61111f4
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.
22 /** \file beziershape.h Allows to construct closed objects consisting of bezier lines */
24 #ifndef BEZIERSHAPE_H
25 #define BEZIERSHAPE_H
27 #include "diatypes.h"
28 #include "object.h"
29 /* for BezCornerType */
30 #include "bezier_conn.h"
32 #define HANDLE_CORNER (HANDLE_CUSTOM1)
34 /* This is a subclass of DiaObject used to help implementing objects
35 * that form a polygon-like shape of line-segments.
37 struct _BezierShape {
38 /* DiaObject must be first because this is a 'subclass' of it. */
39 DiaObject object;
41 int numpoints; /* >= 2 */
42 BezPoint *points;
43 BezCornerType *corner_types;
44 ElementBBExtras extra_spacing;
47 void beziershape_update_data(BezierShape *bezier);
48 void beziershape_update_boundingbox(BezierShape *bezier);
49 void beziershape_simple_draw(BezierShape *bezier, DiaRenderer *renderer,
50 real width);
51 void beziershape_init(BezierShape *bezier, int num_points);
52 void beziershape_set_points(BezierShape *bezier, int num_points, BezPoint *points);
53 void beziershape_destroy(BezierShape *bezier);
54 void beziershape_copy(BezierShape *from, BezierShape *to);
55 void beziershape_save(BezierShape *bezier, ObjectNode obj_node);
56 /* NOTE: Does object_init() */
57 void beziershape_load(BezierShape *bezier, ObjectNode obj_node);
58 ObjectChange *beziershape_add_segment(BezierShape *bezier, int segment,
59 Point *point);
60 ObjectChange *beziershape_remove_segment(BezierShape *bezier, int point);
61 ObjectChange *beziershape_set_corner_type(BezierShape *bez, Handle *handle,
62 BezCornerType corner_type);
63 ObjectChange *beziershape_move_handle(BezierShape *bezier, Handle *id,
64 Point *to, ConnectionPoint *cp,
65 HandleMoveReason reason,
66 ModifierKeys modifiers);
67 ObjectChange *beziershape_move(BezierShape *bezier, Point *to);
68 real beziershape_distance_from(BezierShape *bezier, Point *point,
69 real line_width);
70 Handle *beziershape_closest_handle(BezierShape *bezier, Point *point);
71 Handle *beziershape_closest_major_handle(BezierShape *bezier, Point *point);
72 int beziershape_closest_segment(BezierShape *bezier, Point *point,
73 real line_width);
74 void beziershape_draw_control_lines(BezierShape *bez, DiaRenderer *renderer);
76 #define BEZSHAPE_COMMON_PROPERTIES \
77 OBJECT_COMMON_PROPERTIES, \
78 { "bez_points", PROP_TYPE_BEZPOINTARRAY, 0, "beziershape points", NULL} \
80 #define BEZSHAPE_COMMON_PROPERTIES_OFFSETS \
81 OBJECT_COMMON_PROPERTIES_OFFSETS, \
82 { "bez_points", PROP_TYPE_BEZPOINTARRAY, \
83 offsetof(BezierShape,points), offsetof(BezierShape,numpoints)} \
85 #endif /* BEZIER_SHAPE_H */