Gimp/libgimp/gimp.h
Jehan 7a03b3ea09 libgimp: gimp_pdb_get_data() and gimp_pdb_set_data() are made internal.
These are not usable by plug-ins anymore which should store their data between
runs as arguments or aux arguments (in case of values which should be stored
from one run to another but are not really usable for non-interactive scripts).
These are per-plug-in (not polluting the whole process space with just random
strings as identifiers which could be used by other plug-ins) and even survive
restarts of GIMP.

I still keep these functions, but only internally, as they are used to store
settings of GimpAspectPreview, GimpDrawablePreview and GimpZoomPreview across
plug-in runs. Still I changed their API to set and return a GBytes directly
(mimicking the private PDB functions' API).
Also I remove gimp_pdb_get_data_size() which is useless when exchanging GBytes
directly.

Note that the 2 functions are still exported in the library, and only not
advertized through headers (so they are not really internal, just hidden), on
purpose, because we need to call them in libgimpui. So it is still relatively
easy for a plug-in to use them. Nevertheless I made clear in the function
documentation that these must not be considered public and could end up deleted
at any time. Any plug-in still trying to call these takes the risk of having
their code relying on unreliable API.
2023-10-27 10:16:45 +00:00

201 lines
7.2 KiB
C

/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* gimp.h
*
* 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
* <https://www.gnu.org/licenses/>.
*/
#ifndef __GIMP_H__
#define __GIMP_H__
#include <cairo.h>
#include <glib-object.h>
#include <gegl.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <pango/pango.h>
#include <libgimpbase/gimpbase.h>
#include <libgimpcolor/gimpcolor.h>
#include <libgimpconfig/gimpconfig.h>
#include <libgimpmath/gimpmath.h>
#define __GIMP_H_INSIDE__
#include <libgimp/gimpenums.h>
#include <libgimp/gimptypes.h>
#include <libgimp/gimpbatchprocedure.h>
#include <libgimp/gimpbrush.h>
#include <libgimp/gimpchannel.h>
#include <libgimp/gimpdisplay.h>
#include <libgimp/gimpdrawable.h>
#include <libgimp/gimpfont.h>
#include <libgimp/gimpgimprc.h>
#include <libgimp/gimpgradient.h>
#include <libgimp/gimpimage.h>
#include <libgimp/gimpimagecolorprofile.h>
#include <libgimp/gimpimagemetadata.h>
#include <libgimp/gimpimageprocedure.h>
#include <libgimp/gimpitem.h>
#include <libgimp/gimplayer.h>
#include <libgimp/gimplayermask.h>
#include <libgimp/gimploadprocedure.h>
#include <libgimp/gimppalette.h>
#include <libgimp/gimpparamspecs.h>
#include <libgimp/gimppattern.h>
#include <libgimp/gimppdb.h>
#include <libgimp/gimpplugin.h>
#include <libgimp/gimpprocedureconfig.h>
#include <libgimp/gimpprocedure-params.h>
#include <libgimp/gimpprogress.h>
#include <libgimp/gimpresource.h>
#include <libgimp/gimpsaveprocedure.h>
#include <libgimp/gimpselection.h>
#include <libgimp/gimptextlayer.h>
#include <libgimp/gimpthumbnailprocedure.h>
#include <libgimp/gimpvectors.h>
/* Resources and their widgets. Order important. */
#include <libgimp/gimpresourceselect.h>
#include <libgimp/gimp_pdb_headers.h>
#undef __GIMP_H_INSIDE__
#ifdef G_OS_WIN32
#include <stdlib.h> /* For __argc and __argv */
#endif
G_BEGIN_DECLS
/**
* GIMP_MAIN:
* @plug_in_type: The #GType of the plug-in's #GimpPlugIn subclass
*
* A macro that expands to the appropriate main() function for the
* platform being compiled for.
*
* To use this macro, simply place a line that contains just the code
*
* GIMP_MAIN (MY_TYPE_PLUG_IN)
*
* at the toplevel of your file. No semicolon should be used.
*
* Since: 3.0
**/
#ifdef G_OS_WIN32
/* Define WinMain() because plug-ins are built as GUI applications. Also
* define a main() in case some plug-in still is built as a console
* application.
*/
# ifdef __GNUC__
# ifndef _stdcall
# define _stdcall __attribute__((stdcall))
# endif
# endif
# define GIMP_MAIN(plug_in_type) \
struct HINSTANCE__; \
\
int _stdcall \
WinMain (struct HINSTANCE__ *hInstance, \
struct HINSTANCE__ *hPrevInstance, \
char *lpszCmdLine, \
int nCmdShow); \
\
int _stdcall \
WinMain (struct HINSTANCE__ *hInstance, \
struct HINSTANCE__ *hPrevInstance, \
char *lpszCmdLine, \
int nCmdShow) \
{ \
return gimp_main (plug_in_type, \
__argc, __argv); \
} \
\
int \
main (int argc, char *argv[]) \
{ \
/* Use __argc and __argv here, too, as they work \
* better with mingw-w64. \
*/ \
return gimp_main (plug_in_type, \
__argc, __argv); \
}
#else
# define GIMP_MAIN(plug_in_type) \
int \
main (int argc, char *argv[]) \
{ \
return gimp_main (plug_in_type, \
argc, argv); \
}
#endif
/* The main procedure that must be called with the plug-in's
* GimpPlugIn subclass type and the 'argc' and 'argv' that are passed
* to "main".
*/
gint gimp_main (GType plug_in_type,
gint argc,
gchar *argv[]);
/* Return the GimpPlugIn singleton of this plug-in process
*/
GimpPlugIn * gimp_get_plug_in (void);
/* Return the GimpPDB singleton of this plug-in process
*/
GimpPDB * gimp_get_pdb (void);
/* Forcefully causes the gimp library to exit and
* close down its connection to main gimp application.
*/
void gimp_quit (void) G_GNUC_NORETURN;
/* Return various constants given by the GIMP core at plug-in config time.
*/
guint gimp_tile_width (void) G_GNUC_CONST;
guint gimp_tile_height (void) G_GNUC_CONST;
gboolean gimp_show_help_button (void) G_GNUC_CONST;
gboolean gimp_export_color_profile (void) G_GNUC_CONST;
gboolean gimp_export_comment (void) G_GNUC_CONST;
gboolean gimp_export_exif (void) G_GNUC_CONST;
gboolean gimp_export_xmp (void) G_GNUC_CONST;
gboolean gimp_export_iptc (void) G_GNUC_CONST;
gboolean gimp_export_thumbnail (void) G_GNUC_CONST;
gint gimp_get_num_processors (void) G_GNUC_CONST;
GimpCheckSize gimp_check_size (void) G_GNUC_CONST;
GimpCheckType gimp_check_type (void) G_GNUC_CONST;
const GimpRGB * gimp_check_custom_color1 (void) G_GNUC_CONST;
const GimpRGB * gimp_check_custom_color2 (void) G_GNUC_CONST;
GimpDisplay * gimp_default_display (void) G_GNUC_CONST;
const gchar * gimp_wm_class (void) G_GNUC_CONST;
const gchar * gimp_display_name (void) G_GNUC_CONST;
gint gimp_monitor_number (void) G_GNUC_CONST;
guint32 gimp_user_time (void) G_GNUC_CONST;
const gchar * gimp_icon_theme_dir (void) G_GNUC_CONST;
const gchar * gimp_get_progname (void) G_GNUC_CONST;
G_END_DECLS
#endif /* __GIMP_H__ */