gimpbrush_pdb.c 22.6 KB
Newer Older
1 2 3 4 5
/* LIBGIMP - The GIMP Library
 * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
 *
 * gimpbrush_pdb.c
 *
6
 * This library is free software: you can redistribute it and/or
7 8
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
9
 * version 3 of the License, or (at your option) any later version.
10 11 12 13 14 15 16
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
17 18
 * License along with this library.  If not, see
 * <http://www.gnu.org/licenses/>.
19 20
 */

21
/* NOTE: This file is auto-generated by pdbgen.pl */
22 23 24

#include "config.h"

25 26
#include <string.h>

27 28
#include "gimp.h"

29 30 31 32 33 34 35 36 37 38

/**
 * SECTION: gimpbrush
 * @title: gimpbrush
 * @short_description: Functions operating on a single brush.
 *
 * Functions operating on a single brush.
 **/


39 40 41 42
/**
 * gimp_brush_new:
 * @name: The requested name of the new brush.
 *
43
 * Creates a new brush.
44
 *
45
 * This procedure creates a new, uninitialized brush.
46
 *
47 48
 * Returns: The actual new brush name. The returned value must be freed
 * with g_free().
49
 *
50
 * Since: 2.2
51
 **/
52 53 54 55 56
gchar *
gimp_brush_new (const gchar *name)
{
  GimpParam *return_vals;
  gint nreturn_vals;
57
  gchar *actual_name = NULL;
58

59
  return_vals = gimp_run_procedure ("gimp-brush-new",
60 61 62
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);
63 64

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
65
    actual_name = g_strdup (return_vals[1].data.d_string);
66 67 68

  gimp_destroy_params (return_vals, nreturn_vals);

69
  return actual_name;
70 71 72 73
}

/**
 * gimp_brush_duplicate:
74
 * @name: The brush name.
75
 *
76
 * Duplicates a brush.
77
 *
78
 * This procedure creates an identical brush by a different name.
79
 *
80 81
 * Returns: The name of the brush's copy. The returned value must be
 * freed with g_free().
82
 *
83
 * Since: 2.2
84
 **/
85 86 87 88 89
gchar *
gimp_brush_duplicate (const gchar *name)
{
  GimpParam *return_vals;
  gint nreturn_vals;
90
  gchar *copy_name = NULL;
91

92
  return_vals = gimp_run_procedure ("gimp-brush-duplicate",
93 94 95
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);
96 97

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
98
    copy_name = g_strdup (return_vals[1].data.d_string);
99 100 101

  gimp_destroy_params (return_vals, nreturn_vals);

102
  return copy_name;
103 104
}

105 106 107 108
/**
 * gimp_brush_is_generated:
 * @name: The brush name.
 *
109
 * Tests if brush is generated.
110
 *
111
 * Returns TRUE if this brush is parametric, FALSE for other types.
112
 *
113
 * Returns: TRUE if the brush is generated.
114
 *
115
 * Since: 2.4
116
 **/
117 118 119 120 121 122 123
gboolean
gimp_brush_is_generated (const gchar *name)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean generated = FALSE;

124
  return_vals = gimp_run_procedure ("gimp-brush-is-generated",
125 126 127
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);
128 129 130 131 132 133 134 135 136

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    generated = return_vals[1].data.d_int32;

  gimp_destroy_params (return_vals, nreturn_vals);

  return generated;
}

137 138
/**
 * gimp_brush_rename:
139
 * @name: The brush name.
140 141
 * @new_name: The new name of the brush.
 *
142
 * Renames a brush.
143
 *
144
 * This procedure renames a brush.
145
 *
146 147
 * Returns: The actual new name of the brush. The returned value must
 * be freed with g_free().
148
 *
149
 * Since: 2.2
150
 **/
151 152
gchar *
gimp_brush_rename (const gchar *name,
153
                   const gchar *new_name)
154 155 156
{
  GimpParam *return_vals;
  gint nreturn_vals;
157
  gchar *actual_name = NULL;
158

159
  return_vals = gimp_run_procedure ("gimp-brush-rename",
160 161 162 163
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_STRING, new_name,
                                    GIMP_PDB_END);
164 165

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
166
    actual_name = g_strdup (return_vals[1].data.d_string);
167 168 169

  gimp_destroy_params (return_vals, nreturn_vals);

170
  return actual_name;
171 172 173 174
}

/**
 * gimp_brush_delete:
175
 * @name: The brush name.
176
 *
177
 * Deletes a brush.
178
 *
179
 * This procedure deletes a brush.
180 181 182
 *
 * Returns: TRUE on success.
 *
183
 * Since: 2.2
184
 **/
185 186 187 188 189 190 191
gboolean
gimp_brush_delete (const gchar *name)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

192
  return_vals = gimp_run_procedure ("gimp-brush-delete",
193 194 195
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);
196 197 198 199 200 201 202 203

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

204 205 206 207
/**
 * gimp_brush_is_editable:
 * @name: The brush name.
 *
208
 * Tests if brush can be edited.
209
 *
210
 * Returns TRUE if you have permission to change the brush.
211
 *
212
 * Returns: TRUE if the brush can be edited.
213
 *
214
 * Since: 2.4
215
 **/
216 217 218 219 220 221 222
gboolean
gimp_brush_is_editable (const gchar *name)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean editable = FALSE;

223
  return_vals = gimp_run_procedure ("gimp-brush-is-editable",
224 225 226
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);
227 228 229 230 231 232 233 234 235

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    editable = return_vals[1].data.d_int32;

  gimp_destroy_params (return_vals, nreturn_vals);

  return editable;
}

236 237
/**
 * gimp_brush_get_info:
238
 * @name: The brush name.
239 240
 * @width: The brush width.
 * @height: The brush height.
241 242
 * @mask_bpp: The brush mask bpp.
 * @color_bpp: The brush color bpp.
243
 *
244
 * Retrieves information about the specified brush.
245
 *
246 247
 * This procedure retrieves information about the specified brush:
 * brush extents (width and height), color depth and mask depth.
248 249 250
 *
 * Returns: TRUE on success.
 *
251
 * Since: 2.2
252
 **/
253 254
gboolean
gimp_brush_get_info (const gchar *name,
255 256 257 258
                     gint        *width,
                     gint        *height,
                     gint        *mask_bpp,
                     gint        *color_bpp)
259 260 261 262 263
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

264
  return_vals = gimp_run_procedure ("gimp-brush-get-info",
265 266 267
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);
268 269 270

  *width = 0;
  *height = 0;
271 272
  *mask_bpp = 0;
  *color_bpp = 0;
273 274 275 276 277 278 279

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  if (success)
    {
      *width = return_vals[1].data.d_int32;
      *height = return_vals[2].data.d_int32;
280 281
      *mask_bpp = return_vals[3].data.d_int32;
      *color_bpp = return_vals[4].data.d_int32;
282 283 284 285 286 287 288
    }

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

289 290 291 292 293
/**
 * gimp_brush_get_pixels:
 * @name: The brush name.
 * @width: The brush width.
 * @height: The brush height.
294
 * @mask_bpp: The brush mask bpp.
295 296
 * @num_mask_bytes: Length of brush mask data.
 * @mask_bytes: The brush mask data.
297 298 299
 * @color_bpp: The brush color bpp.
 * @num_color_bytes: Length of brush color data.
 * @color_bytes: The brush color data.
300
 *
301
 * Retrieves information about the specified brush.
302 303 304 305 306 307
 *
 * This procedure retrieves information about the specified brush. This
 * includes the brush extents (width and height) and its pixels data.
 *
 * Returns: TRUE on success.
 *
308
 * Since: 2.2
309
 **/
310 311
gboolean
gimp_brush_get_pixels (const gchar  *name,
312 313 314 315 316 317 318 319
                       gint         *width,
                       gint         *height,
                       gint         *mask_bpp,
                       gint         *num_mask_bytes,
                       guint8      **mask_bytes,
                       gint         *color_bpp,
                       gint         *num_color_bytes,
                       guint8      **color_bytes)
320 321 322 323 324
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

325
  return_vals = gimp_run_procedure ("gimp-brush-get-pixels",
326 327 328
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);
329 330 331

  *width = 0;
  *height = 0;
332
  *mask_bpp = 0;
333 334
  *num_mask_bytes = 0;
  *mask_bytes = NULL;
335 336 337
  *color_bpp = 0;
  *num_color_bytes = 0;
  *color_bytes = NULL;
338 339 340 341 342 343 344

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  if (success)
    {
      *width = return_vals[1].data.d_int32;
      *height = return_vals[2].data.d_int32;
345 346
      *mask_bpp = return_vals[3].data.d_int32;
      *num_mask_bytes = return_vals[4].data.d_int32;
347
      *mask_bytes = g_new (guint8, *num_mask_bytes);
348 349 350
      memcpy (*mask_bytes,
              return_vals[5].data.d_int8array,
              *num_mask_bytes * sizeof (guint8));
351 352 353
      *color_bpp = return_vals[6].data.d_int32;
      *num_color_bytes = return_vals[7].data.d_int32;
      *color_bytes = g_new (guint8, *num_color_bytes);
354 355 356
      memcpy (*color_bytes,
              return_vals[8].data.d_int8array,
              *num_color_bytes * sizeof (guint8));
357 358 359 360 361 362 363
    }

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

364 365
/**
 * gimp_brush_get_spacing:
366
 * @name: The brush name.
367 368
 * @spacing: The brush spacing.
 *
369
 * Gets the brush spacing.
370 371 372 373 374 375 376
 *
 * This procedure returns the spacing setting for the specified brush.
 * The return value is an integer between 0 and 1000 which represents
 * percentage of the maximum of the width and height of the mask.
 *
 * Returns: TRUE on success.
 *
377
 * Since: 2.2
378
 **/
379 380
gboolean
gimp_brush_get_spacing (const gchar *name,
381
                        gint        *spacing)
382 383 384 385 386
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

387
  return_vals = gimp_run_procedure ("gimp-brush-get-spacing",
388 389 390
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);
391 392 393 394 395 396 397 398 399 400 401 402 403 404 405

  *spacing = 0;

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  if (success)
    *spacing = return_vals[1].data.d_int32;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_brush_set_spacing:
406
 * @name: The brush name.
407 408
 * @spacing: The brush spacing.
 *
409
 * Sets the brush spacing.
410 411 412 413 414 415
 *
 * This procedure modifies the spacing setting for the specified brush.
 * The value should be a integer between 0 and 1000.
 *
 * Returns: TRUE on success.
 *
416
 * Since: 2.4
417
 **/
418 419
gboolean
gimp_brush_set_spacing (const gchar *name,
420
                        gint         spacing)
421 422 423 424 425
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

426
  return_vals = gimp_run_procedure ("gimp-brush-set-spacing",
427 428 429 430
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_INT32, spacing,
                                    GIMP_PDB_END);
431 432 433 434 435 436 437

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}
438 439 440 441 442

/**
 * gimp_brush_get_shape:
 * @name: The brush name.
 *
443
 * Gets the shape of a generated brush.
444 445 446 447 448 449 450 451
 *
 * This procedure gets the shape value for a generated brush. If called
 * for any other type of brush, it does not succeed. The current
 * possibilities are Circle (GIMP_BRUSH_GENERATED_CIRCLE), Square
 * (GIMP_BRUSH_GENERATED_SQUARE), and Diamond
 * (GIMP_BRUSH_GENERATED_DIAMOND). Other shapes are likely to be added
 * in the future.
 *
452
 * Returns: The brush shape.
453
 *
454
 * Since: 2.4
455
 **/
456
GimpBrushGeneratedShape
457 458 459 460
gimp_brush_get_shape (const gchar *name)
{
  GimpParam *return_vals;
  gint nreturn_vals;
461
  GimpBrushGeneratedShape shape = 0;
462

463
  return_vals = gimp_run_procedure ("gimp-brush-get-shape",
464 465 466
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);
467 468 469 470 471 472 473 474 475 476

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    shape = return_vals[1].data.d_int32;

  gimp_destroy_params (return_vals, nreturn_vals);

  return shape;
}

/**
477
 * gimp_brush_set_shape:
478
 * @name: The brush name.
479
 * @shape_in: The brush shape.
480
 *
481
 * Sets the shape of a generated brush.
482
 *
483 484 485 486 487 488
 * This procedure sets the shape value for a generated brush. If called
 * for any other type of brush, it does not succeed. The current
 * possibilities are Circle (GIMP_BRUSH_GENERATED_CIRCLE), Square
 * (GIMP_BRUSH_GENERATED_SQUARE), and Diamond
 * (GIMP_BRUSH_GENERATED_DIAMOND). Other shapes are likely to be added
 * in the future.
489
 *
490
 * Returns: The brush shape actually assigned.
491
 *
492
 * Since: 2.4
493
 **/
494 495 496
GimpBrushGeneratedShape
gimp_brush_set_shape (const gchar             *name,
                      GimpBrushGeneratedShape  shape_in)
497 498 499
{
  GimpParam *return_vals;
  gint nreturn_vals;
500
  GimpBrushGeneratedShape shape_out = 0;
501

502
  return_vals = gimp_run_procedure ("gimp-brush-set-shape",
503 504
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
505
                                    GIMP_PDB_INT32, shape_in,
506
                                    GIMP_PDB_END);
507 508

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
509
    shape_out = return_vals[1].data.d_int32;
510 511 512

  gimp_destroy_params (return_vals, nreturn_vals);

513
  return shape_out;
514 515 516
}

/**
517
 * gimp_brush_get_radius:
518 519
 * @name: The brush name.
 *
520
 * Gets the radius of a generated brush.
521
 *
522
 * This procedure gets the radius value for a generated brush. If
523 524
 * called for any other type of brush, it does not succeed.
 *
525
 * Returns: The radius of the brush in pixels.
526
 *
527
 * Since: 2.4
528
 **/
529 530
gdouble
gimp_brush_get_radius (const gchar *name)
531 532 533
{
  GimpParam *return_vals;
  gint nreturn_vals;
534
  gdouble radius = 0.0;
535

536
  return_vals = gimp_run_procedure ("gimp-brush-get-radius",
537 538 539
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);
540 541

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
542
    radius = return_vals[1].data.d_float;
543 544 545

  gimp_destroy_params (return_vals, nreturn_vals);

546
  return radius;
547 548 549
}

/**
550
 * gimp_brush_set_radius:
551
 * @name: The brush name.
552
 * @radius_in: The desired brush radius in pixel.
553
 *
554
 * Sets the radius of a generated brush.
555
 *
556 557
 * This procedure sets the radius for a generated brush. If called for
 * any other type of brush, it does not succeed.
558
 *
559
 * Returns: The brush radius actually assigned.
560
 *
561
 * Since: 2.4
562
 **/
563
gdouble
564 565
gimp_brush_set_radius (const gchar *name,
                       gdouble      radius_in)
566 567 568
{
  GimpParam *return_vals;
  gint nreturn_vals;
569
  gdouble radius_out = 0.0;
570

571
  return_vals = gimp_run_procedure ("gimp-brush-set-radius",
572 573
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
574
                                    GIMP_PDB_FLOAT, radius_in,
575
                                    GIMP_PDB_END);
576 577

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
578
    radius_out = return_vals[1].data.d_float;
579 580 581

  gimp_destroy_params (return_vals, nreturn_vals);

582
  return radius_out;
583 584 585
}

/**
586
 * gimp_brush_get_spikes:
587 588
 * @name: The brush name.
 *
589
 * Gets the number of spikes for a generated brush.
590
 *
591 592
 * This procedure gets the number of spikes for a generated brush. If
 * called for any other type of brush, it does not succeed.
593
 *
594
 * Returns: The number of spikes on the brush.
595
 *
596
 * Since: 2.4
597
 **/
598 599
gint
gimp_brush_get_spikes (const gchar *name)
600 601 602
{
  GimpParam *return_vals;
  gint nreturn_vals;
603
  gint spikes = 0;
604

605
  return_vals = gimp_run_procedure ("gimp-brush-get-spikes",
606 607 608
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);
609 610

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
611
    spikes = return_vals[1].data.d_int32;
612 613 614

  gimp_destroy_params (return_vals, nreturn_vals);

615
  return spikes;
616 617 618
}

/**
619
 * gimp_brush_set_spikes:
620
 * @name: The brush name.
621
 * @spikes_in: The desired number of spikes.
622
 *
623
 * Sets the number of spikes for a generated brush.
624
 *
625
 * This procedure sets the number of spikes for a generated brush. If
626 627
 * called for any other type of brush, it does not succeed.
 *
628
 * Returns: The number of spikes actually assigned.
629
 *
630
 * Since: 2.4
631
 **/
632 633 634
gint
gimp_brush_set_spikes (const gchar *name,
                       gint         spikes_in)
635 636 637
{
  GimpParam *return_vals;
  gint nreturn_vals;
638
  gint spikes_out = 0;
639

640
  return_vals = gimp_run_procedure ("gimp-brush-set-spikes",
641 642
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
643
                                    GIMP_PDB_INT32, spikes_in,
644
                                    GIMP_PDB_END);
645 646

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
647
    spikes_out = return_vals[1].data.d_int32;
648 649 650

  gimp_destroy_params (return_vals, nreturn_vals);

651
  return spikes_out;
652 653 654
}

/**
655
 * gimp_brush_get_hardness:
656 657
 * @name: The brush name.
 *
658
 * Gets the hardness of a generated brush.
659
 *
660
 * This procedure gets the hardness of a generated brush. The hardness
661 662 663
 * of a brush is the amount its intensity fades at the outside edge, as
 * a float between 0.0 and 1.0. If called for any other type of brush,
 * the function does not succeed.
664
 *
665
 * Returns: The hardness of the brush.
666
 *
667
 * Since: 2.4
668
 **/
669 670
gdouble
gimp_brush_get_hardness (const gchar *name)
671 672 673
{
  GimpParam *return_vals;
  gint nreturn_vals;
674
  gdouble hardness = 0.0;
675

676
  return_vals = gimp_run_procedure ("gimp-brush-get-hardness",
677 678 679
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);
680 681

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
682
    hardness = return_vals[1].data.d_float;
683 684 685

  gimp_destroy_params (return_vals, nreturn_vals);

686
  return hardness;
687 688 689
}

/**
690
 * gimp_brush_set_hardness:
691
 * @name: The brush name.
692
 * @hardness_in: The desired brush hardness.
693
 *
694
 * Sets the hardness of a generated brush.
695
 *
696
 * This procedure sets the hardness for a generated brush. If called
697 698
 * for any other type of brush, it does not succeed. The value should
 * be a float between 0.0 and 1.0.
699
 *
700
 * Returns: The brush hardness actually assigned.
701
 *
702
 * Since: 2.4
703
 **/
704
gdouble
705 706
gimp_brush_set_hardness (const gchar *name,
                         gdouble      hardness_in)
707 708 709
{
  GimpParam *return_vals;
  gint nreturn_vals;
710
  gdouble hardness_out = 0.0;
711

712
  return_vals = gimp_run_procedure ("gimp-brush-set-hardness",
713 714
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
715
                                    GIMP_PDB_FLOAT, hardness_in,
716
                                    GIMP_PDB_END);
717 718

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
719
    hardness_out = return_vals[1].data.d_float;
720 721 722

  gimp_destroy_params (return_vals, nreturn_vals);

723
  return hardness_out;
724 725 726
}

/**
727
 * gimp_brush_get_aspect_ratio:
728 729
 * @name: The brush name.
 *
730
 * Gets the aspect ratio of a generated brush.
731
 *
732
 * This procedure gets the aspect ratio of a generated brush. If called
733 734
 * for any other type of brush, it does not succeed. The return value
 * is a float between 0.0 and 1000.0.
735
 *
736
 * Returns: The aspect ratio of the brush.
737
 *
738
 * Since: 2.4
739
 **/
740 741
gdouble
gimp_brush_get_aspect_ratio (const gchar *name)
742 743 744
{
  GimpParam *return_vals;
  gint nreturn_vals;
745
  gdouble aspect_ratio = 0.0;
746

747
  return_vals = gimp_run_procedure ("gimp-brush-get-aspect-ratio",
748 749 750
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);
751 752

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
753
    aspect_ratio = return_vals[1].data.d_float;
754 755 756

  gimp_destroy_params (return_vals, nreturn_vals);

757
  return aspect_ratio;
758 759 760
}

/**
761
 * gimp_brush_set_aspect_ratio:
762
 * @name: The brush name.
763
 * @aspect_ratio_in: The desired brush aspect ratio.
764
 *
765
 * Sets the aspect ratio of a generated brush.
766
 *
767
 * This procedure sets the aspect ratio for a generated brush. If
768 769
 * called for any other type of brush, it does not succeed. The value
 * should be a float between 0.0 and 1000.0.
770
 *
771
 * Returns: The brush aspect ratio actually assigned.
772
 *
773
 * Since: 2.4
774
 **/
775
gdouble
776 777
gimp_brush_set_aspect_ratio (const gchar *name,
                             gdouble      aspect_ratio_in)
778 779 780
{
  GimpParam *return_vals;
  gint nreturn_vals;
781
  gdouble aspect_ratio_out = 0.0;
782

783
  return_vals = gimp_run_procedure ("gimp-brush-set-aspect-ratio",
784 785
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
786
                                    GIMP_PDB_FLOAT, aspect_ratio_in,
787
                                    GIMP_PDB_END);
788 789

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
790
    aspect_ratio_out = return_vals[1].data.d_float;
791 792 793

  gimp_destroy_params (return_vals, nreturn_vals);

794
  return aspect_ratio_out;
795 796 797
}

/**
798
 * gimp_brush_get_angle:
799 800
 * @name: The brush name.
 *
801
 * Gets the rotation angle of a generated brush.
802
 *
803
 * This procedure gets the angle of rotation for a generated brush. If
804 805
 * called for any other type of brush, it does not succeed.
 *
806
 * Returns: The rotation angle of the brush in degree.
807
 *
808
 * Since: 2.4
809
 **/
810
gdouble
811
gimp_brush_get_angle (const gchar *name)
812 813 814
{
  GimpParam *return_vals;
  gint nreturn_vals;
815
  gdouble angle = 0.0;
816

817
  return_vals = gimp_run_procedure ("gimp-brush-get-angle",
818 819 820
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);
821 822

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
823
    angle = return_vals[1].data.d_float;
824 825 826

  gimp_destroy_params (return_vals, nreturn_vals);

827
  return angle;
828 829 830 831 832
}

/**
 * gimp_brush_set_angle:
 * @name: The brush name.
833
 * @angle_in: The desired brush rotation angle in degree.
834
 *
835
 * Sets the rotation angle of a generated brush.
836 837 838 839 840 841
 *
 * This procedure sets the rotation angle for a generated brush. If
 * called for any other type of brush, it does not succeed.
 *
 * Returns: The brush rotation angle actually assigned.
 *
842
 * Since: 2.4
843
 **/
844 845
gdouble
gimp_brush_set_angle (const gchar *name,
846
                      gdouble      angle_in)
847 848 849
{
  GimpParam *return_vals;
  gint nreturn_vals;
850
  gdouble angle_out = 0.0;
851

852
  return_vals = gimp_run_procedure ("gimp-brush-set-angle",
853 854 855 856
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_FLOAT, angle_in,
                                    GIMP_PDB_END);
857 858 859 860 861 862 863 864

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    angle_out = return_vals[1].data.d_float;

  gimp_destroy_params (return_vals, nreturn_vals);

  return angle_out;
}