~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to libgimp/gimpvectors_pdb.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2008-10-06 13:30:41 UTC
  • mto: This revision was merged to the branch mainline in revision 35.
  • Revision ID: james.westby@ubuntu.com-20081006133041-3panbkcanaymfsmp
Tags: upstream-2.6.0
ImportĀ upstreamĀ versionĀ 2.6.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
 *
68
68
 * Creates a new empty vectors object.
69
69
 *
70
 
 * Creates a new empty vectors object. Needs to be added to an image
71
 
 * using gimp_image_add_vectors().
 
70
 * Creates a new empty vectors object. The vectors object needs to be
 
71
 * added to the image using gimp_image_add_vectors().
72
72
 *
73
73
 * Returns: the current vector object, 0 if no vector exists in the image.
74
74
 *
97
97
}
98
98
 
99
99
/**
 
100
 * gimp_vectors_new_from_text_layer:
 
101
 * @image_ID: The image.
 
102
 * @layer_ID: The text layer.
 
103
 *
 
104
 * Creates a new vectors object from a text layer.
 
105
 *
 
106
 * Creates a new vectors object from a text layer. The vectors object
 
107
 * needs to be added to the image using gimp_image_add_vectors().
 
108
 *
 
109
 * Returns: The vectors of the text layer.
 
110
 *
 
111
 * Since: GIMP 2.6
 
112
 */
 
113
gint32
 
114
gimp_vectors_new_from_text_layer (gint32 image_ID,
 
115
                                  gint32 layer_ID)
 
116
{
 
117
  GimpParam *return_vals;
 
118
  gint nreturn_vals;
 
119
  gint32 vectors_ID = -1;
 
120
 
 
121
  return_vals = gimp_run_procedure ("gimp-vectors-new-from-text-layer",
 
122
                                    &nreturn_vals,
 
123
                                    GIMP_PDB_IMAGE, image_ID,
 
124
                                    GIMP_PDB_LAYER, layer_ID,
 
125
                                    GIMP_PDB_END);
 
126
 
 
127
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
 
128
    vectors_ID = return_vals[1].data.d_vectors;
 
129
 
 
130
  gimp_destroy_params (return_vals, nreturn_vals);
 
131
 
 
132
  return vectors_ID;
 
133
}
 
134
 
 
135
/**
 
136
 * gimp_vectors_copy:
 
137
 * @vectors_ID: The vectors object to copy.
 
138
 *
 
139
 * Copy a vectors object.
 
140
 *
 
141
 * This procedure copies the specified vectors object and returns the
 
142
 * copy.
 
143
 *
 
144
 * Returns: The newly copied vectors object.
 
145
 *
 
146
 * Since: GIMP 2.6
 
147
 */
 
148
gint32
 
149
gimp_vectors_copy (gint32 vectors_ID)
 
150
{
 
151
  GimpParam *return_vals;
 
152
  gint nreturn_vals;
 
153
  gint32 vectors_copy_ID = -1;
 
154
 
 
155
  return_vals = gimp_run_procedure ("gimp-vectors-copy",
 
156
                                    &nreturn_vals,
 
157
                                    GIMP_PDB_VECTORS, vectors_ID,
 
158
                                    GIMP_PDB_END);
 
159
 
 
160
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
 
161
    vectors_copy_ID = return_vals[1].data.d_vectors;
 
162
 
 
163
  gimp_destroy_params (return_vals, nreturn_vals);
 
164
 
 
165
  return vectors_copy_ID;
 
166
}
 
167
 
 
168
/**
100
169
 * gimp_vectors_get_image:
101
170
 * @vectors_ID: The vectors object.
102
171
 *
1363
1432
 
1364
1433
  return success;
1365
1434
}
 
1435
 
 
1436
/**
 
1437
 * gimp_vectors_export_to_file:
 
1438
 * @image_ID: The image.
 
1439
 * @filename: The name of the SVG file to create.
 
1440
 * @vectors_ID: The vectors object to be saved, or 0 for all in the image.
 
1441
 *
 
1442
 * save a path as an SVG file.
 
1443
 *
 
1444
 * This procedure creates an SVG file to save a Vectors object, that
 
1445
 * is, a path. The resulting file can be edited using a vector graphics
 
1446
 * application, or later reloaded into GIMP. If you pass 0 as the
 
1447
 * 'vectors' argument, then all paths in the image will be exported.
 
1448
 *
 
1449
 * Returns: TRUE on success.
 
1450
 *
 
1451
 * Since: GIMP 2.6
 
1452
 */
 
1453
gboolean
 
1454
gimp_vectors_export_to_file (gint32       image_ID,
 
1455
                             const gchar *filename,
 
1456
                             gint32       vectors_ID)
 
1457
{
 
1458
  GimpParam *return_vals;
 
1459
  gint nreturn_vals;
 
1460
  gboolean success = TRUE;
 
1461
 
 
1462
  return_vals = gimp_run_procedure ("gimp-vectors-export-to-file",
 
1463
                                    &nreturn_vals,
 
1464
                                    GIMP_PDB_IMAGE, image_ID,
 
1465
                                    GIMP_PDB_STRING, filename,
 
1466
                                    GIMP_PDB_VECTORS, vectors_ID,
 
1467
                                    GIMP_PDB_END);
 
1468
 
 
1469
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
1470
 
 
1471
  gimp_destroy_params (return_vals, nreturn_vals);
 
1472
 
 
1473
  return success;
 
1474
}
 
1475
 
 
1476
/**
 
1477
 * gimp_vectors_export_to_string:
 
1478
 * @image_ID: The image.
 
1479
 * @vectors_ID: The vectors object to save, or 0 for all in the image.
 
1480
 *
 
1481
 * Save a path as an SVG string.
 
1482
 *
 
1483
 * This procedure works like gimp_vectors_export_to_file() but creates
 
1484
 * a string rather than a file. The contents are a %NUL-terminated
 
1485
 * string that holds a complete XML document. If you pass 0 as the
 
1486
 * 'vectors' argument, then all paths in the image will be exported.
 
1487
 *
 
1488
 * Returns: A string whose contents are a complete SVG document.
 
1489
 *
 
1490
 * Since: GIMP 2.6
 
1491
 */
 
1492
gchar *
 
1493
gimp_vectors_export_to_string (gint32 image_ID,
 
1494
                               gint32 vectors_ID)
 
1495
{
 
1496
  GimpParam *return_vals;
 
1497
  gint nreturn_vals;
 
1498
  gchar *string = NULL;
 
1499
 
 
1500
  return_vals = gimp_run_procedure ("gimp-vectors-export-to-string",
 
1501
                                    &nreturn_vals,
 
1502
                                    GIMP_PDB_IMAGE, image_ID,
 
1503
                                    GIMP_PDB_VECTORS, vectors_ID,
 
1504
                                    GIMP_PDB_END);
 
1505
 
 
1506
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
 
1507
    string = g_strdup (return_vals[1].data.d_string);
 
1508
 
 
1509
  gimp_destroy_params (return_vals, nreturn_vals);
 
1510
 
 
1511
  return string;
 
1512
}