~tkluck/ubuntu/oneiric/goocanvas/v2.0.0

« back to all changes in this revision

Viewing changes to src/goocanvaspolyline.c

  • Committer: Timo Kluck
  • Date: 2011-11-10 20:07:30 UTC
  • Revision ID: tkluck@infty.nl-20111110200730-3tq4hxa1wqemig1p
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
 * Creates a new #GooCanvasPoints struct with space for the given number of
44
44
 * points. It should be freed with goo_canvas_points_unref().
45
45
 * 
46
 
 * Returns: a new #GooCanvasPoints struct.
 
46
 * Returns: (transfer full): a new #GooCanvasPoints struct.
47
47
 **/
48
48
GooCanvasPoints*
49
49
goo_canvas_points_new   (int    num_points)
92
92
    }
93
93
}
94
94
 
 
95
/**
 
96
 * goo_canvas_points_set_point:
 
97
 * @points: a #GooCanvasPoints struct.
 
98
 * @idx: index of point to set.
 
99
 * @x: x value to set point coordinate to.
 
100
 * @y: y value to set point coordinate to.
 
101
 * 
 
102
 * Sets the coordinates of a point in the #GooCanvasPoints struct.
 
103
 *
 
104
 * Since: 2.0.1
 
105
 **/
 
106
void
 
107
goo_canvas_points_set_point(GooCanvasPoints *points, int idx, double x, double y)
 
108
{
 
109
    g_return_if_fail(idx < points->num_points);
 
110
    points->coords[2*idx] = x;
 
111
    points->coords[2*idx + 1] = y;
 
112
}
 
113
 
 
114
/**
 
115
 * goo_canvas_points_get_point:
 
116
 * @points: a #GooCanvasPoints struct.
 
117
 * @idx: index of point to get.
 
118
 * @x: (out): location to store x coordinate.
 
119
 * @y: (out): location to store y coordinate.
 
120
 * 
 
121
 * Gets the coordinates of a point in the #GooCanvasPoints struct.
 
122
 *
 
123
 * Since: 2.0.1
 
124
 **/
 
125
void
 
126
goo_canvas_points_get_point(GooCanvasPoints *points, int idx, double *x, double *y)
 
127
{
 
128
    *x = 0; *y = 0;
 
129
    g_return_if_fail(idx < points->num_points);
 
130
    *x = points->coords[2*idx];
 
131
    *y = points->coords[2*idx + 1];
 
132
}
 
133
 
95
134
 
96
135
GType
97
136
goo_canvas_points_get_type (void)
645
684
 
646
685
/**
647
686
 * goo_canvas_polyline_new:
648
 
 * @parent: the parent item, or %NULL. If a parent is specified, it will assume
 
687
 * @parent: (skip): the parent item, or %NULL. If a parent is specified, it will assume
649
688
 *  ownership of the item, and the item will automatically be freed when it is
650
689
 *  removed from the parent. Otherwise call g_object_unref() to free it.
651
690
 * @close_path: if the last point should be connected to the first.
671
710
 *                                                     NULL);
672
711
 * </programlisting></informalexample>
673
712
 * 
674
 
 * Returns: a new polyline item.
 
713
 * Returns: (transfer full): a new polyline item.
675
714
 **/
676
715
GooCanvasItem*
677
716
goo_canvas_polyline_new               (GooCanvasItem *parent,
716
755
 
717
756
/**
718
757
 * goo_canvas_polyline_new_line:
719
 
 * @parent: the parent item, or %NULL.
 
758
 * @parent: (skip): the parent item, or %NULL.
720
759
 * @x1: the x coordinate of the start of the line.
721
760
 * @y1: the y coordinate of the start of the line.
722
761
 * @x2: the x coordinate of the end of the line.
738
777
 *                                                          NULL);
739
778
 * </programlisting></informalexample>
740
779
 * 
741
 
 * Returns: a new polyline item.
 
780
 * Returns: (transfer full): a new polyline item.
742
781
 **/
743
782
GooCanvasItem*
744
783
goo_canvas_polyline_new_line          (GooCanvasItem *parent,
842
881
 
843
882
  cairo_move_to (cr, arrow->start_arrow_coords[0],
844
883
                 arrow->start_arrow_coords[1]);
845
 
  for (i = 1; i < NUM_ARROW_POINTS; i++)
 
884
  for (i = 1; i < GOO_CANVAS_POLYLINE_NUM_ARROW_POINTS; i++)
846
885
    {
847
886
      cairo_line_to (cr, arrow->start_arrow_coords[i * 2],
848
887
                     arrow->start_arrow_coords[i * 2 + 1]);
866
905
 
867
906
  cairo_move_to (cr, arrow->end_arrow_coords[0],
868
907
                 arrow->end_arrow_coords[1]);
869
 
  for (i = 1; i < NUM_ARROW_POINTS; i++)
 
908
  for (i = 1; i < GOO_CANVAS_POLYLINE_NUM_ARROW_POINTS; i++)
870
909
    {
871
910
      cairo_line_to (cr, arrow->end_arrow_coords[i * 2],
872
911
                     arrow->end_arrow_coords[i * 2 + 1]);
1153
1192
 
1154
1193
/**
1155
1194
 * goo_canvas_polyline_model_new:
1156
 
 * @parent: the parent model, or %NULL. If a parent is specified, it will
 
1195
 * @parent: (skip): the parent model, or %NULL. If a parent is specified, it will
1157
1196
 *  assume ownership of the item, and the item will automatically be freed when
1158
1197
 *  it is removed from the parent. Otherwise call g_object_unref() to free it.
1159
1198
 * @close_path: if the last point should be connected to the first.
1179
1218
 *                                                                NULL);
1180
1219
 * </programlisting></informalexample>
1181
1220
 * 
1182
 
 * Returns: a new polyline model.
 
1221
 * Returns: (transfer full): a new polyline model.
1183
1222
 **/
1184
1223
GooCanvasItemModel*
1185
1224
goo_canvas_polyline_model_new (GooCanvasItemModel *parent,
1224
1263
 
1225
1264
/**
1226
1265
 * goo_canvas_polyline_model_new_line:
1227
 
 * @parent: the parent model, or %NULL.
 
1266
 * @parent: (skip): the parent model, or %NULL.
1228
1267
 * @x1: the x coordinate of the start of the line.
1229
1268
 * @y1: the y coordinate of the start of the line.
1230
1269
 * @x2: the x coordinate of the end of the line.
1246
1285
 *                                                                     NULL);
1247
1286
 * </programlisting></informalexample>
1248
1287
 * 
1249
 
 * Returns: a new polyline model.
 
1288
 * Returns: (transfer full): a new polyline model.
1250
1289
 **/
1251
1290
GooCanvasItemModel*
1252
1291
goo_canvas_polyline_model_new_line (GooCanvasItemModel *parent,