4 ** Made by Johnny Q. Hacker
5 ** Login <solarion@johnathan>
8 Copyright (C) 2008 Joseph Pingenot
10 This program is free software: you can redistribute it and/or modify
11 it under the terms of the GNU Affero General Public License as published by
12 the Free Software Foundation, either version 3 of the License, or
13 (at your option) any later version.
15 This program 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
18 GNU Affero General Public License for more details.
20 You should have received a copy of the GNU Affero General Public License
21 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 ** Started on Thu Jul 17 10:51:32 2008 Johnny Q. Hacker
24 ** Last update Thu Jul 17 10:51:32 2008 Johnny Q. Hacker
30 #include <glib-2.0/glib-object.h>
32 typedef enum {SQUARE, CIRCLE, STAR, PLUS, MINUS, CROSS} graph_symbol;
64 typedef struct _Graph {
65 GObject parent_instance;
66 /*Array of n_points sets of x,y coords*/
68 /*This draws all of the lines (generally between points)*/
75 struct graph_axis *xaxis;
76 struct graph_axis *yaxis;
79 typedef struct _GraphClass {
80 GObjectClass parent_class;
83 #define GRAPH_TYPE (graph_get_type())
84 #define GRAPH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GRAPH_TYPE, Graph))
85 #define GRAPH_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST ((obj), GRAPH, GraphClass))
86 #define IS_GRAPH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GRAPH_TYPE))
87 #define IS_GRAPH_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((obj), GRAPH_CLASS_TYPE))
88 #define GRAPH_GET_CLASS (G_TYPE_INSTANCE_GET_CLASS ((obj), GRAPH, GraphClass))
90 Graph *graph_new(void);
91 int graph_add_point(Graph* graph, double x, double y, const GString *label);
92 int graph_add_graph_point(Graph* graph, struct graph_point *pt);
93 int graph_add_line(Graph* graph, double p0_x, double p0_y, double p1_x, double p1_y, double p2_x, double p2_y, double p3_x, double p3_y);
94 int graph_add_graph_line(Graph* graph, struct graph_line *l);
95 void graph_add_linear_connectors(Graph* graph);
96 /*Provide x0, x3; x1 and x2 will be set*/
97 void graph_bezier_linear_to_cubic(double x0, double x3, double *x1, double *x2);
98 /*Provide x0, x1, x2. x1 and x2 will be set appropriately.*/
99 void graph_bezier_quadratic_to_cubic(double x0, double x3, double *x1, double *x2);
100 void graph_set_xaxis(Graph *g, struct graph_axis *axis);
101 void graph_set_yaxis(Graph *g, struct graph_axis *axis);
102 int graph_autoset_xaxis(Graph *g, GString *title);
103 int graph_autoset_yaxis(Graph *g, GString *title);
107 #endif /* !GRAPHCLASS_H_ */