channel_ops_cmds.c 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. /* The GIMP -- an image manipulation program
  2. * Copyright (C) 1995-2000 Spencer Kimball and Peter Mattis
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17. */
  18. /* NOTE: This file is autogenerated by pdbgen.pl. */
  19. #include "config.h"
  20. #include "procedural_db.h"
  21. #include "channel_ops.h"
  22. #include "drawable.h"
  23. #include "gimage.h"
  24. static ProcRecord channel_ops_offset_proc;
  25. static ProcRecord channel_ops_duplicate_proc;
  26. void
  27. register_channel_ops_procs (void)
  28. {
  29. procedural_db_register (&channel_ops_offset_proc);
  30. procedural_db_register (&channel_ops_duplicate_proc);
  31. }
  32. static Argument *
  33. channel_ops_offset_invoker (Argument *args)
  34. {
  35. gboolean success = TRUE;
  36. GimpDrawable *drawable;
  37. gboolean wrap_around;
  38. gint32 fill_type;
  39. gint32 offset_x;
  40. gint32 offset_y;
  41. GimpImage *gimage;
  42. drawable = gimp_drawable_get_ID (args[0].value.pdb_int);
  43. if (drawable == NULL)
  44. success = FALSE;
  45. wrap_around = args[1].value.pdb_int ? TRUE : FALSE;
  46. fill_type = args[2].value.pdb_int;
  47. if (fill_type < OFFSET_BACKGROUND || fill_type > OFFSET_TRANSPARENT)
  48. success = FALSE;
  49. offset_x = args[3].value.pdb_int;
  50. offset_y = args[4].value.pdb_int;
  51. if (success)
  52. {
  53. gimage = drawable_gimage (GIMP_DRAWABLE (drawable));
  54. offset (gimage, drawable, wrap_around, fill_type, offset_x, offset_y);
  55. }
  56. return procedural_db_return_args (&channel_ops_offset_proc, success);
  57. }
  58. static ProcArg channel_ops_offset_inargs[] =
  59. {
  60. {
  61. PDB_DRAWABLE,
  62. "drawable",
  63. "The drawable to offset"
  64. },
  65. {
  66. PDB_INT32,
  67. "wrap_around",
  68. "wrap image around or fill vacated regions"
  69. },
  70. {
  71. PDB_INT32,
  72. "fill_type",
  73. "fill vacated regions of drawable with background or transparent: OFFSET_BACKGROUND (0) or OFFSET_TRANSPARENT (1)"
  74. },
  75. {
  76. PDB_INT32,
  77. "offset_x",
  78. "offset by this amount in X direction"
  79. },
  80. {
  81. PDB_INT32,
  82. "offset_y",
  83. "offset by this amount in Y direction"
  84. }
  85. };
  86. static ProcRecord channel_ops_offset_proc =
  87. {
  88. "gimp_channel_ops_offset",
  89. "Offset the drawable by the specified amounts in the X and Y directions",
  90. "This procedure offsets the specified drawable by the amounts specified by 'offset_x' and 'offset_y'. If 'wrap_around' is set to TRUE, then portions of the drawable which are offset out of bounds are wrapped around. Alternatively, the undefined regions of the drawable can be filled with transparency or the background color, as specified by the 'fill_type' parameter.",
  91. "Spencer Kimball & Peter Mattis",
  92. "Spencer Kimball & Peter Mattis",
  93. "1997",
  94. PDB_INTERNAL,
  95. 5,
  96. channel_ops_offset_inargs,
  97. 0,
  98. NULL,
  99. { { channel_ops_offset_invoker } }
  100. };
  101. static Argument *
  102. channel_ops_duplicate_invoker (Argument *args)
  103. {
  104. gboolean success = TRUE;
  105. Argument *return_args;
  106. GimpImage *gimage;
  107. GimpImage *new_gimage = NULL;
  108. gimage = pdb_id_to_image (args[0].value.pdb_int);
  109. if (gimage == NULL)
  110. success = FALSE;
  111. if (success)
  112. success = (new_gimage = duplicate (gimage)) != NULL;
  113. return_args = procedural_db_return_args (&channel_ops_duplicate_proc, success);
  114. if (success)
  115. return_args[1].value.pdb_int = pdb_image_to_id (new_gimage);
  116. return return_args;
  117. }
  118. static ProcArg channel_ops_duplicate_inargs[] =
  119. {
  120. {
  121. PDB_IMAGE,
  122. "image",
  123. "The image"
  124. }
  125. };
  126. static ProcArg channel_ops_duplicate_outargs[] =
  127. {
  128. {
  129. PDB_IMAGE,
  130. "new_image",
  131. "The new, duplicated image"
  132. }
  133. };
  134. static ProcRecord channel_ops_duplicate_proc =
  135. {
  136. "gimp_channel_ops_duplicate",
  137. "Duplicate the specified image",
  138. "This procedure duplicates the specified image, copying all layers, channels, and image information.",
  139. "Spencer Kimball & Peter Mattis",
  140. "Spencer Kimball & Peter Mattis",
  141. "1997",
  142. PDB_INTERNAL,
  143. 1,
  144. channel_ops_duplicate_inargs,
  145. 1,
  146. channel_ops_duplicate_outargs,
  147. { { channel_ops_duplicate_invoker } }
  148. };