2015-05-31 05:55:58 +08:00
|
|
|
/* LIBGIMP - The GIMP Library
|
|
|
|
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
|
|
|
|
*
|
|
|
|
* gimpimagetransform_pdb.c
|
|
|
|
*
|
|
|
|
* This library is free software: you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 3 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* License along with this library. If not, see
|
2018-07-12 05:27:07 +08:00
|
|
|
* <https://www.gnu.org/licenses/>.
|
2015-05-31 05:55:58 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* NOTE: This file is auto-generated by pdbgen.pl */
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2022-03-28 21:13:17 +08:00
|
|
|
#include "stamp-pdbgen.h"
|
|
|
|
|
2015-05-31 05:55:58 +08:00
|
|
|
#include "gimp.h"
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-31 16:04:43 +08:00
|
|
|
* SECTION: gimpimagetransform
|
2015-05-31 05:55:58 +08:00
|
|
|
* @title: gimpimagetransform
|
2016-06-26 04:54:10 +08:00
|
|
|
* @short_description: Transformations on images.
|
2015-05-31 05:55:58 +08:00
|
|
|
*
|
|
|
|
* Operations to scale, resize, crop, flip and rotate images.
|
|
|
|
**/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_image_resize:
|
2019-08-11 20:20:05 +08:00
|
|
|
* @image: The image.
|
2015-05-31 05:55:58 +08:00
|
|
|
* @new_width: New image width.
|
|
|
|
* @new_height: New image height.
|
|
|
|
* @offx: x offset between upper left corner of old and new images: (new - old).
|
|
|
|
* @offy: y offset between upper left corner of old and new images: (new - old).
|
|
|
|
*
|
|
|
|
* Resize the image to the specified extents.
|
|
|
|
*
|
|
|
|
* This procedure resizes the image so that it's new width and height
|
|
|
|
* are equal to the supplied parameters. Offsets are also provided
|
|
|
|
* which describe the position of the previous image's content. All
|
|
|
|
* channels within the image are resized according to the specified
|
|
|
|
* parameters; this includes the image selection mask. All layers
|
|
|
|
* within the image are repositioned according to the specified
|
|
|
|
* offsets.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
**/
|
|
|
|
gboolean
|
2019-08-11 20:20:05 +08:00
|
|
|
gimp_image_resize (GimpImage *image,
|
|
|
|
gint new_width,
|
|
|
|
gint new_height,
|
|
|
|
gint offx,
|
|
|
|
gint offy)
|
2015-05-31 05:55:58 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2015-05-31 05:55:58 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_IMAGE, image,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, new_width,
|
|
|
|
G_TYPE_INT, new_height,
|
|
|
|
G_TYPE_INT, offx,
|
|
|
|
G_TYPE_INT, offy,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
2015-05-31 05:55:58 +08:00
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-image-resize",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2015-05-31 05:55:58 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-07-30 16:51:16 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2015-05-31 05:55:58 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_image_resize_to_layers:
|
2019-08-11 20:20:05 +08:00
|
|
|
* @image: The image.
|
2015-05-31 05:55:58 +08:00
|
|
|
*
|
|
|
|
* Resize the image to fit all layers.
|
|
|
|
*
|
|
|
|
* This procedure resizes the image to the bounding box of all layers
|
|
|
|
* of the image. All channels within the image are resized to the new
|
|
|
|
* size; this includes the image selection mask. All layers within the
|
|
|
|
* image are repositioned to the new image area.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2015-05-31 05:55:58 +08:00
|
|
|
**/
|
|
|
|
gboolean
|
2019-08-11 20:20:05 +08:00
|
|
|
gimp_image_resize_to_layers (GimpImage *image)
|
2015-05-31 05:55:58 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2015-05-31 05:55:58 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_IMAGE, image,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-image-resize-to-layers",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2015-05-31 05:55:58 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2015-05-31 05:55:58 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2015-05-31 05:55:58 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_image_scale:
|
2019-08-11 20:20:05 +08:00
|
|
|
* @image: The image.
|
2015-05-31 05:55:58 +08:00
|
|
|
* @new_width: New image width.
|
|
|
|
* @new_height: New image height.
|
|
|
|
*
|
|
|
|
* Scale the image using the default interpolation method.
|
|
|
|
*
|
|
|
|
* This procedure scales the image so that its new width and height are
|
|
|
|
* equal to the supplied parameters. All layers and channels within the
|
|
|
|
* image are scaled according to the specified parameters; this
|
|
|
|
* includes the image selection mask. The interpolation method used can
|
|
|
|
* be set with gimp_context_set_interpolation().
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
**/
|
|
|
|
gboolean
|
2019-08-11 20:20:05 +08:00
|
|
|
gimp_image_scale (GimpImage *image,
|
|
|
|
gint new_width,
|
|
|
|
gint new_height)
|
2015-05-31 05:55:58 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2015-05-31 05:55:58 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_IMAGE, image,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, new_width,
|
|
|
|
G_TYPE_INT, new_height,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-image-scale",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2015-05-31 05:55:58 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2015-05-31 05:55:58 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2015-05-31 05:55:58 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_image_crop:
|
2019-08-11 20:20:05 +08:00
|
|
|
* @image: The image.
|
2015-05-31 05:55:58 +08:00
|
|
|
* @new_width: New image width: (0 < new_width <= width).
|
|
|
|
* @new_height: New image height: (0 < new_height <= height).
|
|
|
|
* @offx: X offset: (0 <= offx <= (width - new_width)).
|
|
|
|
* @offy: Y offset: (0 <= offy <= (height - new_height)).
|
|
|
|
*
|
|
|
|
* Crop the image to the specified extents.
|
|
|
|
*
|
|
|
|
* This procedure crops the image so that it's new width and height are
|
|
|
|
* equal to the supplied parameters. Offsets are also provided which
|
|
|
|
* describe the position of the previous image's content. All channels
|
|
|
|
* and layers within the image are cropped to the new image extents;
|
|
|
|
* this includes the image selection mask. If any parameters are out of
|
|
|
|
* range, an error is returned.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
**/
|
|
|
|
gboolean
|
2019-08-11 20:20:05 +08:00
|
|
|
gimp_image_crop (GimpImage *image,
|
|
|
|
gint new_width,
|
|
|
|
gint new_height,
|
|
|
|
gint offx,
|
|
|
|
gint offy)
|
2015-05-31 05:55:58 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2015-05-31 05:55:58 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_IMAGE, image,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, new_width,
|
|
|
|
G_TYPE_INT, new_height,
|
|
|
|
G_TYPE_INT, offx,
|
|
|
|
G_TYPE_INT, offy,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
2015-05-31 05:55:58 +08:00
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-image-crop",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2015-05-31 05:55:58 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2019-07-30 16:51:16 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2015-05-31 05:55:58 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_image_flip:
|
2019-08-11 20:20:05 +08:00
|
|
|
* @image: The image.
|
2015-05-31 05:55:58 +08:00
|
|
|
* @flip_type: Type of flip.
|
|
|
|
*
|
|
|
|
* Flips the image horizontally or vertically.
|
|
|
|
*
|
|
|
|
* This procedure flips (mirrors) the image.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
**/
|
|
|
|
gboolean
|
2019-08-11 20:20:05 +08:00
|
|
|
gimp_image_flip (GimpImage *image,
|
|
|
|
GimpOrientationType flip_type)
|
2015-05-31 05:55:58 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2015-05-31 05:55:58 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_IMAGE, image,
|
2019-08-08 19:01:50 +08:00
|
|
|
GIMP_TYPE_ORIENTATION_TYPE, flip_type,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-image-flip",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2015-05-31 05:55:58 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2015-05-31 05:55:58 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2015-05-31 05:55:58 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_image_rotate:
|
2019-08-11 20:20:05 +08:00
|
|
|
* @image: The image.
|
2015-05-31 05:55:58 +08:00
|
|
|
* @rotate_type: Angle of rotation.
|
|
|
|
*
|
|
|
|
* Rotates the image by the specified degrees.
|
|
|
|
*
|
|
|
|
* This procedure rotates the image.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
**/
|
|
|
|
gboolean
|
2019-08-11 20:20:05 +08:00
|
|
|
gimp_image_rotate (GimpImage *image,
|
|
|
|
GimpRotationType rotate_type)
|
2015-05-31 05:55:58 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2015-05-31 05:55:58 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_IMAGE, image,
|
2019-08-08 19:01:50 +08:00
|
|
|
GIMP_TYPE_ROTATION_TYPE, rotate_type,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-image-rotate",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2015-05-31 05:55:58 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2015-05-31 05:55:58 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2015-05-31 05:55:58 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|