/**
 * gimp_rotate:
 * @drawable_ID: The affected drawable.
 * @interpolation: Whether to use interpolation.
 * @angle: The angle of rotation (radians).
 *
 * Deprecated: Use gimp_item_transform_rotate() instead.
 *
 * Returns: The rotated drawable.
 **/
gint32
gimp_rotate (gint32   drawable_ID,
             gboolean interpolation,
             gdouble  angle)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gint32 ret_drawable_ID = -1;

  return_vals = gimp_run_procedure ("gimp-rotate",
                                    &nreturn_vals,
                                    GIMP_PDB_DRAWABLE, drawable_ID,
                                    GIMP_PDB_INT32, interpolation,
                                    GIMP_PDB_FLOAT, angle,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    ret_drawable_ID = return_vals[1].data.d_drawable;

  gimp_destroy_params (return_vals, nreturn_vals);

  return ret_drawable_ID;
}
Пример #2
0
/**
 * gimp_vectors_stroke_get_length:
 * @vectors_ID: The vectors object.
 * @stroke_id: The stroke ID.
 * @precision: The precision used for the approximation.
 *
 * Measure the length of the given stroke.
 *
 * Measure the length of the given stroke.
 *
 * Returns: The length (in pixels) of the given stroke.
 *
 * Since: GIMP 2.4
 */
gdouble
gimp_vectors_stroke_get_length (gint32  vectors_ID,
                                gint    stroke_id,
                                gdouble precision)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gdouble length = 0.0;

  return_vals = gimp_run_procedure ("gimp-vectors-stroke-get-length",
                                    &nreturn_vals,
                                    GIMP_PDB_VECTORS, vectors_ID,
                                    GIMP_PDB_INT32, stroke_id,
                                    GIMP_PDB_FLOAT, precision,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return length;
}
Пример #3
0
/**
 * gimp_vectors_bezier_stroke_new_moveto:
 * @vectors_ID: The vectors object.
 * @x0: The x-coordinate of the moveto.
 * @y0: The y-coordinate of the moveto.
 *
 * Adds a bezier stroke with a single moveto to the vectors object.
 *
 * Adds a bezier stroke with a single moveto to the vectors object.
 *
 * Returns: The resulting stroke.
 *
 * Since: GIMP 2.4
 */
gint
gimp_vectors_bezier_stroke_new_moveto (gint32  vectors_ID,
                                       gdouble x0,
                                       gdouble y0)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gint stroke_id = 0;

  return_vals = gimp_run_procedure ("gimp-vectors-bezier-stroke-new-moveto",
                                    &nreturn_vals,
                                    GIMP_PDB_VECTORS, vectors_ID,
                                    GIMP_PDB_FLOAT, x0,
                                    GIMP_PDB_FLOAT, y0,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return stroke_id;
}
Пример #4
0
/**
 * gimp_channel_new_from_component:
 * @image_ID: The image to which to add the channel.
 * @component: The image component.
 * @name: The channel name.
 *
 * Create a new channel from a color component
 *
 * This procedure creates a new channel from a color component.
 * The new channel still needs to be added to the image, as this is not
 * automatic. Add the new channel with gimp_image_insert_channel().
 * Other attributes, such as channel visibility, should be set with
 * explicit procedure calls.
 *
 * Returns: The newly created channel.
 *
 * Since: 2.4
 **/
gint32
gimp_channel_new_from_component (gint32           image_ID,
                                 GimpChannelType  component,
                                 const gchar     *name)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gint32 channel_ID = -1;

  return_vals = gimp_run_procedure ("gimp-channel-new-from-component",
                                    &nreturn_vals,
                                    GIMP_PDB_IMAGE, image_ID,
                                    GIMP_PDB_INT32, component,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    channel_ID = return_vals[1].data.d_channel;

  gimp_destroy_params (return_vals, nreturn_vals);

  return channel_ID;
}
Пример #5
0
int
p_save_xcf(gint32 image_id, char *sav_name)
{
  GimpParam* l_params;
  gint   l_retvals;

    /* save current image as xcf file
     * xcf_save does operate on the complete image,
     * the drawable is ignored. (we can supply a dummy value)
     */
    l_params = gimp_run_procedure ("gimp_xcf_save",
			         &l_retvals,
			         GIMP_PDB_INT32,    GIMP_RUN_NONINTERACTIVE,
			         GIMP_PDB_IMAGE,    image_id,
			         GIMP_PDB_DRAWABLE, 0,
			         GIMP_PDB_STRING, sav_name,
			         GIMP_PDB_STRING, sav_name, /* raw name ? */
			         GIMP_PDB_END);

    if (l_params[0].data.d_status == FALSE) return(-1);
    
    return 0;
}
/**
 * gimp_perspective:
 * @drawable_ID: The affected drawable.
 * @interpolation: Whether to use interpolation.
 * @x0: The new x coordinate of upper-left corner of original bounding box.
 * @y0: The new y coordinate of upper-left corner of original bounding box.
 * @x1: The new x coordinate of upper-right corner of original bounding box.
 * @y1: The new y coordinate of upper-right corner of original bounding box.
 * @x2: The new x coordinate of lower-left corner of original bounding box.
 * @y2: The new y coordinate of lower-left corner of original bounding box.
 * @x3: The new x coordinate of lower-right corner of original bounding box.
 * @y3: The new y coordinate of lower-right corner of original bounding box.
 *
 * Deprecated: Use gimp_item_transform_perspective() instead.
 *
 * Returns: The newly mapped drawable.
 **/
gint32
gimp_perspective (gint32   drawable_ID,
                  gboolean interpolation,
                  gdouble  x0,
                  gdouble  y0,
                  gdouble  x1,
                  gdouble  y1,
                  gdouble  x2,
                  gdouble  y2,
                  gdouble  x3,
                  gdouble  y3)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gint32 ret_drawable_ID = -1;

  return_vals = gimp_run_procedure ("gimp-perspective",
                                    &nreturn_vals,
                                    GIMP_PDB_DRAWABLE, drawable_ID,
                                    GIMP_PDB_INT32, interpolation,
                                    GIMP_PDB_FLOAT, x0,
                                    GIMP_PDB_FLOAT, y0,
                                    GIMP_PDB_FLOAT, x1,
                                    GIMP_PDB_FLOAT, y1,
                                    GIMP_PDB_FLOAT, x2,
                                    GIMP_PDB_FLOAT, y2,
                                    GIMP_PDB_FLOAT, x3,
                                    GIMP_PDB_FLOAT, y3,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    ret_drawable_ID = return_vals[1].data.d_drawable;

  gimp_destroy_params (return_vals, nreturn_vals);

  return ret_drawable_ID;
}
Пример #7
0
/**
 * gimp_drawable_transform_flip:
 * @drawable_ID: The affected drawable.
 * @x0: horz. coord. of one end of axis.
 * @y0: vert. coord. of one end of axis.
 * @x1: horz. coord. of other end of axis.
 * @y1: vert. coord. of other end of axis.
 * @transform_direction: Direction of transformation.
 * @interpolation: Type of interpolation.
 * @supersample: This parameter is ignored, supersampling is performed based on the interpolation type.
 * @recursion_level: Maximum recursion level used for supersampling (3 is a nice value).
 * @clip_result: Whether to clip results.
 *
 * Deprecated: Use gimp_item_transform_flip() instead.
 *
 * Returns: The flipped drawable.
 *
 * Since: GIMP 2.2
 **/
gint32
gimp_drawable_transform_flip (gint32                 drawable_ID,
                              gdouble                x0,
                              gdouble                y0,
                              gdouble                x1,
                              gdouble                y1,
                              GimpTransformDirection transform_direction,
                              GimpInterpolationType  interpolation,
                              gboolean               supersample,
                              gint                   recursion_level,
                              gboolean               clip_result)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gint32 ret_drawable_ID = -1;

  return_vals = gimp_run_procedure ("gimp-drawable-transform-flip",
                                    &nreturn_vals,
                                    GIMP_PDB_DRAWABLE, drawable_ID,
                                    GIMP_PDB_FLOAT, x0,
                                    GIMP_PDB_FLOAT, y0,
                                    GIMP_PDB_FLOAT, x1,
                                    GIMP_PDB_FLOAT, y1,
                                    GIMP_PDB_INT32, transform_direction,
                                    GIMP_PDB_INT32, interpolation,
                                    GIMP_PDB_INT32, supersample,
                                    GIMP_PDB_INT32, recursion_level,
                                    GIMP_PDB_INT32, clip_result,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    ret_drawable_ID = return_vals[1].data.d_drawable;

  gimp_destroy_params (return_vals, nreturn_vals);

  return ret_drawable_ID;
}
Пример #8
0
/**
 * gimp_item_transform_matrix:
 * @item_ID: The affected item.
 * @coeff_0_0: coefficient (0,0) of the transformation matrix.
 * @coeff_0_1: coefficient (0,1) of the transformation matrix.
 * @coeff_0_2: coefficient (0,2) of the transformation matrix.
 * @coeff_1_0: coefficient (1,0) of the transformation matrix.
 * @coeff_1_1: coefficient (1,1) of the transformation matrix.
 * @coeff_1_2: coefficient (1,2) of the transformation matrix.
 * @coeff_2_0: coefficient (2,0) of the transformation matrix.
 * @coeff_2_1: coefficient (2,1) of the transformation matrix.
 * @coeff_2_2: coefficient (2,2) of the transformation matrix.
 *
 * Transform the specified item in 2d.
 *
 * This procedure transforms the specified item. If a selection exists
 * and the item is a drawable, the portion of the drawable which lies
 * under the selection is cut from the drawable and made into a
 * floating selection which is then transformed. The transformation is
 * done by assembling a 3x3 matrix from the coefficients passed. The
 * return value is the ID of the transformed item. If there was no
 * selection or the item is not a drawable, this will be equal to the
 * item ID supplied as input. Otherwise, this will be the newly created
 * and transformed drawable.
 * This procedure is affected by the following context setters:
 * gimp_context_set_interpolation(),
 * gimp_context_set_transform_direction(),
 * gimp_context_set_transform_resize().
 *
 * Returns: The transformed item.
 *
 * Since: GIMP 2.8
 **/
gint32
gimp_item_transform_matrix (gint32  item_ID,
                            gdouble coeff_0_0,
                            gdouble coeff_0_1,
                            gdouble coeff_0_2,
                            gdouble coeff_1_0,
                            gdouble coeff_1_1,
                            gdouble coeff_1_2,
                            gdouble coeff_2_0,
                            gdouble coeff_2_1,
                            gdouble coeff_2_2)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gint32 ret_item_ID = -1;

  return_vals = gimp_run_procedure ("gimp-item-transform-matrix",
                                    &nreturn_vals,
                                    GIMP_PDB_ITEM, item_ID,
                                    GIMP_PDB_FLOAT, coeff_0_0,
                                    GIMP_PDB_FLOAT, coeff_0_1,
                                    GIMP_PDB_FLOAT, coeff_0_2,
                                    GIMP_PDB_FLOAT, coeff_1_0,
                                    GIMP_PDB_FLOAT, coeff_1_1,
                                    GIMP_PDB_FLOAT, coeff_1_2,
                                    GIMP_PDB_FLOAT, coeff_2_0,
                                    GIMP_PDB_FLOAT, coeff_2_1,
                                    GIMP_PDB_FLOAT, coeff_2_2,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    ret_item_ID = return_vals[1].data.d_item;

  gimp_destroy_params (return_vals, nreturn_vals);

  return ret_item_ID;
}
Пример #9
0
/**
 * gimp_drawable_transform_rotate:
 * @drawable_ID: The affected drawable.
 * @angle: The angle of rotation (radians).
 * @auto_center: Whether to automatically rotate around the selection center.
 * @center_x: The hor. coordinate of the center of rotation.
 * @center_y: The vert. coordinate of the center of rotation.
 * @transform_direction: Direction of transformation.
 * @interpolation: Type of interpolation.
 * @supersample: This parameter is ignored, supersampling is performed based on the interpolation type.
 * @recursion_level: Maximum recursion level used for supersampling (3 is a nice value).
 * @clip_result: How to clip results.
 *
 * Deprecated: Use gimp_item_transform_rotate() instead.
 *
 * Returns: The rotated drawable.
 *
 * Since: GIMP 2.2
 **/
gint32
gimp_drawable_transform_rotate (gint32                 drawable_ID,
                                gdouble                angle,
                                gboolean               auto_center,
                                gint                   center_x,
                                gint                   center_y,
                                GimpTransformDirection transform_direction,
                                GimpInterpolationType  interpolation,
                                gboolean               supersample,
                                gint                   recursion_level,
                                GimpTransformResize    clip_result)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gint32 ret_drawable_ID = -1;

  return_vals = gimp_run_procedure ("gimp-drawable-transform-rotate",
                                    &nreturn_vals,
                                    GIMP_PDB_DRAWABLE, drawable_ID,
                                    GIMP_PDB_FLOAT, angle,
                                    GIMP_PDB_INT32, auto_center,
                                    GIMP_PDB_INT32, center_x,
                                    GIMP_PDB_INT32, center_y,
                                    GIMP_PDB_INT32, transform_direction,
                                    GIMP_PDB_INT32, interpolation,
                                    GIMP_PDB_INT32, supersample,
                                    GIMP_PDB_INT32, recursion_level,
                                    GIMP_PDB_INT32, clip_result,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    ret_drawable_ID = return_vals[1].data.d_drawable;

  gimp_destroy_params (return_vals, nreturn_vals);

  return ret_drawable_ID;
}
Пример #10
0
/**
 * gimp_drawable_transform_2d_default:
 * @drawable_ID: The affected drawable.
 * @source_x: X coordinate of the transformation center.
 * @source_y: Y coordinate of the transformation center.
 * @scale_x: Amount to scale in x direction.
 * @scale_y: Amount to scale in y direction.
 * @angle: The angle of rotation (radians).
 * @dest_x: X coordinate of where the center goes.
 * @dest_y: Y coordinate of where the center goes.
 * @interpolate: Whether to use interpolation and supersampling.
 * @clip_result: How to clip results.
 *
 * Deprecated: Use gimp_item_transform_2d() instead.
 *
 * Returns: The transformed drawable.
 *
 * Since: GIMP 2.2
 **/
gint32
gimp_drawable_transform_2d_default (gint32              drawable_ID,
                                    gdouble             source_x,
                                    gdouble             source_y,
                                    gdouble             scale_x,
                                    gdouble             scale_y,
                                    gdouble             angle,
                                    gdouble             dest_x,
                                    gdouble             dest_y,
                                    gboolean            interpolate,
                                    GimpTransformResize clip_result)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gint32 ret_drawable_ID = -1;

  return_vals = gimp_run_procedure ("gimp-drawable-transform-2d-default",
                                    &nreturn_vals,
                                    GIMP_PDB_DRAWABLE, drawable_ID,
                                    GIMP_PDB_FLOAT, source_x,
                                    GIMP_PDB_FLOAT, source_y,
                                    GIMP_PDB_FLOAT, scale_x,
                                    GIMP_PDB_FLOAT, scale_y,
                                    GIMP_PDB_FLOAT, angle,
                                    GIMP_PDB_FLOAT, dest_x,
                                    GIMP_PDB_FLOAT, dest_y,
                                    GIMP_PDB_INT32, interpolate,
                                    GIMP_PDB_INT32, clip_result,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    ret_drawable_ID = return_vals[1].data.d_drawable;

  gimp_destroy_params (return_vals, nreturn_vals);

  return ret_drawable_ID;
}
Пример #11
0
/**
 * gimp_text_fontname:
 * @image_ID: The image.
 * @drawable_ID: The affected drawable: (-1 for a new text layer).
 * @x: The x coordinate for the left of the text bounding box.
 * @y: The y coordinate for the top of the text bounding box.
 * @text: The text to generate (in UTF-8 encoding).
 * @border: The size of the border.
 * @antialias: Antialiasing.
 * @size: The size of text in either pixels or points.
 * @size_type: The units of specified size.
 * @fontname: The name of the font.
 *
 * Add text at the specified location as a floating selection or a new
 * layer.
 *
 * This tool requires a fontname matching an installed PangoFT2 font.
 * You can specify the fontsize in units of pixels or points, and the
 * appropriate metric is specified using the size_type argument. The x
 * and y parameters together control the placement of the new text by
 * specifying the upper left corner of the text bounding box. If the
 * specified drawable parameter is valid, the text will be created as a
 * floating selection attached to the drawable. If the drawable
 * parameter is not valid (-1), the text will appear as a new layer.
 * Finally, a border can be specified around the final rendered text.
 * The border is measured in pixels. Parameter size-type is not used
 * and is currently ignored. If you need to display a font in points,
 * divide the size in points by 72.0 and multiply it by the image's
 * vertical resolution.
 *
 * Returns: The new text layer or -1 if no layer was created.
 **/
gint32
gimp_text_fontname (gint32        image_ID,
                    gint32        drawable_ID,
                    gdouble       x,
                    gdouble       y,
                    const gchar  *text,
                    gint          border,
                    gboolean      antialias,
                    gdouble       size,
                    GimpSizeType  size_type,
                    const gchar  *fontname)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gint32 text_layer_ID = -1;

  return_vals = gimp_run_procedure ("gimp-text-fontname",
                                    &nreturn_vals,
                                    GIMP_PDB_IMAGE, image_ID,
                                    GIMP_PDB_DRAWABLE, drawable_ID,
                                    GIMP_PDB_FLOAT, x,
                                    GIMP_PDB_FLOAT, y,
                                    GIMP_PDB_STRING, text,
                                    GIMP_PDB_INT32, border,
                                    GIMP_PDB_INT32, antialias,
                                    GIMP_PDB_FLOAT, size,
                                    GIMP_PDB_INT32, size_type,
                                    GIMP_PDB_STRING, fontname,
                                    GIMP_PDB_END);

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    text_layer_ID = return_vals[1].data.d_layer;

  gimp_destroy_params (return_vals, nreturn_vals);

  return text_layer_ID;
}
Пример #12
0
/**
 * gimp_vectors_stroke_flip:
 * @vectors_ID: The vectors object.
 * @stroke_id: The stroke ID.
 * @flip_type: Flip orientation, either vertical or horizontal.
 * @axis: axis coordinate about which to flip, in pixels.
 *
 * flips the given stroke.
 *
 * Rotates the given stroke around given center by angle (in degrees).
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.4
 **/
gboolean
gimp_vectors_stroke_flip (gint32              vectors_ID,
                          gint                stroke_id,
                          GimpOrientationType flip_type,
                          gdouble             axis)
{
    GimpParam *return_vals;
    gint nreturn_vals;
    gboolean success = TRUE;

    return_vals = gimp_run_procedure ("gimp-vectors-stroke-flip",
                                      &nreturn_vals,
                                      GIMP_PDB_VECTORS, vectors_ID,
                                      GIMP_PDB_INT32, stroke_id,
                                      GIMP_PDB_INT32, flip_type,
                                      GIMP_PDB_FLOAT, axis,
                                      GIMP_PDB_END);

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

    gimp_destroy_params (return_vals, nreturn_vals);

    return success;
}
Пример #13
0
/**
 * gimp_vectors_stroke_scale:
 * @vectors_ID: The vectors object.
 * @stroke_id: The stroke ID.
 * @scale_x: Scale factor in x direction.
 * @scale_y: Scale factor in y direction.
 *
 * scales the given stroke.
 *
 * Scale the given stroke.
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.4
 **/
gboolean
gimp_vectors_stroke_scale (gint32  vectors_ID,
                           gint    stroke_id,
                           gdouble scale_x,
                           gdouble scale_y)
{
    GimpParam *return_vals;
    gint nreturn_vals;
    gboolean success = TRUE;

    return_vals = gimp_run_procedure ("gimp-vectors-stroke-scale",
                                      &nreturn_vals,
                                      GIMP_PDB_VECTORS, vectors_ID,
                                      GIMP_PDB_INT32, stroke_id,
                                      GIMP_PDB_FLOAT, scale_x,
                                      GIMP_PDB_FLOAT, scale_y,
                                      GIMP_PDB_END);

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

    gimp_destroy_params (return_vals, nreturn_vals);

    return success;
}
Пример #14
0
/**
 * gimp_image_select_color:
 * @image_ID: The affected image.
 * @operation: The selection operation.
 * @drawable_ID: The affected drawable.
 * @color: The color to select.
 *
 * Create a selection by selecting all pixels (in the specified
 * drawable) with the same (or similar) color to that specified.
 *
 * This tool creates a selection over the specified image. A by-color
 * selection is determined by the supplied color under the constraints
 * of the current context settings. Essentially, all pixels (in the
 * drawable) that have color sufficiently close to the specified color
 * (as determined by the threshold and criterion context values) are
 * included in the selection. To select transparent regions, the color
 * specified must also have minimum alpha. This procedure is affected
 * by the following context setters: gimp_context_set_antialias(),
 * gimp_context_set_feather(), gimp_context_set_feather_radius(),
 * gimp_context_set_sample_merged(),
 * gimp_context_set_sample_criterion(),
 * gimp_context_set_sample_threshold(),
 * gimp_context_set_sample_transparent(). In the case of a merged
 * sampling, the supplied drawable is ignored.
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.8
 **/
gboolean
gimp_image_select_color (gint32          image_ID,
                         GimpChannelOps  operation,
                         gint32          drawable_ID,
                         const GimpRGB  *color)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-image-select-color",
                                    &nreturn_vals,
                                    GIMP_PDB_IMAGE, image_ID,
                                    GIMP_PDB_INT32, operation,
                                    GIMP_PDB_DRAWABLE, drawable_ID,
                                    GIMP_PDB_COLOR, color,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}
Пример #15
0
/**
 * gimp_image_select_polygon:
 * @image_ID: The image.
 * @operation: The selection operation.
 * @num_segs: Number of points (count 1 coordinate as two points).
 * @segs: Array of points: { p1.x, p1.y, p2.x, p2.y, ..., pn.x, pn.y}.
 *
 * Create a polygonal selection over the specified image.
 *
 * This tool creates a polygonal selection over the specified image.
 * The polygonal region can be either added to, subtracted from, or
 * replace the contents of the previous selection mask. The polygon is
 * specified through an array of floating point numbers and its length.
 * The length of array must be 2n, where n is the number of points.
 * Each point is defined by 2 floating point values which correspond to
 * the x and y coordinates. If the final point does not connect to the
 * starting point, a connecting segment is automatically added. This
 * procedure is affected by the following context setters:
 * gimp_context_set_antialias(), gimp_context_set_feather(),
 * gimp_context_set_feather_radius().
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.8
 **/
gboolean
gimp_image_select_polygon (gint32          image_ID,
                           GimpChannelOps  operation,
                           gint            num_segs,
                           const gdouble  *segs)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-image-select-polygon",
                                    &nreturn_vals,
                                    GIMP_PDB_IMAGE, image_ID,
                                    GIMP_PDB_INT32, operation,
                                    GIMP_PDB_INT32, num_segs,
                                    GIMP_PDB_FLOATARRAY, segs,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}
Пример #16
0
/**
 * gimp_image_convert_color_profile_from_file:
 * @image_ID: The image.
 * @uri: The URI of the file containing the new color profile.
 * @intent: Rendering intent.
 * @bpc: Black point compensation.
 *
 * Convert the image's layers to a color profile
 *
 * This procedure converts from the image's color profile (or the
 * default RGB or grayscale profile if none is set) to an ICC profile
 * specified by 'uri'. Only RGB and grayscale color profiles are
 * accepted, according to the image's type.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.10
 **/
gboolean
gimp_image_convert_color_profile_from_file (gint32                    image_ID,
                                            const gchar              *uri,
                                            GimpColorRenderingIntent  intent,
                                            gboolean                  bpc)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-image-convert-color-profile-from-file",
                                    &nreturn_vals,
                                    GIMP_PDB_IMAGE, image_ID,
                                    GIMP_PDB_STRING, uri,
                                    GIMP_PDB_INT32, intent,
                                    GIMP_PDB_INT32, bpc,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}
Пример #17
0
static GimpPDBStatusType
page_setup (gint32 image_ID)
{
  GtkPrintOperation  *operation;
  GimpParam          *return_vals;
  gchar              *name;
  gint                n_return_vals;

  gimp_ui_init (PLUG_IN_BINARY, FALSE);

  operation = gtk_print_operation_new ();

  print_page_setup_load (operation, image_ID);
  print_page_setup_dialog (operation);
  print_page_setup_save (operation, image_ID);

  g_object_unref (operation);

  /* now notify a running print procedure about this change */
  name = print_temp_proc_name (image_ID);

  /* we don't want the core to show an error message if the
   * temporary procedure does not exist
   */
  gimp_plugin_set_pdb_error_handler (GIMP_PDB_ERROR_HANDLER_PLUGIN);

  return_vals = gimp_run_procedure (name,
                                    &n_return_vals,
                                    GIMP_PDB_IMAGE, image_ID,
                                    GIMP_PDB_END);
  gimp_destroy_params (return_vals, n_return_vals);

  g_free (name);

  return GIMP_PDB_SUCCESS;
}
Пример #18
0
/**
 * gimp_gradient_segment_range_set_blending_function:
 * @name: The gradient name.
 * @start_segment: The index of the first segment to operate on.
 * @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
 * @blending_function: The blending function.
 *
 * Change the blending function of a segments range
 *
 * This function changes the blending function of a segment range to
 * the specified blending function.
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.2
 **/
gboolean
gimp_gradient_segment_range_set_blending_function (const gchar             *name,
                                                   gint                     start_segment,
                                                   gint                     end_segment,
                                                   GimpGradientSegmentType  blending_function)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-gradient-segment-range-set-blending-function",
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_INT32, start_segment,
                                    GIMP_PDB_INT32, end_segment,
                                    GIMP_PDB_INT32, blending_function,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}
Пример #19
0
/**
 * gimp_curves_explicit:
 * @drawable_ID: The drawable.
 * @channel: The channel to modify.
 * @num_bytes: The number of bytes in the new curve (always 256).
 * @curve: The explicit curve.
 *
 * Deprecated: Use gimp_drawable_curves_explicit() instead.
 *
 * Returns: TRUE on success.
 **/
gboolean
gimp_curves_explicit (gint32                drawable_ID,
                      GimpHistogramChannel  channel,
                      gint                  num_bytes,
                      const guint8         *curve)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-curves-explicit",
                                    &nreturn_vals,
                                    GIMP_PDB_DRAWABLE, drawable_ID,
                                    GIMP_PDB_INT32, channel,
                                    GIMP_PDB_INT32, num_bytes,
                                    GIMP_PDB_INT8ARRAY, curve,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}
Пример #20
0
/**
 * gimp_palette_get_info:
 * @name: The palette name.
 * @num_colors: The number of colors in the palette.
 *
 * Retrieve information about the specified palette.
 *
 * This procedure retrieves information about the specified palette.
 * This includes the name, and the number of colors.
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.2
 **/
gboolean
gimp_palette_get_info (const gchar *name,
                       gint        *num_colors)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-palette-get-info",
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_END);

  *num_colors = 0;

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

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}
Пример #21
0
/**
 * gimp_image_scale_full:
 * @image_ID: The image.
 * @new_width: New image width.
 * @new_height: New image height.
 * @interpolation: Type of interpolation.
 *
 * Deprecated: Use gimp_image_scale() instead.
 *
 * Returns: TRUE on success.
 *
 * Since: 2.6
 **/
gboolean
gimp_image_scale_full (gint32                image_ID,
                       gint                  new_width,
                       gint                  new_height,
                       GimpInterpolationType interpolation)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-image-scale-full",
                                    &nreturn_vals,
                                    GIMP_PDB_IMAGE, image_ID,
                                    GIMP_PDB_INT32, new_width,
                                    GIMP_PDB_INT32, new_height,
                                    GIMP_PDB_INT32, interpolation,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}
Пример #22
0
/**
 * gimp_gradient_segment_range_set_coloring_type:
 * @name: The gradient name.
 * @start_segment: The index of the first segment to operate on.
 * @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
 * @coloring_type: The coloring type.
 *
 * Change the coloring type of a segments range
 *
 * This function changes the coloring type of a segment range to the
 * specified coloring type.
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.2
 **/
gboolean
gimp_gradient_segment_range_set_coloring_type (const gchar              *name,
                                               gint                      start_segment,
                                               gint                      end_segment,
                                               GimpGradientSegmentColor  coloring_type)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-gradient-segment-range-set-coloring-type",
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_INT32, start_segment,
                                    GIMP_PDB_INT32, end_segment,
                                    GIMP_PDB_INT32, coloring_type,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}
Пример #23
0
/**
 * gimp_vectors_bezier_stroke_lineto:
 * @vectors_ID: The vectors object.
 * @stroke_id: The stroke ID.
 * @x0: The x-coordinate of the lineto.
 * @y0: The y-coordinate of the lineto.
 *
 * Extends a bezier stroke with a lineto.
 *
 * Extends a bezier stroke with a lineto.
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.4
 **/
gboolean
gimp_vectors_bezier_stroke_lineto (gint32  vectors_ID,
                                   gint    stroke_id,
                                   gdouble x0,
                                   gdouble y0)
{
    GimpParam *return_vals;
    gint nreturn_vals;
    gboolean success = TRUE;

    return_vals = gimp_run_procedure ("gimp-vectors-bezier-stroke-lineto",
                                      &nreturn_vals,
                                      GIMP_PDB_VECTORS, vectors_ID,
                                      GIMP_PDB_INT32, stroke_id,
                                      GIMP_PDB_FLOAT, x0,
                                      GIMP_PDB_FLOAT, y0,
                                      GIMP_PDB_END);

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

    gimp_destroy_params (return_vals, nreturn_vals);

    return success;
}
Пример #24
0
/**
 * gimp_gradient_get_uniform_samples:
 * @name: The gradient name.
 * @num_samples: The number of samples to take.
 * @reverse: Use the reverse gradient.
 * @num_color_samples: Length of the color_samples array (4 * num_samples).
 * @color_samples: Color samples: { R1, G1, B1, A1, ..., Rn, Gn, Bn, An }.
 *
 * Sample the specified in uniform parts.
 *
 * This procedure samples the active gradient in the specified number
 * of uniform parts. It returns a list of floating-point values which
 * correspond to the RGBA values for each sample. The minimum number of
 * samples to take is 2, in which case the returned colors will
 * correspond to the { 0.0, 1.0 } positions in the gradient. For
 * example, if the number of samples is 3, the procedure will return
 * the colors at positions { 0.0, 0.5, 1.0 }.
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.2
 **/
gboolean
gimp_gradient_get_uniform_samples (const gchar  *name,
                                   gint          num_samples,
                                   gboolean      reverse,
                                   gint         *num_color_samples,
                                   gdouble     **color_samples)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-gradient-get-uniform-samples",
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_INT32, num_samples,
                                    GIMP_PDB_INT32, reverse,
                                    GIMP_PDB_END);

  *num_color_samples = 0;
  *color_samples = NULL;

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

  if (success)
    {
      *num_color_samples = return_vals[1].data.d_int32;
      *color_samples = g_new (gdouble, *num_color_samples);
      memcpy (*color_samples,
              return_vals[2].data.d_floatarray,
              *num_color_samples * sizeof (gdouble));
    }

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}
Пример #25
0
/**
 * gimp_layer_scale:
 * @layer_ID: The layer.
 * @new_width: New layer width.
 * @new_height: New layer height.
 * @local_origin: Use a local origin (as opposed to the image origin).
 *
 * Scale the layer using the default interpolation method.
 *
 * This procedure scales the layer so that its new width and height are
 * equal to the supplied parameters. The 'local-origin' parameter
 * specifies whether to scale from the center of the layer, or from the
 * image origin. This operation only works if the layer has been added
 * to an image. The interpolation method used can be set with
 * gimp_context_set_interpolation().
 *
 * Returns: TRUE on success.
 **/
gboolean
gimp_layer_scale (gint32   layer_ID,
                  gint     new_width,
                  gint     new_height,
                  gboolean local_origin)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-layer-scale",
                                    &nreturn_vals,
                                    GIMP_PDB_LAYER, layer_ID,
                                    GIMP_PDB_INT32, new_width,
                                    GIMP_PDB_INT32, new_height,
                                    GIMP_PDB_INT32, local_origin,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}
Пример #26
0
/**
 * gimp_gradient_segment_set_right_color:
 * @name: The gradient name.
 * @segment: The index of the segment within the gradient.
 * @color: The color to set.
 * @opacity: The opacity to set for the endpoint.
 *
 * Sets the right endpoint color of the specified segment
 *
 * This procedure sets the right endpoint color of the specified
 * segment of the specified gradient.
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.2
 **/
gboolean
gimp_gradient_segment_set_right_color (const gchar   *name,
                                       gint           segment,
                                       const GimpRGB *color,
                                       gdouble        opacity)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-gradient-segment-set-right-color",
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_INT32, segment,
                                    GIMP_PDB_COLOR, color,
                                    GIMP_PDB_FLOAT, opacity,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}
Пример #27
0
/**
 * gimp_palette_entry_get_color:
 * @name: The palette name.
 * @entry_num: The entry to retrieve.
 * @color: The color requested.
 *
 * Gets the specified palette entry from the specified palette.
 *
 * This procedure retrieves the color of the zero-based entry specified
 * for the specified palette. It returns an error if the entry does not
 * exist.
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.2
 **/
gboolean
gimp_palette_entry_get_color (const gchar *name,
                              gint         entry_num,
                              GimpRGB     *color)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-palette-entry-get-color",
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_INT32, entry_num,
                                    GIMP_PDB_END);

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

  if (success)
    *color = return_vals[1].data.d_color;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}
Пример #28
0
/**
 * gimp_gradient_segment_range_split_uniform:
 * @name: The gradient name.
 * @start_segment: The index of the first segment to operate on.
 * @end_segment: The index of the last segment to operate on. If negative, the selection will extend to the end of the string.
 * @split_parts: The number of uniform divisions to split each segment to.
 *
 * Splits each segment in the segment range uniformly
 *
 * This function splits each segment in the segment range uniformly
 * according to the number of times specified by the parameter.
 *
 * Returns: TRUE on success.
 *
 * Since: GIMP 2.2
 **/
gboolean
gimp_gradient_segment_range_split_uniform (const gchar *name,
                                           gint         start_segment,
                                           gint         end_segment,
                                           gint         split_parts)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-gradient-segment-range-split-uniform",
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, name,
                                    GIMP_PDB_INT32, start_segment,
                                    GIMP_PDB_INT32, end_segment,
                                    GIMP_PDB_INT32, split_parts,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}
Пример #29
0
/**
 * gimp_colorize:
 * @drawable_ID: The drawable.
 * @hue: Hue in degrees.
 * @saturation: Saturation in percent.
 * @lightness: Lightness in percent.
 *
 * Deprecated: Use gimp_drawable_colorize_hsl() instead.
 *
 * Returns: TRUE on success.
 **/
gboolean
gimp_colorize (gint32  drawable_ID,
               gdouble hue,
               gdouble saturation,
               gdouble lightness)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-colorize",
                                    &nreturn_vals,
                                    GIMP_PDB_DRAWABLE, drawable_ID,
                                    GIMP_PDB_FLOAT, hue,
                                    GIMP_PDB_FLOAT, saturation,
                                    GIMP_PDB_FLOAT, lightness,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}
Пример #30
0
/**
 * gimp_register_magic_load_handler:
 * @procedure_name: The name of the procedure to be used for loading.
 * @extensions: comma separated list of extensions this handler can load (i.e. \"jpg,jpeg\").
 * @prefixes: comma separated list of prefixes this handler can load (i.e. \"http:,ftp:\").
 * @magics: comma separated list of magic file information this handler can load (i.e. \"0,string,GIF\").
 *
 * Registers a file load handler procedure.
 *
 * Registers a procedural database procedure to be called to load files
 * of a particular file format using magic file information.
 *
 * Returns: TRUE on success.
 **/
gboolean
gimp_register_magic_load_handler (const gchar *procedure_name,
                                  const gchar *extensions,
                                  const gchar *prefixes,
                                  const gchar *magics)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

  return_vals = gimp_run_procedure ("gimp-register-magic-load-handler",
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, procedure_name,
                                    GIMP_PDB_STRING, extensions,
                                    GIMP_PDB_STRING, prefixes,
                                    GIMP_PDB_STRING, magics,
                                    GIMP_PDB_END);

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

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}