2000-05-31 21:24:14 +08:00
|
|
|
/* LIBGIMP - The GIMP Library
|
2003-07-03 08:47:26 +08:00
|
|
|
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
|
2000-05-31 21:24:14 +08:00
|
|
|
*
|
|
|
|
* gimpfileops_pdb.c
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This library is free software: you can redistribute it and/or
|
2000-05-31 21:24:14 +08:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
2009-01-18 06:28:01 +08:00
|
|
|
* version 3 of the License, or (at your option) any later version.
|
2000-05-31 21:24:14 +08:00
|
|
|
*
|
|
|
|
* 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
|
2000-06-02 05:18:04 +08:00
|
|
|
* Lesser General Public License for more details.
|
2000-05-31 21:24:14 +08:00
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2009-01-18 06:28:01 +08:00
|
|
|
* License along with this library. If not, see
|
2018-07-12 05:27:07 +08:00
|
|
|
* <https://www.gnu.org/licenses/>.
|
2000-05-31 21:24:14 +08:00
|
|
|
*/
|
|
|
|
|
2007-01-09 18:52:47 +08:00
|
|
|
/* NOTE: This file is auto-generated by pdbgen.pl */
|
2000-05-31 21:24:14 +08:00
|
|
|
|
2002-05-14 07:30:23 +08:00
|
|
|
#include "config.h"
|
|
|
|
|
2000-06-02 05:18:04 +08:00
|
|
|
#include "gimp.h"
|
2000-05-31 21:24:14 +08:00
|
|
|
|
2010-07-07 17:43:10 +08:00
|
|
|
|
|
|
|
/**
|
2019-07-31 16:04:43 +08:00
|
|
|
* SECTION: gimpfileops
|
2010-07-07 17:43:10 +08:00
|
|
|
* @title: gimpfileops
|
2017-02-18 22:08:25 +08:00
|
|
|
* @short_description: Image file operations (load, save, etc.)
|
2010-07-07 17:43:10 +08:00
|
|
|
*
|
2017-02-18 22:08:25 +08:00
|
|
|
* Image file operations (load, save, etc.)
|
2010-07-07 17:43:10 +08:00
|
|
|
**/
|
|
|
|
|
|
|
|
|
2000-08-25 23:38:38 +08:00
|
|
|
/**
|
|
|
|
* gimp_file_load:
|
|
|
|
* @run_mode: The run mode.
|
|
|
|
* @filename: The name of the file to load.
|
2002-04-14 22:38:55 +08:00
|
|
|
* @raw_filename: The name as entered by the user.
|
2000-08-25 23:38:38 +08:00
|
|
|
*
|
2005-10-17 23:15:20 +08:00
|
|
|
* Loads an image file by invoking the right load handler.
|
2000-08-25 23:38:38 +08:00
|
|
|
*
|
2004-06-22 16:54:27 +08:00
|
|
|
* This procedure invokes the correct file load handler using magic if
|
|
|
|
* possible, and falling back on the file's extension and/or prefix if
|
|
|
|
* not. The name of the file to load is typically a full pathname, and
|
|
|
|
* the name entered is what the user actually typed before prepending a
|
|
|
|
* directory path. The reason for this is that if the user types
|
2018-07-14 20:13:22 +08:00
|
|
|
* https://www.gimp.org/foo.png he wants to fetch a URL, and the full
|
|
|
|
* pathname will not look like a URL.
|
2000-08-25 23:38:38 +08:00
|
|
|
*
|
2019-08-15 16:01:08 +08:00
|
|
|
* Returns: (transfer none): The output image.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2019-08-11 20:20:05 +08:00
|
|
|
GimpImage *
|
2001-12-19 08:13:16 +08:00
|
|
|
gimp_file_load (GimpRunMode run_mode,
|
2006-04-12 18:27:31 +08:00
|
|
|
const gchar *filename,
|
|
|
|
const gchar *raw_filename)
|
2000-08-25 23:38:38 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2019-08-11 20:20:05 +08:00
|
|
|
GimpImage *image = NULL;
|
2000-08-25 23:38:38 +08:00
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
GIMP_TYPE_RUN_MODE, run_mode,
|
|
|
|
G_TYPE_STRING, filename,
|
|
|
|
G_TYPE_STRING, raw_filename,
|
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-file-load",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2000-08-25 23:38:38 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-09-04 08:49:33 +08:00
|
|
|
image = GIMP_VALUES_GET_IMAGE (return_vals, 1);
|
2000-08-25 23:38:38 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2000-08-25 23:38:38 +08:00
|
|
|
|
2019-08-11 20:20:05 +08:00
|
|
|
return image;
|
2000-08-25 23:38:38 +08:00
|
|
|
}
|
|
|
|
|
2005-10-17 23:15:20 +08:00
|
|
|
/**
|
|
|
|
* gimp_file_load_layer:
|
|
|
|
* @run_mode: The run mode.
|
2019-08-11 20:20:05 +08:00
|
|
|
* @image: Destination image.
|
2005-10-17 23:15:20 +08:00
|
|
|
* @filename: The name of the file to load.
|
|
|
|
*
|
2006-11-04 01:12:27 +08:00
|
|
|
* Loads an image file as a layer for an existing image.
|
2005-10-17 23:15:20 +08:00
|
|
|
*
|
|
|
|
* This procedure behaves like the file-load procedure but opens the
|
2006-11-04 01:12:27 +08:00
|
|
|
* specified image as a layer for an existing image. The returned layer
|
2010-09-06 06:03:29 +08:00
|
|
|
* needs to be added to the existing image with
|
|
|
|
* gimp_image_insert_layer().
|
2005-10-17 23:15:20 +08:00
|
|
|
*
|
2019-08-15 18:12:25 +08:00
|
|
|
* Returns: (transfer none): The layer created when loading the image file.
|
2005-10-17 23:15:20 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2019-08-13 19:59:33 +08:00
|
|
|
GimpLayer *
|
2005-10-17 23:15:20 +08:00
|
|
|
gimp_file_load_layer (GimpRunMode run_mode,
|
2019-08-11 20:20:05 +08:00
|
|
|
GimpImage *image,
|
2006-04-12 18:27:31 +08:00
|
|
|
const gchar *filename)
|
2005-10-17 23:15:20 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2019-08-13 19:59:33 +08:00
|
|
|
GimpLayer *layer = NULL;
|
2005-10-17 23:15:20 +08:00
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
GIMP_TYPE_RUN_MODE, run_mode,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_IMAGE, image,
|
2019-08-08 19:01:50 +08:00
|
|
|
G_TYPE_STRING, filename,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
2005-10-17 23:15:20 +08:00
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-file-load-layer",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2005-10-17 23:15:20 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2019-09-04 08:49:33 +08:00
|
|
|
layer = GIMP_VALUES_GET_LAYER (return_vals, 1);
|
2019-07-30 16:51:16 +08:00
|
|
|
|
|
|
|
gimp_value_array_unref (return_vals);
|
2005-10-17 23:15:20 +08:00
|
|
|
|
2019-08-13 19:59:33 +08:00
|
|
|
return layer;
|
2005-10-17 23:15:20 +08:00
|
|
|
}
|
|
|
|
|
2006-11-04 01:12:27 +08:00
|
|
|
/**
|
|
|
|
* gimp_file_load_layers:
|
|
|
|
* @run_mode: The run mode.
|
2019-08-11 20:20:05 +08:00
|
|
|
* @image: Destination image.
|
2006-11-04 01:12:27 +08:00
|
|
|
* @filename: The name of the file to load.
|
2019-08-01 04:51:35 +08:00
|
|
|
* @num_layers: (out): The number of loaded layers.
|
2006-11-04 01:12:27 +08:00
|
|
|
*
|
|
|
|
* Loads an image file as layers for an existing image.
|
|
|
|
*
|
|
|
|
* This procedure behaves like the file-load procedure but opens the
|
|
|
|
* specified image as layers for an existing image. The returned layers
|
2010-09-06 06:03:29 +08:00
|
|
|
* needs to be added to the existing image with
|
|
|
|
* gimp_image_insert_layer().
|
2006-11-04 01:12:27 +08:00
|
|
|
*
|
2019-09-05 18:57:43 +08:00
|
|
|
* Returns: (array length=num_layers) (element-type GimpLayer) (transfer container):
|
2019-08-05 04:09:04 +08:00
|
|
|
* The list of loaded layers.
|
|
|
|
* The returned value must be freed with g_free().
|
2006-11-04 01:12:27 +08:00
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.4
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2019-09-05 18:57:43 +08:00
|
|
|
GimpLayer **
|
2006-11-04 01:12:27 +08:00
|
|
|
gimp_file_load_layers (GimpRunMode run_mode,
|
2019-08-11 20:20:05 +08:00
|
|
|
GimpImage *image,
|
2006-11-04 01:12:27 +08:00
|
|
|
const gchar *filename,
|
|
|
|
gint *num_layers)
|
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2019-09-05 18:57:43 +08:00
|
|
|
GimpLayer **layers = NULL;
|
2006-11-04 01:12:27 +08:00
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
GIMP_TYPE_RUN_MODE, run_mode,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_IMAGE, image,
|
2019-08-08 19:01:50 +08:00
|
|
|
G_TYPE_STRING, filename,
|
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-file-load-layers",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2006-11-04 01:12:27 +08:00
|
|
|
|
|
|
|
*num_layers = 0;
|
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
|
2006-11-04 01:12:27 +08:00
|
|
|
{
|
2019-09-04 08:49:33 +08:00
|
|
|
*num_layers = GIMP_VALUES_GET_INT (return_vals, 1);
|
2019-09-05 18:57:43 +08:00
|
|
|
layers = GIMP_VALUES_DUP_OBJECT_ARRAY (return_vals, 2);
|
2006-11-04 01:12:27 +08:00
|
|
|
}
|
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2006-11-04 01:12:27 +08:00
|
|
|
|
2019-09-05 18:57:43 +08:00
|
|
|
return layers;
|
2006-11-04 01:12:27 +08:00
|
|
|
}
|
|
|
|
|
2000-08-25 23:38:38 +08:00
|
|
|
/**
|
|
|
|
* gimp_file_save:
|
|
|
|
* @run_mode: The run mode.
|
2019-08-11 20:20:05 +08:00
|
|
|
* @image: Input image.
|
2019-08-13 19:59:33 +08:00
|
|
|
* @drawable: Drawable to save.
|
2000-08-25 23:38:38 +08:00
|
|
|
* @filename: The name of the file to save the image in.
|
2002-04-14 22:38:55 +08:00
|
|
|
* @raw_filename: The name as entered by the user.
|
2000-08-25 23:38:38 +08:00
|
|
|
*
|
|
|
|
* Saves a file by extension.
|
|
|
|
*
|
|
|
|
* This procedure invokes the correct file save handler according to
|
|
|
|
* the file's extension and/or prefix. The name of the file to save is
|
|
|
|
* typically a full pathname, and the name entered is what the user
|
|
|
|
* actually typed before prepending a directory path. The reason for
|
2018-07-14 20:13:22 +08:00
|
|
|
* this is that if the user types https://www.gimp.org/foo.png she
|
|
|
|
* wants to fetch a URL, and the full pathname will not look like a
|
|
|
|
* URL.
|
2000-08-25 23:38:38 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2000-08-25 23:38:38 +08:00
|
|
|
gboolean
|
2019-08-13 19:59:33 +08:00
|
|
|
gimp_file_save (GimpRunMode run_mode,
|
|
|
|
GimpImage *image,
|
|
|
|
GimpDrawable *drawable,
|
|
|
|
const gchar *filename,
|
|
|
|
const gchar *raw_filename)
|
2000-08-25 23:38:38 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2000-08-25 23:38:38 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
GIMP_TYPE_RUN_MODE, run_mode,
|
2019-08-29 17:25:35 +08:00
|
|
|
GIMP_TYPE_IMAGE, image,
|
|
|
|
GIMP_TYPE_DRAWABLE, drawable,
|
2019-08-08 19:01:50 +08:00
|
|
|
G_TYPE_STRING, filename,
|
|
|
|
G_TYPE_STRING, raw_filename,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
2000-08-25 23:38:38 +08:00
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-file-save",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2000-08-25 23:38:38 +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);
|
2006-11-06 16:12:37 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gimp_file_save_thumbnail:
|
2019-08-11 20:20:05 +08:00
|
|
|
* @image: The image.
|
2006-11-06 16:12:37 +08:00
|
|
|
* @filename: The name of the file the thumbnail belongs to.
|
|
|
|
*
|
|
|
|
* Saves a thumbnail for the given image
|
|
|
|
*
|
|
|
|
* This procedure saves a thumbnail for the given image according to
|
|
|
|
* the Free Desktop Thumbnail Managing Standard. The thumbnail is saved
|
|
|
|
* so that it belongs to the file with the given filename. This means
|
|
|
|
* you have to save the image under this name first, otherwise this
|
|
|
|
* procedure will fail. This procedure may become useful if you want to
|
2012-09-11 00:22:12 +08:00
|
|
|
* explicitly save a thumbnail with a file.
|
2006-11-06 16:12:37 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2006-11-06 16:12:37 +08:00
|
|
|
gboolean
|
2019-08-11 20:20:05 +08:00
|
|
|
gimp_file_save_thumbnail (GimpImage *image,
|
2006-11-06 16:12:37 +08:00
|
|
|
const gchar *filename)
|
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2006-11-06 16:12:37 +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
|
|
|
G_TYPE_STRING, filename,
|
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-file-save-thumbnail",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2006-11-06 16:12:37 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2006-11-06 16:12:37 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2000-08-25 23:38:38 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2000-08-25 07:06:53 +08:00
|
|
|
/**
|
2019-08-11 19:21:55 +08:00
|
|
|
* _gimp_register_magic_load_handler:
|
2000-08-25 07:06:53 +08:00
|
|
|
* @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
|
2004-11-01 23:44:57 +08:00
|
|
|
* of a particular file format using magic file information.
|
2000-08-25 07:06:53 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2000-08-23 09:44:59 +08:00
|
|
|
gboolean
|
2019-08-11 19:21:55 +08:00
|
|
|
_gimp_register_magic_load_handler (const gchar *procedure_name,
|
|
|
|
const gchar *extensions,
|
|
|
|
const gchar *prefixes,
|
|
|
|
const gchar *magics)
|
2000-05-31 21:24:14 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2000-08-23 09:44:59 +08:00
|
|
|
gboolean success = TRUE;
|
2000-05-31 21:24:14 +08:00
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, procedure_name,
|
|
|
|
G_TYPE_STRING, extensions,
|
|
|
|
G_TYPE_STRING, prefixes,
|
|
|
|
G_TYPE_STRING, magics,
|
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-register-magic-load-handler",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2000-05-31 21:24:14 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2000-08-23 09:44:59 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2000-08-23 09:44:59 +08:00
|
|
|
|
|
|
|
return success;
|
2000-05-31 21:24:14 +08:00
|
|
|
}
|
|
|
|
|
2000-08-25 07:06:53 +08:00
|
|
|
/**
|
2019-08-11 19:21:55 +08:00
|
|
|
* _gimp_register_load_handler:
|
2000-08-25 07:06:53 +08:00
|
|
|
* @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:\").
|
|
|
|
*
|
|
|
|
* Registers a file load handler procedure.
|
|
|
|
*
|
|
|
|
* Registers a procedural database procedure to be called to load files
|
2004-11-01 23:44:57 +08:00
|
|
|
* of a particular file format.
|
2000-08-25 07:06:53 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2000-08-23 09:44:59 +08:00
|
|
|
gboolean
|
2019-08-11 19:21:55 +08:00
|
|
|
_gimp_register_load_handler (const gchar *procedure_name,
|
|
|
|
const gchar *extensions,
|
|
|
|
const gchar *prefixes)
|
2000-05-31 21:24:14 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2000-08-23 09:44:59 +08:00
|
|
|
gboolean success = TRUE;
|
2000-05-31 21:24:14 +08:00
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, procedure_name,
|
|
|
|
G_TYPE_STRING, extensions,
|
|
|
|
G_TYPE_STRING, prefixes,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
2000-05-31 21:24:14 +08:00
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-register-load-handler",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2000-08-23 09:44:59 +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);
|
2000-08-23 09:44:59 +08:00
|
|
|
|
|
|
|
return success;
|
2000-05-31 21:24:14 +08:00
|
|
|
}
|
|
|
|
|
2000-08-25 07:06:53 +08:00
|
|
|
/**
|
2019-08-11 19:21:55 +08:00
|
|
|
* _gimp_register_save_handler:
|
2000-08-25 07:06:53 +08:00
|
|
|
* @procedure_name: The name of the procedure to be used for saving.
|
|
|
|
* @extensions: comma separated list of extensions this handler can save (i.e. \"jpg,jpeg\").
|
|
|
|
* @prefixes: comma separated list of prefixes this handler can save (i.e. \"http:,ftp:\").
|
|
|
|
*
|
|
|
|
* Registers a file save handler procedure.
|
|
|
|
*
|
|
|
|
* Registers a procedural database procedure to be called to save files
|
2004-11-01 23:44:57 +08:00
|
|
|
* in a particular file format.
|
2000-08-25 07:06:53 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2000-08-23 09:44:59 +08:00
|
|
|
gboolean
|
2019-08-11 19:21:55 +08:00
|
|
|
_gimp_register_save_handler (const gchar *procedure_name,
|
|
|
|
const gchar *extensions,
|
|
|
|
const gchar *prefixes)
|
2000-05-31 21:24:14 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2000-08-23 09:44:59 +08:00
|
|
|
gboolean success = TRUE;
|
2000-05-31 21:24:14 +08:00
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, procedure_name,
|
|
|
|
G_TYPE_STRING, extensions,
|
|
|
|
G_TYPE_STRING, prefixes,
|
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-register-save-handler",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2000-05-31 21:24:14 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2000-08-23 09:44:59 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2000-08-23 09:44:59 +08:00
|
|
|
|
|
|
|
return success;
|
2000-05-31 21:24:14 +08:00
|
|
|
}
|
2004-05-14 08:01:11 +08:00
|
|
|
|
2018-07-17 14:19:58 +08:00
|
|
|
/**
|
2019-08-11 19:21:55 +08:00
|
|
|
* _gimp_register_file_handler_priority:
|
2018-07-17 14:19:58 +08:00
|
|
|
* @procedure_name: The name of the procedure to set the priority of.
|
|
|
|
* @priority: The procedure priority.
|
|
|
|
*
|
|
|
|
* Sets the priority of a file handler procedure.
|
|
|
|
*
|
|
|
|
* Sets the priority of a file handler procedure. When more than one
|
|
|
|
* procedure matches a given file, the procedure with the lowest
|
|
|
|
* priority is used; if more than one procedure has the lowest
|
|
|
|
* priority, it is unspecified which one of them is used. The default
|
|
|
|
* priority for file handler procedures is 0.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
|
|
|
* Since: 2.10.6
|
|
|
|
**/
|
|
|
|
gboolean
|
2019-08-11 19:21:55 +08:00
|
|
|
_gimp_register_file_handler_priority (const gchar *procedure_name,
|
|
|
|
gint priority)
|
2018-07-17 14:19:58 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2018-07-17 14:19:58 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, procedure_name,
|
2019-08-15 20:04:56 +08:00
|
|
|
G_TYPE_INT, priority,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
2018-07-17 14:19:58 +08:00
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-register-file-handler-priority",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2018-07-17 14:19: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);
|
2018-07-17 14:19:58 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2004-05-14 08:01:11 +08:00
|
|
|
/**
|
2019-08-11 19:21:55 +08:00
|
|
|
* _gimp_register_file_handler_mime:
|
2004-05-14 08:01:11 +08:00
|
|
|
* @procedure_name: The name of the procedure to associate a MIME type with.
|
2017-05-05 05:22:37 +08:00
|
|
|
* @mime_types: A comma-separated list of MIME types, such as \"image/jpeg\".
|
2004-05-14 08:01:11 +08:00
|
|
|
*
|
2017-05-05 05:22:37 +08:00
|
|
|
* Associates MIME types with a file handler procedure.
|
2004-05-14 08:01:11 +08:00
|
|
|
*
|
2017-05-05 05:22:37 +08:00
|
|
|
* Registers MIME types for a file handler procedure. This allows GIMP
|
2004-05-14 21:47:04 +08:00
|
|
|
* to determine the MIME type of the file opened or saved using this
|
2017-05-05 05:22:37 +08:00
|
|
|
* procedure. It is recommended that only one MIME type is registered
|
|
|
|
* per file procedure; when registering more than one MIME type, GIMP
|
|
|
|
* will associate the first one with files opened or saved with this
|
2004-05-14 08:01:11 +08:00
|
|
|
* procedure.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-05-14 08:01:11 +08:00
|
|
|
gboolean
|
2019-08-11 19:21:55 +08:00
|
|
|
_gimp_register_file_handler_mime (const gchar *procedure_name,
|
|
|
|
const gchar *mime_types)
|
2004-05-14 08:01:11 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-05-14 08:01:11 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, procedure_name,
|
|
|
|
G_TYPE_STRING, mime_types,
|
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-register-file-handler-mime",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-05-14 08:01:11 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-05-14 08:01:11 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-05-14 08:01:11 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
2004-11-14 01:06:06 +08:00
|
|
|
|
2012-11-17 23:01:52 +08:00
|
|
|
/**
|
2019-08-19 18:05:12 +08:00
|
|
|
* _gimp_register_file_handler_remote:
|
|
|
|
* @procedure_name: The name of the procedure to enable remote URIs for.
|
2012-11-17 23:01:52 +08:00
|
|
|
*
|
2019-08-19 18:05:12 +08:00
|
|
|
* Registers a file handler procedure as capable of handling remote
|
|
|
|
* URIs.
|
2012-11-17 23:01:52 +08:00
|
|
|
*
|
2019-08-19 18:05:12 +08:00
|
|
|
* Registers a file handler procedure as capable of handling remote
|
|
|
|
* URIs. This allows GIMP to call the procedure directly for all kinds
|
|
|
|
* of URIs, not only on local file:// URIs.
|
2012-11-17 23:01:52 +08:00
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.10
|
2012-11-17 23:01:52 +08:00
|
|
|
**/
|
|
|
|
gboolean
|
2019-08-19 18:05:12 +08:00
|
|
|
_gimp_register_file_handler_remote (const gchar *procedure_name)
|
2012-11-17 23:01:52 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2012-11-17 23:01:52 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, procedure_name,
|
2019-07-30 16:51:16 +08:00
|
|
|
G_TYPE_NONE);
|
2012-11-17 23:01:52 +08:00
|
|
|
|
2019-09-04 05:55:49 +08:00
|
|
|
return_vals = gimp_pdb_run_procedure_array (gimp_get_pdb (),
|
|
|
|
"gimp-register-file-handler-remote",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2012-11-17 23:01:52 +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);
|
2012-11-17 23:01:52 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2017-05-05 02:35:53 +08:00
|
|
|
/**
|
2019-08-11 19:21:55 +08:00
|
|
|
* _gimp_register_file_handler_raw:
|
2017-05-05 02:35:53 +08:00
|
|
|
* @procedure_name: The name of the procedure to enable raw handling for.
|
|
|
|
*
|
|
|
|
* Registers a file handler procedure as capable of handling raw camera
|
|
|
|
* files.
|
|
|
|
*
|
|
|
|
* Registers a file handler procedure as capable of handling raw
|
|
|
|
* digital camera files. Use this procedure only to register raw load
|
|
|
|
* handlers, calling it on a save handler will generate an error.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
|
|
|
* Since: 2.10
|
|
|
|
**/
|
|
|
|
gboolean
|
2019-08-11 19:21:55 +08:00
|
|
|
_gimp_register_file_handler_raw (const gchar *procedure_name)
|
2017-05-05 02:35:53 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2017-05-05 02:35:53 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, procedure_name,
|
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-register-file-handler-raw",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2017-05-05 02:35:53 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2017-05-05 02:35:53 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2017-05-05 02:35:53 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2004-11-14 01:06:06 +08:00
|
|
|
/**
|
2019-08-11 20:27:41 +08:00
|
|
|
* _gimp_register_thumbnail_loader:
|
2004-11-14 01:06:06 +08:00
|
|
|
* @load_proc: The name of the procedure the thumbnail loader with.
|
|
|
|
* @thumb_proc: The name of the thumbnail load procedure.
|
|
|
|
*
|
|
|
|
* Associates a thumbnail loader with a file load procedure.
|
|
|
|
*
|
|
|
|
* Some file formats allow for embedded thumbnails, other file formats
|
|
|
|
* contain a scalable image or provide the image data in different
|
|
|
|
* resolutions. A file plug-in for such a format may register a special
|
|
|
|
* procedure that allows GIMP to load a thumbnail preview of the image.
|
|
|
|
* This procedure is then associated with the standard load procedure
|
|
|
|
* using this function.
|
|
|
|
*
|
|
|
|
* Returns: TRUE on success.
|
|
|
|
*
|
2015-06-01 03:18:09 +08:00
|
|
|
* Since: 2.2
|
2010-09-16 04:07:36 +08:00
|
|
|
**/
|
2004-11-14 01:06:06 +08:00
|
|
|
gboolean
|
2019-08-11 20:27:41 +08:00
|
|
|
_gimp_register_thumbnail_loader (const gchar *load_proc,
|
|
|
|
const gchar *thumb_proc)
|
2004-11-14 01:06:06 +08:00
|
|
|
{
|
2019-07-30 16:51:16 +08:00
|
|
|
GimpValueArray *args;
|
|
|
|
GimpValueArray *return_vals;
|
2004-11-14 01:06:06 +08:00
|
|
|
gboolean success = TRUE;
|
|
|
|
|
2019-08-08 19:01:50 +08:00
|
|
|
args = gimp_value_array_new_from_types (NULL,
|
|
|
|
G_TYPE_STRING, load_proc,
|
|
|
|
G_TYPE_STRING, thumb_proc,
|
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-register-thumbnail-loader",
|
|
|
|
args);
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (args);
|
2004-11-14 01:06:06 +08:00
|
|
|
|
2019-09-04 07:49:35 +08:00
|
|
|
success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;
|
2004-11-14 01:06:06 +08:00
|
|
|
|
2019-07-30 16:51:16 +08:00
|
|
|
gimp_value_array_unref (return_vals);
|
2004-11-14 01:06:06 +08:00
|
|
|
|
|
|
|
return success;
|
|
|
|
}
|