mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-10-06 05:22:40 +02:00
Compare commits
27 Commits
wip/init-p
...
soc-2008-p
Author | SHA1 | Date | |
---|---|---|---|
|
4e2bc38d15 | ||
|
e0ea2fb2e7 | ||
|
abf1a8ba05 | ||
|
ac10f3950a | ||
|
8b1b5015ea | ||
|
ee727921bb | ||
|
67426eb82c | ||
|
de085845a0 | ||
|
b6ffc2d7a7 | ||
|
bccac74ec1 | ||
|
4fc6e4b270 | ||
|
dddd5160c8 | ||
|
2bedf4688c | ||
|
f03966b507 | ||
|
bdd0f80678 | ||
|
e1a84e95ff | ||
|
b252c298e8 | ||
|
acb5c34c8c | ||
|
51f3fb3bc8 | ||
|
d9d1a1905d | ||
|
a7f80d0313 | ||
|
975b6bd67e | ||
|
37d06df1bb | ||
|
8c423d93b0 | ||
|
1674446049 | ||
|
ac5cd6e228 | ||
|
29e78de25e |
254
ChangeLog
254
ChangeLog
@@ -1,3 +1,257 @@
|
||||
2008-08-18 Lars-Peter Clausen <lars@metafoo.de>
|
||||
|
||||
Add new documenation based on the pygobject documentation system.
|
||||
|
||||
* configure.in
|
||||
* plug-ins/pygimp/Makefile.am
|
||||
* plug-ins/pygimp/doc/Makefile.am
|
||||
* plug-ins/pygimp/doc/html
|
||||
* plug-ins/pygimp/doc/html/style.css
|
||||
* plug-ins/pygimp/doc/xsl
|
||||
* plug-ins/pygimp/doc/xsl/ref-html-style.xsl
|
||||
* plug-ins/pygimp/doc/xsl/fixxref.py.in
|
||||
* plug-ins/pygimp/doc/xsl/html.xsl
|
||||
* plug-ins/pygimp/doc/xsl/devhelp.xsl
|
||||
* plug-ins/pygimp/doc/xsl/pdf-style.xsl
|
||||
* plug-ins/pygimp/doc/xsl/common.xsl
|
||||
* plug-ins/pygimp/doc/xsl/pdf.xsl
|
||||
* plug-ins/pygimp/doc/Makefile.am
|
||||
* plug-ins/pygimp/doc/reference
|
||||
* plug-ins/pygimp/doc/reference/pygimp-classes.xml
|
||||
* plug-ins/pygimp/doc/reference/pygimp-pixel-fetcher.xml
|
||||
* plug-ins/pygimp/doc/reference/entities.docbook
|
||||
* plug-ins/pygimp/doc/reference/pygimp-drawable.xml
|
||||
* plug-ins/pygimp/doc/reference/pygimp.xml
|
||||
* plug-ins/pygimp/doc/reference/pygimp-image.xml
|
||||
* plug-ins/pygimp/doc/reference/pygimp-pixel-rgn.xml
|
||||
* plug-ins/pygimp/doc/reference/entities.docbook.in
|
||||
* plug-ins/pygimp/doc/reference/pygimp-channel.xml
|
||||
* plug-ins/pygimp/doc/reference/pygimp-parasite.xml
|
||||
* plug-ins/pygimp/doc/reference/pygimp-ref.xml
|
||||
* plug-ins/pygimp/doc/reference/pygimp-layer.xml
|
||||
|
||||
2008-07-29 Lars-Peter Clausen <lars@metafoo.de>
|
||||
|
||||
* plug-ins/pygimp/gimpfu.py: Refactored the interactive mode code. Moved all
|
||||
widget code to a new subclass of gimp.Dialog.
|
||||
Added support to specifiy a custom layout for plugins.
|
||||
* plug-ins/pygimp/plug-ins/sphere.py: Added testcode for the new layout
|
||||
parameter of register.
|
||||
|
||||
2008-07-25 Lars-Peter Clausen <lars@metafoo.de>
|
||||
|
||||
* plug-ins/pygimp/gimpui.override: Let ZoomPreview.get_drawable and
|
||||
AspectPreview.get_drawable return the PyGimpDrawable which was passed to
|
||||
their constructors.
|
||||
|
||||
2008-07-24 Lars-Peter Clausen <lars@metafoo.de>
|
||||
|
||||
* plug-ins/pygimp/gimpui.override
|
||||
(_wrap_gimp_dialog_new, _wrap_gimp_proc_browser_dialog_new): Only try set
|
||||
the objects data after the object has been created.
|
||||
|
||||
2008-07-24 Lars-Peter Clausen <lars@metafoo.de>
|
||||
|
||||
* plug-ins/pygimp/pygimp-drawable.c: Initialise self->drawable in lay_init
|
||||
and chn_init.
|
||||
|
||||
2008-07-23 Lars-Peter Clausen <lars@metafoo.de>
|
||||
|
||||
* plug-ins/pygimp/gimpui.override: Wrapped GimpAspectpreview,
|
||||
GimpDrawablePreview and GimpZoomPrewview constructors.
|
||||
|
||||
2008-07-23 Lars-Peter Clausen <lars@metafoo.de>
|
||||
|
||||
* plug-ins/pygimp/pygimp-drawable.c: Fixed usage of GimpDrawable.
|
||||
|
||||
2008-07-04 Lars-Peter Clausen <lars@metafoo.de>
|
||||
|
||||
* plug-ins/pygimp/pygimp-tile.c
|
||||
* plug-ins/pygimp/pygimp-drawable.c
|
||||
* plug-ins/pygimp/pygimp-vectors.c
|
||||
* plug-ins/pygimp/gimpmodile.c: Fixed some potential crashes.
|
||||
|
||||
2008-06-30 Lars-Peter Clausen <lars@metafoo.de>
|
||||
|
||||
* plug-ins/pygimp/tools.py: Fixed typo
|
||||
* plug-ins/pygimp/gimpmodule.c: Fixed wrong function and type pointers
|
||||
in _PyGimp_Functions.
|
||||
* plug-ins/pygimp/pygimp-colors.c:
|
||||
* plug-ins/pygimp/pygimp-image.c:
|
||||
* plug-ins/pygimp/gimpui.defs:
|
||||
Fixed compiler warnings
|
||||
|
||||
2008-06-28 Lars-Peter Clausen <lars@metafoo.de>
|
||||
|
||||
* plug-ins/pygimp/pygimp-pdb.c: Fix typo
|
||||
* plug-ins/pygimp/__init__.py: pixel propertys now return a tuple of
|
||||
gimp.Color. Fixed gradient range index issues.
|
||||
* plug-ins/pygimp/Makefile: Added tools.py
|
||||
* plug-ins/pygimp/tools.py: New module that provides functions for
|
||||
paint and select tools
|
||||
|
||||
2008-06-16 Lars-Peter Clausen <lars@metafoo.de>
|
||||
|
||||
* plug-ins/pygimp/gimpmodule.c
|
||||
* plug-ins/pygimp/pygimp.h
|
||||
* plug-ins/pygimp/pygimp-pdb.c: Set more descriptive exceptions when a
|
||||
pdb call fails.
|
||||
* plug-ins/pygimp/gimpui.defs: Readded some defintions that got lost
|
||||
during the regeneration.
|
||||
* plug-ins/pygimp/testui.py: Test for the readded defintions.
|
||||
|
||||
2008-06-15 Lars-Peter Clausen <lars@metafoo.de>
|
||||
|
||||
* plug-ins/pygimp/pygimp-image.c:
|
||||
* plug-ins/pygimp/pygimp-drawable.c:
|
||||
* plug-ins/pygimp/pygimp-vectors.c:
|
||||
Added checks to (pygimp_{image,drawable,layer,channel,vectores}_new) to
|
||||
ensure that a python object only gets created when the object id is
|
||||
valid, otherwise return None.
|
||||
* plug-ins/pygimp/pygimp-display:
|
||||
(disp_repr): Changed repr string to match the rest of pygimp.
|
||||
(pygimp_display_new): Check if a display id is valid.
|
||||
|
||||
2008-06-15 Lars-Peter Clausen <lars@metafoo.de>
|
||||
|
||||
* plug-ins/pygimp/plug-ins/python-fu-eval.py: Moved execution into
|
||||
global namespace. Fixes import statements inside of evaled code.
|
||||
* plug-ins/pygimp/testui.py: Cleaned use of import statements.
|
||||
* plug-ins/pygimp/testui: Redirect stderr to stdout
|
||||
|
||||
2008-06-15 Lars-Peter Clausen <lars@metafoo.de>
|
||||
|
||||
* plug-ins/pygimp/gimpui.defs: Regenerated file
|
||||
* plug-ins/pygimp/gimpui.defs:
|
||||
Fixed or added the following wrapper functions:
|
||||
gimp_browser_add_search_types
|
||||
gimp_preview_transform
|
||||
gimp_preview_untransform
|
||||
gimp_int_store_lookup_by_value
|
||||
gimp_memsize_entry_new
|
||||
gimp_memsize_entry_set_value
|
||||
gimp_color_area_get_color
|
||||
gimp_color_hex_entry_get_color
|
||||
gimp_color_notebook_get_color
|
||||
gimp_color_selection_get_color
|
||||
gimp_color_selection_get_old_color
|
||||
gimp_enum_store_new
|
||||
* libgimpwidgets/gimpbrowser.c (gimp_browser_add_search_types):
|
||||
Fixed usage of gimp_int_combo_box_append
|
||||
* libgimwidgets/gimppatheditor.c: Changed constructor to use properties
|
||||
* plug-ins/pygimp/testui{.py}: Added a script that calls every wrapped
|
||||
method to ensure that it does not crash and accepts the expected
|
||||
arguments.
|
||||
* plug-ins/pygimp/gimpmodule.c:
|
||||
* plug-ins/pygimp/pygimp-api.h:
|
||||
* plug-ins/pygimp/pygimp.h:
|
||||
Moved PyGimpPixelRgn into the API struct
|
||||
|
||||
2008-06-11 Lars-Peter Clausen <lars@metafoo.de>
|
||||
|
||||
* plug-ins/pygimp/__init__.py: Fixed gradient range issues.
|
||||
* plug-ins/pygimp/gimpenums-types.defs: Regenerated file
|
||||
* plug-ins/pygimp/gimpui.defs
|
||||
* plug-ins/pygimp/gimpui.override
|
||||
Added wrappers for the following functions that are not autogenerated.
|
||||
gimp_int_combo_box_set_sensitivity
|
||||
gimp_int_combo_box_append
|
||||
gimp_int_combo_box_prepend
|
||||
gimp_page_selector_get_selected_pages
|
||||
gimp_preview_get_position
|
||||
gimp_preview_get_size
|
||||
gimp_zoom_model_get_fraction
|
||||
gimp_drawable_preview_get_drawable
|
||||
gimp_zoom_preview_get_drawable
|
||||
gimp_drawable_preview_draw_region
|
||||
|
||||
2008-06-09 Lars-Peter Clausen <lars@metafoo.de>
|
||||
Fixed some compiler warnings
|
||||
* plug-ins/pygimp/pygimp-colors.c
|
||||
* plug-ins/pygimp/pygimp-pdb.c
|
||||
|
||||
2008-06-09 Lars-Peter Clausen <lars@metafoo.de>
|
||||
Added wrapper for GimpColorProfileStore and GimpColorProfileCombobox
|
||||
* plug-ins/pygimp/gimpui.defs
|
||||
* plug-ins/pygimp/gimpui.override
|
||||
|
||||
2008-06-09 Lars-Peter Clausen <lars@metafoo.de>
|
||||
|
||||
* plug-ins/pygimp/__init.py__: Added wrapper for gradients
|
||||
* plug-ins/pygimp/context.py: Added context submodule which provides a
|
||||
wrapper around all gimp_context_[get|set]* functions.
|
||||
|
||||
2008-06-03 Lars-Peter Clausen <lars@metafoo.de>
|
||||
|
||||
Added wrapper for GimpNumberPairEntry
|
||||
* plug-ins/pygimp/gimpui.defs
|
||||
* plug-ins/pygimp/gimpui.override
|
||||
|
||||
2008-06-01 Lars-Peter Clausen <lars@metafoo.de>
|
||||
|
||||
* plug-ins/pygimp/__init__.py: Added wrapper for Palettes
|
||||
|
||||
2008-05-29 Lars-Peter Clausen <lars@metafoo.de>
|
||||
|
||||
* plug-ins/pygimp/__init__.py: Added wrapper objects for Brushes and
|
||||
Patterns
|
||||
* plug-ins/pygimp/gimpshelf.py: Forgot that one in last commit
|
||||
|
||||
2008-05-29 Lars-Peter Clausen <lars@metafoo.de>
|
||||
|
||||
Move gimpenums, gimpshelf, gimpui, gimpcolor to the gimp package and
|
||||
remove the leading gimp. So they are now accessed as gimp.enums.
|
||||
The old modules import everything from the new ones.
|
||||
|
||||
* plug-ins/pygimp/gimpcolor.py
|
||||
* plug-ins/pygimp/gimpshelf.py
|
||||
* plug-ins/pygimp/gimpui.py
|
||||
* plug-ins/pygimp/gimpenums.py
|
||||
* plug-ins/pygimp/gimpthumb.py
|
||||
* plug-ins/pygimp/enums.py
|
||||
* plug-ins/pygimp/ui.py
|
||||
* plug-ins/pygimp/shelf.py
|
||||
* plug-ins/pygimp/gimpfu.py
|
||||
* plug-ins/pygimp/gimpthumbmodule.c
|
||||
* plug-ins/pygimp/gimpenumsmodule.c
|
||||
* plug-ins/pygimp/pygimpcolor-api.h
|
||||
* plug-ins/pygimp/gimpuimodule.c
|
||||
* plug-ins/pygimp/gimpcolormodule.c
|
||||
* plug-ins/pygimp/pygimp-pdb.c
|
||||
* plug-ins/pygimp/Makefile.am
|
||||
|
||||
2008-05-26 Lars-Peter Clausen <lars@metafoo.de>
|
||||
|
||||
* plug-ins/pygimp/gimpfu.py: Convert PDB_* enums to int when assigned
|
||||
to PF_* constants
|
||||
|
||||
2008-05-26 Lars-Peter Clausen <lars@metafoo.de>
|
||||
|
||||
* plug-ins/pygimp/gimpenumsmodule.c: Use GEnum objects rather then
|
||||
integer values for enums
|
||||
* plug-ins/pygimp/ pygimp-pdb.c:
|
||||
Added docstrings for the properties of a GimpPDBFunction object.
|
||||
(pygimp_pdb_function_new): Set the docstring of a GimpPDBFunction
|
||||
object to proc_help.
|
||||
When gimpenums is available set the type of the arguments to a
|
||||
GimpPDBArgType enum instead of a integer value.
|
||||
(pdb_getattro): Fix a bug where a pdb object returned a list of all pdb
|
||||
functions instead of the actual value for all properties starting with
|
||||
a underscore.
|
||||
|
||||
|
||||
2008-05-26 Lars-Peter Clausen <lars@metafoo.de>
|
||||
|
||||
Changed the 'gimp' module to folder with a __init__.py so that it is
|
||||
able to contain submodules. Renamed the C based 'gimp' module to
|
||||
'_gimp'.
|
||||
__init__.py imports all symbols from _gimp.
|
||||
|
||||
* plug-ins/pygimp/Makefile.am
|
||||
* plug-ins/pygimp/makefile.msc
|
||||
* plug-ins/pygimp/gimpmodule.c
|
||||
* plug-ins/pygimp/__init__.py
|
||||
|
||||
2008-05-24 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* HACKING: note that we need intltool 0.35.5 or newer.
|
||||
|
@@ -1990,6 +1990,7 @@ plug-ins/pagecurl/Makefile
|
||||
plug-ins/print/Makefile
|
||||
plug-ins/psd/Makefile
|
||||
plug-ins/pygimp/Makefile
|
||||
plug-ins/pygimp/doc/Makefile
|
||||
plug-ins/pygimp/plug-ins/Makefile
|
||||
plug-ins/script-fu/Makefile
|
||||
plug-ins/script-fu/ftx/Makefile
|
||||
|
@@ -223,8 +223,9 @@ gimp_browser_add_search_types (GimpBrowser *browser,
|
||||
else
|
||||
{
|
||||
gimp_int_combo_box_append (GIMP_INT_COMBO_BOX (browser->search_type_combo),
|
||||
first_type_label, first_type_id,
|
||||
NULL);
|
||||
GIMP_INT_STORE_LABEL, first_type_label,
|
||||
GIMP_INT_STORE_VALUE, first_type_id,
|
||||
-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -53,6 +53,12 @@ enum
|
||||
NUM_COLUMNS
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_TITLE,
|
||||
PROP_PATH
|
||||
};
|
||||
|
||||
static void gimp_path_editor_new_clicked (GtkWidget *widget,
|
||||
GimpPathEditor *editor);
|
||||
@@ -67,6 +73,14 @@ static void gimp_path_editor_selection_changed (GtkTreeSelection *sel,
|
||||
static void gimp_path_editor_writable_toggled (GtkCellRendererToggle *toggle,
|
||||
gchar *path_str,
|
||||
GimpPathEditor *editor);
|
||||
static void gimp_path_editor_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_path_editor_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpPathEditor, gimp_path_editor, GTK_TYPE_VBOX)
|
||||
@@ -79,6 +93,11 @@ static guint gimp_path_editor_signals[LAST_SIGNAL] = { 0 };
|
||||
static void
|
||||
gimp_path_editor_class_init (GimpPathEditorClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->set_property = gimp_path_editor_set_property;
|
||||
gobject_class->get_property = gimp_path_editor_get_property;
|
||||
|
||||
/**
|
||||
* GimpPathEditor::path-changed:
|
||||
*
|
||||
@@ -110,6 +129,17 @@ gimp_path_editor_class_init (GimpPathEditorClass *klass)
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_TITLE,
|
||||
g_param_spec_string ("title", NULL, NULL, "",
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_WRITABLE));
|
||||
g_object_class_install_property (gobject_class, PROP_PATH,
|
||||
g_param_spec_string ("path", NULL, NULL, "",
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT));
|
||||
|
||||
|
||||
klass->path_changed = NULL;
|
||||
klass->writable_changed = NULL;
|
||||
}
|
||||
@@ -252,26 +282,8 @@ GtkWidget *
|
||||
gimp_path_editor_new (const gchar *title,
|
||||
const gchar *path)
|
||||
{
|
||||
GimpPathEditor *editor;
|
||||
return g_object_new (GIMP_TYPE_PATH_EDITOR, "title", title, "path", path, NULL);
|
||||
|
||||
g_return_val_if_fail (title != NULL, NULL);
|
||||
|
||||
editor = g_object_new (GIMP_TYPE_PATH_EDITOR, NULL);
|
||||
|
||||
editor->file_entry = gimp_file_entry_new (title, "", TRUE, TRUE);
|
||||
gtk_widget_set_sensitive (editor->file_entry, FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (editor->upper_hbox), editor->file_entry,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (editor->file_entry);
|
||||
|
||||
g_signal_connect (editor->file_entry, "filename-changed",
|
||||
G_CALLBACK (gimp_path_editor_file_entry_changed),
|
||||
editor);
|
||||
|
||||
if (path)
|
||||
gimp_path_editor_set_path (editor, path);
|
||||
|
||||
return GTK_WIDGET (editor);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -827,3 +839,54 @@ gimp_path_editor_writable_toggled (GtkCellRendererToggle *toggle,
|
||||
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_path_editor_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpPathEditor *editor = GIMP_PATH_EDITOR (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_PATH:
|
||||
g_value_take_string (value, gimp_path_editor_get_path (editor));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_path_editor_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GimpPathEditor *editor = GIMP_PATH_EDITOR (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_TITLE:
|
||||
editor->file_entry = gimp_file_entry_new (g_value_get_string (value), "", TRUE, TRUE);
|
||||
gtk_widget_set_sensitive (editor->file_entry, FALSE);
|
||||
gtk_box_pack_start (GTK_BOX (editor->upper_hbox), editor->file_entry,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (editor->file_entry);
|
||||
|
||||
g_signal_connect (editor->file_entry, "filename-changed",
|
||||
G_CALLBACK (gimp_path_editor_file_entry_changed),
|
||||
editor);
|
||||
|
||||
break;
|
||||
case PROP_PATH:
|
||||
gimp_path_editor_set_path(editor, g_value_get_string (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@ libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la
|
||||
libgimpmath = $(top_builddir)/libgimpmath/libgimpmath-$(GIMP_API_VERSION).la
|
||||
libgimpthumb = $(top_builddir)/libgimpthumb/libgimpthumb-$(GIMP_API_VERSION).la
|
||||
|
||||
SUBDIRS = plug-ins
|
||||
SUBDIRS = plug-ins doc
|
||||
|
||||
if PLATFORM_WIN32
|
||||
no_undefined = -no-undefined
|
||||
@@ -25,11 +25,12 @@ INCLUDES = -I$(top_srcdir) $(PYTHON_INCLUDES) $(PYGTK_CFLAGS) $(GTK_CFLAGS)
|
||||
pygimpbase = python
|
||||
|
||||
pygimpdir = $(gimpplugindir)/$(pygimpbase)
|
||||
pygimpmoduledir = $(pygimpdir)/gimp
|
||||
|
||||
pygimp_LTLIBRARIES = gimp.la _gimpenums.la gimpcolor.la _gimpui.la \
|
||||
gimpthumb.la
|
||||
|
||||
gimp_la_SOURCES = \
|
||||
pygimpmodule_LTLIBRARIES = _gimp.la color.la thumb.la _ui.la _enums.la
|
||||
|
||||
_gimp_la_SOURCES = \
|
||||
gimpmodule.c \
|
||||
pygimp-display.c \
|
||||
pygimp-drawable.c \
|
||||
@@ -43,10 +44,10 @@ gimp_la_SOURCES = \
|
||||
pygimp-intl.h \
|
||||
pygimp-util.h
|
||||
|
||||
gimp_la_LDFLAGS = -module -avoid-version $(no_undefined) \
|
||||
-export-symbols-regex initgimp
|
||||
_gimp_la_LDFLAGS = -module -avoid-version $(no_undefined) \
|
||||
-export-symbols-regex init_gimp
|
||||
|
||||
gimp_la_LIBADD = \
|
||||
_gimp_la_LIBADD = \
|
||||
$(libgimp) \
|
||||
$(libgimpcolor) \
|
||||
$(libgimpbase) \
|
||||
@@ -54,13 +55,13 @@ gimp_la_LIBADD = \
|
||||
$(PYLINK_LIBS) \
|
||||
$(RT_LIBS)
|
||||
|
||||
_gimpenums_la_SOURCES = \
|
||||
_enums_la_SOURCES = \
|
||||
gimpenumsmodule.c
|
||||
|
||||
_gimpenums_la_LDFLAGS = -module -avoid-version $(no_undefined) \
|
||||
-export-symbols-regex init_gimpenums
|
||||
_enums_la_LDFLAGS = -module -avoid-version $(no_undefined) \
|
||||
-export-symbols-regex init_enums
|
||||
|
||||
_gimpenums_la_LIBADD = \
|
||||
_enums_la_LIBADD = \
|
||||
$(libgimp) \
|
||||
$(libgimpcolor) \
|
||||
$(libgimpbase) \
|
||||
@@ -68,28 +69,28 @@ _gimpenums_la_LIBADD = \
|
||||
$(PYLINK_LIBS) \
|
||||
$(RT_LIBS)
|
||||
|
||||
gimpcolor_la_SOURCES = \
|
||||
color_la_SOURCES = \
|
||||
gimpcolormodule.c \
|
||||
pygimp-colors.c \
|
||||
pygimpcolor.h \
|
||||
pygimpcolor-api.h
|
||||
|
||||
gimpcolor_la_LDFLAGS = -module -avoid-version $(no_undefined) \
|
||||
-export-symbols-regex initgimpcolor
|
||||
color_la_LDFLAGS = -module -avoid-version $(no_undefined) \
|
||||
-export-symbols-regex initcolor
|
||||
|
||||
gimpcolor_la_LIBADD = \
|
||||
color_la_LIBADD = \
|
||||
$(libgimpcolor) \
|
||||
$(GLIB_LIBS) \
|
||||
$(PYLINK_LIBS)
|
||||
|
||||
_gimpui_la_SOURCES = \
|
||||
_ui_la_SOURCES = \
|
||||
gimpuimodule.c \
|
||||
gimpui.c
|
||||
|
||||
_gimpui_la_LDFLAGS = -module -avoid-version $(no_undefined) \
|
||||
-export-symbols-regex init_gimpui
|
||||
_ui_la_LDFLAGS = -module -avoid-version $(no_undefined) \
|
||||
-export-symbols-regex init_ui
|
||||
|
||||
_gimpui_la_LIBADD = \
|
||||
_ui_la_LIBADD = \
|
||||
$(libgimpui) \
|
||||
$(libgimpwidgets) \
|
||||
$(libgimpconfig) \
|
||||
@@ -102,14 +103,14 @@ _gimpui_la_LIBADD = \
|
||||
$(RT_LIBS) \
|
||||
$(INTLLIBS)
|
||||
|
||||
gimpthumb_la_SOURCES = \
|
||||
thumb_la_SOURCES = \
|
||||
gimpthumbmodule.c \
|
||||
gimpthumb.c
|
||||
|
||||
gimpthumb_la_LDFLAGS = -module -avoid-version $(no_undefined) \
|
||||
-export-symbols-regex initgimpthumb
|
||||
thumb_la_LDFLAGS = -module -avoid-version $(no_undefined) \
|
||||
-export-symbols-regex initthumb
|
||||
|
||||
gimpthumb_la_LIBADD = \
|
||||
thumb_la_LIBADD = \
|
||||
$(libgimpthumb) \
|
||||
$(GDK_PIXBUF_LIBS) \
|
||||
$(PYLINK_LIBS)
|
||||
@@ -119,10 +120,21 @@ pygimp_PYTHON = \
|
||||
gimpfu.py \
|
||||
gimpplugin.py \
|
||||
gimpshelf.py \
|
||||
gimpui.py
|
||||
gimpui.py \
|
||||
gimpthumb.py \
|
||||
gimpcolor.py \
|
||||
gimpplugin2.py
|
||||
|
||||
pygimp_DATA = pygimp-logo.png
|
||||
|
||||
pygimpmodule_PYTHON = \
|
||||
__init__.py \
|
||||
context.py \
|
||||
ui.py \
|
||||
shelf.py \
|
||||
enums.py \
|
||||
tools.py
|
||||
|
||||
codegen_files = \
|
||||
gimpcolor-types.defs \
|
||||
gimpenums-types.defs \
|
||||
|
627
plug-ins/pygimp/__init__.py
Normal file
627
plug-ins/pygimp/__init__.py
Normal file
@@ -0,0 +1,627 @@
|
||||
# -*- Mode: Python; py-indent-offset: 4 -*-
|
||||
# Gimp-Python - allows the writing of Gimp plugins in Python.
|
||||
# Copyright (C) 2008 Lars-Peter Clausen <lars@metafoo.de>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
"""
|
||||
Initialisation file for pygimp module.
|
||||
"""
|
||||
|
||||
from _gimp import *
|
||||
from _gimp import _id2image, _id2drawable, _id2vectors, _id2display, _PyGimp_API
|
||||
|
||||
import enums
|
||||
import context
|
||||
import shelf
|
||||
try:
|
||||
import ui
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
def _prop(func):
|
||||
"""Helper function for creating properties"""
|
||||
return property(doc=func.__doc__, *func())
|
||||
|
||||
def _pack_pixels(pixel, bpp):
|
||||
"""Packs a tuple of pixel data into a tuple of bpp sized tuples"""
|
||||
return zip(*(iter(pixel),)*bpp)
|
||||
|
||||
class GimpNamedObject(object):
|
||||
"""
|
||||
GimpNamedObject is a bases class for wrappers around gimp objetcs.
|
||||
"""
|
||||
def __init__(self, name):
|
||||
"""Initailises a new GimpNamedObject.
|
||||
name - The actuall name of the object."""
|
||||
self._name = name
|
||||
|
||||
def __str__(self):
|
||||
"""The string representation of a GimpNamedObject is its name.
|
||||
That whay it can be passed to functions that exspect the name of a
|
||||
object."""
|
||||
return self._name
|
||||
|
||||
def __repr__(self):
|
||||
return "<gimp.%s '%s'>" % (self.__class__.__name__, str(self))
|
||||
|
||||
def rename(self, newname):
|
||||
"""Changes the name of the object."""
|
||||
self._name = newname
|
||||
|
||||
@classmethod
|
||||
def _id2obj(cls, name):
|
||||
"""Creates a new object for a existing gimp object with the name
|
||||
'name'."""
|
||||
try:
|
||||
obj = object.__new__(cls)
|
||||
obj._name = name
|
||||
return obj
|
||||
except:
|
||||
return None
|
||||
|
||||
|
||||
name = property(fget=lambda self:self._name)
|
||||
|
||||
def GimpNamedObjectMeta(rename_func = None, delete_func = None,
|
||||
duplicate_func = None):
|
||||
"""
|
||||
Returns a meta class that installs common functionality for GimpNamedObject
|
||||
derivatives.
|
||||
rename_func - Name of the pdb function that is used to rename the object
|
||||
delete_func - Name of the pdb function that is used to delete the object
|
||||
duplicate_func - Name of the pdb function that is used to duplicate the object
|
||||
"""
|
||||
|
||||
class Meta(type):
|
||||
def __new__(cls, name, bases, dict):
|
||||
if rename_func:
|
||||
dict['rename'] = lambda self, newname: GimpNamedObject.rename(
|
||||
self, pdb[rename_func](self, newname))
|
||||
|
||||
if duplicate_func != None:
|
||||
def duplicate(self, name = None):
|
||||
dup = self._id2obj(pdb[duplicate_func](self))
|
||||
if name != None:
|
||||
dup.rename(name)
|
||||
return dup
|
||||
dict['duplicate'] = duplicate
|
||||
|
||||
if delete_func != None:
|
||||
def delete(self):
|
||||
pdb[delete_func](self)
|
||||
self._name = ""
|
||||
dict['delete'] = delete
|
||||
|
||||
|
||||
return type.__new__(cls, name, bases, dict)
|
||||
|
||||
return Meta
|
||||
|
||||
class Brush(GimpNamedObject):
|
||||
"""A gimp brush."""
|
||||
|
||||
__metaclass__ = GimpNamedObjectMeta("gimp_brush_rename",
|
||||
"gimp_brush_delete", "gimp_brush_duplicate")
|
||||
|
||||
def __init__(self):
|
||||
raise NotImplemented("Can not create Brush instance")
|
||||
|
||||
def __new__(self, *args):
|
||||
obj = super(Brush, self).__new__(GeneratedBrush, *args)
|
||||
return obj
|
||||
|
||||
@classmethod
|
||||
def _id2obj(cls, name):
|
||||
"""Creates a new Brush object for a existing gimp brush with the name
|
||||
'name'. Returns either a gimp.Brush or a gimp.GeneratedBrush."""
|
||||
try:
|
||||
if pdb.gimp_brush_is_generated(name):
|
||||
brush = object.__new__(GeneratedBrush)
|
||||
else:
|
||||
brush = object.__new__(Brush)
|
||||
brush._name = name
|
||||
return brush
|
||||
except:
|
||||
return None
|
||||
|
||||
width = property(fget=lambda self:pdb.gimp_brush_get_info(self)[0],
|
||||
doc="""The brushes width in pixel.""")
|
||||
height = property(fget=lambda self:pdb.gimp_brush_get_info(self)[1],
|
||||
doc="""The brushes height in pixel.""")
|
||||
mask_bpp = property(fget=lambda self:pdb.gimp_brush_get_info(self)[2],
|
||||
doc="""The number of bits per pixel of the brushes mask
|
||||
property.""")
|
||||
mask = property(fget=lambda self:
|
||||
_pack_pixels(pdb.gimp_brush_get_pixels(self)[4], self.mask_bpp),
|
||||
doc="""The brushes mask. A height-tuple of width-tuples""")
|
||||
pixel_bpp = property(fget=lambda self:pdb.gimp_brush_get_info(self)[3],
|
||||
doc="""The number of bits per pixel of the brushes pixel
|
||||
property.""")
|
||||
pixel = property(fget=lambda self:
|
||||
_pack_pixels(pdb.gimp_brush_get_pixels(self)[7], self.pixel_bpp),
|
||||
doc="""The brushes pixel data. A height-tuple of
|
||||
width-tuples""")
|
||||
spacing = property(fget=lambda self:pdb.gimp_brush_get_spacing(self),
|
||||
fset=lambda self, val:pdb.gimp_brush_set_spacing(self, val),
|
||||
doc="""The brushes spacing. Valid values are 0 <= spacing <=
|
||||
1000.""")
|
||||
|
||||
editable = property(fget=lambda self:bool(pdb.gimp_brush_is_editable(self)),
|
||||
doc="""True if the brush is editable.""")
|
||||
|
||||
class GeneratedBrush(Brush):
|
||||
"""A gimp generated brush."""
|
||||
def __init__(self, name, angle = None, aspect_ratio = None, hardness = None,
|
||||
radius = None, shape = None, spikes = None):
|
||||
GimpNamedObject.__init__(self, pdb.gimp_brush_new(name))
|
||||
|
||||
# Set all passed attributes
|
||||
for arg, value in locals().items():
|
||||
if arg != "self" and arg != "name" and value != None:
|
||||
setattr(self, arg, value)
|
||||
|
||||
angle = property(fget=lambda self:pdb.gimp_brush_get_angle(self),
|
||||
fset=lambda self, val:pdb.gimp_brush_set_angle(self, val),
|
||||
doc="""The brushes rotation angle in degrees.""")
|
||||
aspect_ratio = property(
|
||||
fget=lambda self:pdb.gimp_brush_get_aspect_ratio(self),
|
||||
fset=lambda self,val:pdb.gimp_brush_set_aspect_ratio(self, val),
|
||||
doc="""The brushes aspect ratio.""")
|
||||
hardness = property(fget=lambda self:pdb.gimp_brush_get_hardness(self),
|
||||
fset=lambda self, val:pdb.gimp_brush_set_hardness(self, val),
|
||||
doc="""A floating point value containing the hardness of the
|
||||
brush.""")
|
||||
radius = property(fget=lambda self:pdb.gimp_brush_get_radius(self),
|
||||
fset=lambda self, val:pdb.gimp_brush_set_radius(self, val),
|
||||
doc="""A floating point value containing the radius of the
|
||||
brush.""")
|
||||
shape = property(fget=lambda self:enums.GimpBrushGeneratedShape(pdb.gimp_brush_get_shape(self)),
|
||||
fset=lambda self, val:pdb.gimp_brush_set_shape(self,
|
||||
int(val)),
|
||||
doc="""The brushes shape. Can be any of
|
||||
gimp.enums.GimpBrushGeneratedShape""")
|
||||
spikes = property(fget=lambda self:pdb.gimp_brush_get_spikes(self),
|
||||
fset=lambda self, val:pdb.gimp_brush_set_spikes(self, val),
|
||||
doc="""The number of spikes for the brush.""")
|
||||
|
||||
class Pattern(GimpNamedObject):
|
||||
"""A gimp Pattern object."""
|
||||
|
||||
def __init__(self, name):
|
||||
raise NotImplementedError("Can not create gimp.Palette instances")
|
||||
|
||||
width = property(fget=lambda self:pdb.gimp_pattern_get_info(self)[0],
|
||||
doc="""Width of the pattern in pixels""")
|
||||
height = property(fget=lambda self:pdb.gimp_pattern_get_info(self)[1],
|
||||
doc="""Height of the pattern in pixels""")
|
||||
pixel_bpp = property(fget=lambda self:pdb.gimp_pattern_get_info(self)[2],
|
||||
doc="""Bytes per pixel of the pixels attribute""")
|
||||
pixels = property(fget=lambda self:
|
||||
_pack_pixels(pdb.gimp_pattern_get_pixels(self)[4], self.pixel_bpp),
|
||||
doc="""A tupel containing the pixel values for the pattern. It length is
|
||||
bpp*widht*height.""")
|
||||
|
||||
class Palette(GimpNamedObject):
|
||||
"""A gimp Palette object. A Palette instance provides a list like interface
|
||||
to access the palette entries.
|
||||
Caution using gimp.pdb.gimp_palette_* functions paralell to gimp.Palette
|
||||
instances can cause data inconsistency."""
|
||||
|
||||
__metaclass__ = GimpNamedObjectMeta("gimp_palette_rename",
|
||||
"gimp_palette_delete", "gimp_palette_duplicate")
|
||||
|
||||
def __init__(self, name):
|
||||
"""Creates a new Palette
|
||||
name - The name for the palette"""
|
||||
GimpNamedObject.__init__(self, pdb.gimp_palette_new(name))
|
||||
|
||||
# Dictionary of PaletteEntry instances that are bound to this Palette.
|
||||
# The key is the index of the entry.
|
||||
self._bound_entries = {}
|
||||
|
||||
def __len__(self):
|
||||
"""Returns the number of entries in the palette"""
|
||||
return pdb.gimp_palette_get_info(self)
|
||||
|
||||
def __getitem__(self, key):
|
||||
if isinstance(key, int):
|
||||
if key < 0:
|
||||
key += self.__len__()
|
||||
if key < 0 or key >= self.__len__():
|
||||
raise IndexError("index out of range")
|
||||
|
||||
if self._bound_entries.has_key(key):
|
||||
return self._bound_entries[key]
|
||||
|
||||
entry = PaletteEntry(pdb.gimp_palette_entry_get_name(self,key),
|
||||
pdb.gimp_palette_entry_get_color(self, key))
|
||||
|
||||
# Bind entry to palette
|
||||
entry._bound_to.append((self, key))
|
||||
self._bound_entries[key] = entry
|
||||
|
||||
return entry
|
||||
|
||||
raise TypeError
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
if isinstance(key, int):
|
||||
if key < 0:
|
||||
key += self.__len__()
|
||||
if key < 0 or key >= self.__len__():
|
||||
raise IndexError("index out of range")
|
||||
|
||||
if isinstance(value, PaletteEntry):
|
||||
if self._bound_entries.has_key(key):
|
||||
self._bound_entries[key]._bound_to.remove((self, key))
|
||||
|
||||
# Bind entry to palette
|
||||
value._bound_to.append((self, key))
|
||||
self._bound_entries[key] = value
|
||||
|
||||
pdb.gimp_palette_entry_set_name(self, key, value.name)
|
||||
pdb.gimp_palette_entry_set_color(self, key, value.color)
|
||||
else:
|
||||
pdb.gimp_palette_entry_set_color(self, key, value)
|
||||
else:
|
||||
raise TypeError
|
||||
|
||||
def __delitem__(self, key):
|
||||
"""Removes palette entry with index 'key' from the palette"""
|
||||
if isinstance(self, key):
|
||||
if key < 0:
|
||||
key += self.__len__()
|
||||
if key < 0 or key >= self.__len__():
|
||||
raise IndexError("index out of range")
|
||||
|
||||
pdb.gimp_palette_delete_entry(self, key)
|
||||
if self._bound_entries.has_key(key):
|
||||
self._bound_entries[key]._bound_to.remove((self, key))
|
||||
del self._bound_entries[key]
|
||||
|
||||
# Decrease index of all folowing entries
|
||||
for index, entry in self._bound_entries.items():
|
||||
if index > key:
|
||||
entry._bound_to.remove((self, index))
|
||||
entry._bound_to.append((self, index-1))
|
||||
|
||||
del self._bound_entries[index]
|
||||
self._bound_entries[index-1] = entry
|
||||
else:
|
||||
raise TypeError
|
||||
|
||||
|
||||
def append(self, entry):
|
||||
"""Appends a entry to the palette.
|
||||
entry - A PaletteEntry instance."""
|
||||
pdb.gimp_palette_add_entry(self, entry.name, entry.color)
|
||||
index = self.__len__() - 1
|
||||
entry._bound_to.append((self, index))
|
||||
self._bound_entries[index] = entry
|
||||
|
||||
editable = property(fget=lambda self:bool(pdb.gimp_palette_is_editable(self)),
|
||||
doc="""True if the palette is editable.""")
|
||||
columns = property(fget=lambda self:pdb.gimp_palette_get_columns(self),
|
||||
fset=lambda self, val:pdb.gimp_palette_set_columns(self, val),
|
||||
doc="""Number of columes to use when the palette is
|
||||
being displayed.""")
|
||||
@classmethod
|
||||
def _id2obj(cls, name):
|
||||
obj = super(Palette, cls)._id2obj(name)
|
||||
obj._bound_entries = {}
|
||||
return obj
|
||||
|
||||
class PaletteEntry(object):
|
||||
"""A palette entry object."""
|
||||
def __init__(self, name, color):
|
||||
"""Creates a new palette entry.
|
||||
name - Name of the entry
|
||||
color - Color of the entry"""
|
||||
self.__name = name
|
||||
self.__color = color
|
||||
|
||||
# List of tuples to what Palettes a entry is bound. (palette, entry
|
||||
# index)
|
||||
self._bound_to = []
|
||||
|
||||
def __repr__(self):
|
||||
return "<gimp.PaletteEntry '%s - (%d, %d, %d)'>" % self.__name,
|
||||
self.__color[0], self.__color[1], self.__color[2]
|
||||
|
||||
def __set_name(self, name):
|
||||
self.__name = name
|
||||
for gradient, index in self._bound_to:
|
||||
pdb.gimp_palette_entry_set_name(gradient, index, name)
|
||||
|
||||
def __set_color(self, color):
|
||||
self.__color = color
|
||||
for gradient, index in self._bound_to:
|
||||
pdb.gimp_palette_entry_set_color(gradient, index, color)
|
||||
|
||||
name = property(fget=lambda self:self.__name, fset=__set_name,
|
||||
doc="""Name of the entry.""")
|
||||
color = property(fget=lambda self:self.__color, fset=__set_color,
|
||||
doc="""Color of the entry.""")
|
||||
|
||||
class Gradient(GimpNamedObject):
|
||||
"""A gimp Gradient object."""
|
||||
|
||||
__metaclass__ = GimpNamedObjectMeta("gimp_gradient_rename",
|
||||
"gimp_gradient_delete",
|
||||
"gimp_gradient_duplicate")
|
||||
|
||||
def __init__(self, name):
|
||||
"""Creates a new Gradient.
|
||||
name - The name for the gradient"""
|
||||
GimpNamedObject.__init__(self, pdb.gimp_gradient_new(name))
|
||||
|
||||
|
||||
def get_custom_samples(self, positions, reverse=False):
|
||||
"""Samples the gradient in custom positions.
|
||||
Returns a list of samples as gimp.color.RGB
|
||||
positions - A list of positions to sample along the gradient.
|
||||
reverse - Whether to use the reverse gradient or not."""
|
||||
|
||||
samples = pdb.gimp_gradient_get_custom_samples(self, len(positions),
|
||||
positions, reverse)[1]
|
||||
return map(color.RGB, *(iter(samples),)*4)
|
||||
|
||||
def get_uniform_samples(self, num_samples, reverse=False):
|
||||
"""Samples the specfied uniform parts.
|
||||
Returns a list of samples as gimp.color.RGB.
|
||||
num_samples - Number of samples to return. 2 <= num_samples.
|
||||
reverse - Whether to use the reverse gradient or not."""
|
||||
|
||||
samples = pdb.gimp_gradient_get_uniform_samples(self, num_samples,
|
||||
reverse)[1]
|
||||
return map(color.RGB, *(iter(samples),)*4)
|
||||
|
||||
segments = property(
|
||||
fget=lambda self: GradientSegmentRange(self, 0, -1),
|
||||
fdel=lambda self:pdb.gimp_gradient_segment_range_delete(self, 0, -1),
|
||||
doc="""A gimp.GradientSegmentRange used to access the segemnts of the
|
||||
gradient.""")
|
||||
editable = property(
|
||||
fget=lambda self: pdb.gimp_gradient_is_editable(self) == 1,
|
||||
doc="""True if the segment is editable, otherwise False.""")
|
||||
|
||||
class GradientSegment(object):
|
||||
|
||||
def __init__(self, gradient, index):
|
||||
self.gradient = gradient
|
||||
self.index = index
|
||||
|
||||
def __repr__(self):
|
||||
return "<gimp.GradientSegment (%s, %d)>" % (str(self.gradient),
|
||||
self.index)
|
||||
@_prop
|
||||
def blending_function():
|
||||
"""The segments blending function.
|
||||
A enum value of gimp.enums.GimpGradientSegmentType."""
|
||||
def get(self):
|
||||
return enums.GimpGradientSegmentType(
|
||||
pdb.gimp_gradient_segment_get_blending_function(
|
||||
self.gradient, self.index))
|
||||
def set(self, value):
|
||||
pdb.gimp_gradient_segment_range_set_blending_function(self.gradient,
|
||||
self.index, self.index, value)
|
||||
return (get,set)
|
||||
|
||||
@_prop
|
||||
def coloring_type():
|
||||
"""The segments coloring type.
|
||||
A enum value of gimp.enums.GimpGradientSegmentColor"""
|
||||
def get(self):
|
||||
return enums.GimpGradientSegmentColor(
|
||||
pdb.gimp_gradient_segment_get_coloring_type(self.gradient,
|
||||
self.index))
|
||||
def set(self, value):
|
||||
pdb.gimp_gradient_segment_range_set_coloring_type(self.gradient,
|
||||
self.index, self.index, value)
|
||||
return (get,set)
|
||||
|
||||
def get_left_color(self):
|
||||
return pdb.gimp_gradient_segment_get_left_color(self.gradient,
|
||||
self.index)[0]
|
||||
def set_left_color(self, color):
|
||||
# Get opacity from color
|
||||
if hasattr(color, "a"):
|
||||
opacity = color.a
|
||||
elif len(color) < 4:
|
||||
opacity = 100
|
||||
elif isinstance(color[3], float):
|
||||
opacity = int(color[3] * 100)
|
||||
else:
|
||||
opacity = int(int(color[3]) / 2.55)
|
||||
opacity = min(max(opacity, 0), 100)
|
||||
pdb.gimp_gradient_segment_set_left_color(self.gradient, self.index,
|
||||
color, opacity)
|
||||
def get_right_color(self):
|
||||
return pdb.gimp_gradient_segment_get_right_color(self.gradient,
|
||||
self.index)[0]
|
||||
def set_right_color(self, color):
|
||||
# Get opacity from color
|
||||
if hasattr(color, "a"):
|
||||
opacity = color.a
|
||||
elif len(color) < 4:
|
||||
opacity = 100
|
||||
elif isinstance(color[3], float):
|
||||
opacity = int(color[3] * 100)
|
||||
else:
|
||||
opacity = int(int(color[3]) / 2.55)
|
||||
opacity = min(max(opacity, 0), 100)
|
||||
pdb.gimp_gradient_segment_set_right_color(self.gradient, self.index,
|
||||
color, opacity)
|
||||
@_prop
|
||||
def left_pos():
|
||||
"""The left endpoint position of the segment."""
|
||||
def get(self):
|
||||
return pdb.gimp_gradient_segment_get_left_pos(self.gradient,
|
||||
self.index)
|
||||
def set(self, value):
|
||||
pdb.gimp_gradient_segment_set_left_pos(self.gradient, self.index,
|
||||
min(max(value), 0.0, 1.0))
|
||||
return (get, set)
|
||||
|
||||
@_prop
|
||||
def middle_pos():
|
||||
"""The middle point position of the segment."""
|
||||
def get(self):
|
||||
return pdb.gimp_gradient_segment_get_middle_pos(self.gradient,
|
||||
self.index)
|
||||
def set(self, value):
|
||||
pdb.gimp_gradient_segment_set_middle_pos(self.gradient, self.index,
|
||||
min(max(value, 0.0), 1.0))
|
||||
return (get, set)
|
||||
|
||||
@_prop
|
||||
def right_pos():
|
||||
"""The right endpoint position of the segment."""
|
||||
def get(self):
|
||||
return pdb.gimp_gradient_segment_get_right_pos(self.gradient,
|
||||
self.index)
|
||||
def set(self, value):
|
||||
pdb.gimp_gradient_segment_set_right_pos(self.gradient, self.index,
|
||||
min(max(value, 0.0), 1.0))
|
||||
return (get, set)
|
||||
|
||||
class GradientSegmentRange(object):
|
||||
|
||||
def __init__(self, gradient, start, end):
|
||||
self.gradient = gradient
|
||||
self.start = start
|
||||
self.end = end
|
||||
|
||||
def __repr__(self):
|
||||
end = self.end + 1
|
||||
if end < 0:
|
||||
end = pdb.gimp_gradient_get_number_of_segments(self.gradient)
|
||||
return "<gimp.GradientSegmentRange (%s, %d, %d)>"% (str(self.gradient),
|
||||
self.start, end)
|
||||
|
||||
def __len__(self):
|
||||
if self.end < 0:
|
||||
return pdb.gimp_gradient_get_number_of_segments(self.gradient) - self.start
|
||||
return self.end - self.start + 1
|
||||
|
||||
def __getitem__(self, key):
|
||||
if isinstance(key, slice):
|
||||
start, end, step = key.indices(len(self))
|
||||
if step != 1:
|
||||
raise IndexError
|
||||
if start > end:
|
||||
start = end
|
||||
return GradientSegmentRange(self.gradient, start+self.start,
|
||||
end+self.start-1)
|
||||
elif isinstance(key, int):
|
||||
if key < 0:
|
||||
key += len(self)
|
||||
if key < 0 or key >= len(self):
|
||||
raise IndexError("index out of range")
|
||||
|
||||
return GradientSegment(self.gradient, self.start + key)
|
||||
else:
|
||||
raise TypeError
|
||||
|
||||
def __delitem__(self, key):
|
||||
# A gradient has at least one segment
|
||||
if len(self.gradient) == 1:
|
||||
return
|
||||
if isinstance(key, slice):
|
||||
start, end, step = key.indices(len(self))
|
||||
if step != 1:
|
||||
raise IndexError
|
||||
if start > end:
|
||||
start = end
|
||||
elif isinstance(key, int):
|
||||
if key < 0:
|
||||
key += len(self)
|
||||
if key < 0 or key >= len(self):
|
||||
raise IndexError("index out of range")
|
||||
start = key
|
||||
end = start + 1
|
||||
else:
|
||||
raise TypeError
|
||||
# A gradient has at leat one segment. Trying to delete all fails.
|
||||
if start == 0 and end == len(self.gradient):
|
||||
start = 1
|
||||
pdb.gimp_gradient_segment_range_delete(self.gradient,
|
||||
self.start + start, self.start + end - 1)
|
||||
|
||||
def blend_colors(self):
|
||||
"""Blends the colors (but not the opacity) of the segment range. Using
|
||||
it, the colors' transition will be uniform across the range."""
|
||||
return pdb.gimp_gradient_segment_range_blend_colors(self.gradient,
|
||||
self.start, self.end)
|
||||
|
||||
def blend_opacity(self):
|
||||
"""Blends the opacity (but not the colors) of the segment range. Using
|
||||
it, the opacity's transition will be uniform across the range."""
|
||||
return pdb.gimp_gradient_segment_range_blend_opacity(self.gradient,
|
||||
self.start, self.end)
|
||||
|
||||
def flip(self):
|
||||
"""Flips the segment range."""
|
||||
return pdb.gimp_gradient_segment_range_flip(self.gradient, self.start,
|
||||
self.end)
|
||||
|
||||
def move(self, offset, compress_neighbors = True):
|
||||
"""Move the position of an entire segment range.
|
||||
offset - The offset to move the segment range (-1 <= delta <= 1)
|
||||
compress_neighbores - Whether or not to compress the neighboring
|
||||
segments."""
|
||||
return pdb.gimp_gradient_segment_range_move(self.gradient, self.start,
|
||||
self.end, offset, compress_neighbors)
|
||||
|
||||
def redistribute_handles(self):
|
||||
"""Uniformly redistribute the segment range's handles."""
|
||||
return pdb.gimp_gradient_segment_range_redistribute_handles(
|
||||
self.gradient, self.start, self.end)
|
||||
|
||||
def replicate(self, num_replications):
|
||||
"""Replicates the segment range.
|
||||
num_replications - The number of replications (2 <= num_replications
|
||||
<= 20)"""
|
||||
return pdb.gimp_gradient_segment_range_replicate(self.gradient,
|
||||
self.start, self.end, num_replications)
|
||||
|
||||
def set_blending_function(self, blending_function):
|
||||
"""Sets the blending function for each segment in the segment range.
|
||||
blending_function - A enum value of
|
||||
gimp.enums.GimpGradientSegmentType."""
|
||||
return pdb.gimp_gradient_segment_range_set_blending_function(
|
||||
self.gradient, self.start, self.end, blending_function)
|
||||
|
||||
def set_coloring_type(self, coloring_type):
|
||||
"""Sets the coloring type for each segment in the segment range.
|
||||
coloring_type - A enum value of gimp.enums.GimpGradientSegmentColor.
|
||||
"""
|
||||
return pdb.gimp_gradient_segment_range_set_coloring_type(self.gradient,
|
||||
self.start, self.end, coloring_type)
|
||||
|
||||
def split_midpoint(self):
|
||||
"""Splits each segment in the segment range at the segment midpoint."""
|
||||
return pdb.gimp_gradient_segment_range_split_midpoint(self.gradient,
|
||||
self.start, self.end)
|
||||
|
||||
def split_uniform(self, num_splits = 1):
|
||||
"""Splits each segment in the segment range uniformly.
|
||||
num_splits - Number of splits per segment."""
|
||||
return pdb.gimp_gradient_segment_range_split_uniform(self.gradient,
|
||||
self.start, self.end, num_splits)
|
||||
|
||||
|
210
plug-ins/pygimp/context.py
Normal file
210
plug-ins/pygimp/context.py
Normal file
@@ -0,0 +1,210 @@
|
||||
# *- Mode: Python; py-indent-offset: 4 -*-
|
||||
# Gimp-Python - allows the writing of Gimp plugins in Python.
|
||||
# Copyright (C) 2008 Lars-Peter Clausen <lars@metafoo.de>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
"""
|
||||
This module provides functions for retriving and manipulating the status of the
|
||||
current GIMP context.
|
||||
"""
|
||||
|
||||
from gimp import pdb as _pdb
|
||||
|
||||
def get_background():
|
||||
"""
|
||||
Returns the current background color. The background color is used in a
|
||||
variety of tools such as blending, erasing (with non-alpha images), and
|
||||
image filling.
|
||||
"""
|
||||
return _pdb.gimp_context_get_background()
|
||||
|
||||
def get_brush():
|
||||
"""
|
||||
Returns a gimp.Brush instance for the active brush. All paint operations
|
||||
and stroke operations use this brush to control the application of paint to
|
||||
the image.
|
||||
"""
|
||||
from gimp import Brush
|
||||
return Brush._id2obj(_pdb.gimp_context_get_brush())
|
||||
|
||||
def get_font():
|
||||
"""
|
||||
Returns a sting containing the name of the active font.
|
||||
"""
|
||||
return _pdb.gimp_context_get_font()
|
||||
|
||||
def get_foreground():
|
||||
"""
|
||||
Returns the current foreground color. The foregroung color is used in a
|
||||
variety of tools such as paint tools, blending, and bucket fill.
|
||||
"""
|
||||
return _pdb.gimp_context_get_foreground()
|
||||
|
||||
def get_gradient():
|
||||
"""
|
||||
Returns a gimp.Gradient instance for the active gradient.
|
||||
"""
|
||||
from gimp import Gradient
|
||||
return Gradient._id2obj(_pdb.gimp_context_get_gradient())
|
||||
|
||||
def get_opacity():
|
||||
"""
|
||||
Returns the opacity setting. The return value is a floating
|
||||
point number between 0 and 100.
|
||||
"""
|
||||
return _pdb.gimp_context_get_opacity()
|
||||
|
||||
def get_paint_method():
|
||||
"""
|
||||
Returns the name of the active paint method.
|
||||
"""
|
||||
return _pdb.gimp_context_get_paint_method()
|
||||
|
||||
def get_paint_mode():
|
||||
"""
|
||||
Returns a enum value of gimp.enums.GimpLayerModeEffects for the active paint
|
||||
mode.
|
||||
"""
|
||||
from gimp.enums import GimpLayerModeEffects
|
||||
return GimpLayerModeEffects(_pdb.gimp_context_get_paint_mode())
|
||||
|
||||
def get_palette():
|
||||
"""
|
||||
Returns a gimp.Palette instance for the active Palette.
|
||||
"""
|
||||
from gimp import Palette
|
||||
return Palette._id2obj(_pdb.gimp_context_get_palette())
|
||||
|
||||
def get_pattern():
|
||||
"""
|
||||
Returns a gimp.Pattern instance for the active Pattern.
|
||||
"""
|
||||
from gimp import Pattern
|
||||
return Pattern._id2obj(_pdb.gimp_context_get_pattern())
|
||||
|
||||
def list_paint_methods():
|
||||
"""
|
||||
Returns a tuple of available paint methods. Any of those can be used for
|
||||
'set_paint_method'.
|
||||
"""
|
||||
return _pdb.gimp_context_list_paint_methods()[1]
|
||||
|
||||
def pop():
|
||||
"""
|
||||
Removes the topmost context from the plug-in's context stack. The context
|
||||
that was active before the corresponding call to 'push' becomes the new
|
||||
current context of the plug-in.
|
||||
"""
|
||||
return _pdb.gimp_context_pop()
|
||||
|
||||
def push():
|
||||
"""
|
||||
Creates a new context by copying the current context. This copy becomes the
|
||||
new context for the calling plug-in until it is popped again using 'pop'.
|
||||
"""
|
||||
return _pdb.gimp_context_push()
|
||||
|
||||
def set_background(color):
|
||||
"""
|
||||
Sets the current background color. The background color is used in a
|
||||
variety of tools suchs as blending, erasing (with non-alpha images), and
|
||||
image filling.
|
||||
color - A valid color instance ot a 3-tuple containing RGB values.
|
||||
"""
|
||||
_pdb.gimp_context_set_background(color)
|
||||
|
||||
def set_brush(brush):
|
||||
"""
|
||||
Sets the active brush.
|
||||
brush - Either a instance of gimp.Brush or a string containing the name of
|
||||
a valid brush.
|
||||
"""
|
||||
_pdb.gimp_context_set_brush(brush)
|
||||
|
||||
def set_default_colors():
|
||||
"""
|
||||
Sets the foreground and background colors to black and white.
|
||||
"""
|
||||
_pdb.gimp_context_set_default_colors()
|
||||
|
||||
def set_font(font):
|
||||
"""
|
||||
Sets the active font.
|
||||
font - A String containing the name of a valid font.
|
||||
"""
|
||||
_pdb.gimp_context_set_font(font)
|
||||
|
||||
def set_foreground(color):
|
||||
"""
|
||||
Sets the active foreground color.
|
||||
color - A valid color instance or a 3-tuple containg RGB values.
|
||||
"""
|
||||
_pdb.gimp_context_set_foreground(color)
|
||||
|
||||
def set_gradient(gradient):
|
||||
"""
|
||||
Sets the active gradient.
|
||||
gradient - Either a instance of gimp.Gradient or a string containing the name
|
||||
of a valid gradient.
|
||||
"""
|
||||
_pdb.gimp_context_set_gradient(gradient)
|
||||
|
||||
def set_opacity(opacity):
|
||||
"""
|
||||
Changes the opacity setting.
|
||||
opacity - A floating point value between 0.0 and 100.0.
|
||||
"""
|
||||
_pdb.gimp_context_set_opacity(opacity)
|
||||
|
||||
def set_paint_method(paint_method):
|
||||
"""
|
||||
Sets active paint method.
|
||||
paint_method - The name of a valid painnt method. For valid values see
|
||||
'list_paint_methods'.
|
||||
"""
|
||||
_pdb.gimp_context_set_paint_method(paint_method)
|
||||
|
||||
def set_paint_mode(paint_mode):
|
||||
"""
|
||||
Sets active paint mode.
|
||||
paint_mode - A enum value of gimp.enums.GimpLayerModeEffects.
|
||||
"""
|
||||
_pdb.gimp_context_set_paint_mode(paint_mode)
|
||||
|
||||
def set_palette(palette):
|
||||
"""
|
||||
Sets the active palette.
|
||||
palette - Either a instance of gimp.Palette or a string containing the name
|
||||
of a valid gradient.
|
||||
"""
|
||||
_pdb.gimp_context_set_palette(palette)
|
||||
|
||||
def set_pattern(pattern):
|
||||
"""
|
||||
Sets the active pattern.
|
||||
pattern - Either a instance of gimp.Pattern or a string containing the name
|
||||
of a valid pattern.
|
||||
"""
|
||||
_pdb.gimp_context_set_pattern(pattern)
|
||||
|
||||
def swap_colors():
|
||||
"""
|
||||
Swaps the current foreground and background colors, so that the new
|
||||
foreground color becomes the old background color and vice versa.
|
||||
"""
|
||||
_pdb.gimp_context_swap_colors()
|
||||
|
@@ -1,32 +1,92 @@
|
||||
REF_VERSION = 1.1
|
||||
FULL_VERSION = $(REF_VERSION).1
|
||||
|
||||
noinst_DATA = pygimp.html
|
||||
CSS_FILES = style.css
|
||||
|
||||
EXTRA_DIST = \
|
||||
pygimp.sgml \
|
||||
pygimp.html \
|
||||
structure-of-plugin.html \
|
||||
procedural-database.html \
|
||||
gimp-module-procedures.html \
|
||||
gimp-objects.html \
|
||||
support-modules.html \
|
||||
end-note.html
|
||||
|
||||
printed: pygimp.ps pygimp.pdf
|
||||
|
||||
#clean:
|
||||
# rm -f *.html pygimp.ps pygimp.pdf
|
||||
HTML_FILES = \
|
||||
html/class-drawable.html \
|
||||
html/class-layer.html \
|
||||
html/class-channel.html \
|
||||
html/class-image.html \
|
||||
html/class-pixel-rgn.html \
|
||||
html/class-pixel-fetcher.html \
|
||||
html/class-parasite.html \
|
||||
html/index.html \
|
||||
html/index.sgml
|
||||
|
||||
|
||||
pygimp.ps: pygimp.sgml
|
||||
db2ps $(srcdir)/pygimp.sgml
|
||||
XML_FILES = \
|
||||
reference/pygimp-drawable.xml \
|
||||
reference/pygimp-channel.xml \
|
||||
reference/pygimp-image.xml \
|
||||
reference/pygimp-layer.xml \
|
||||
reference/pygimp-pixel-rgn.xml \
|
||||
reference/pygimp-pixel-fetcher.xml
|
||||
reference/pygimp-parasite.xml
|
||||
|
||||
pygimp.pdf: pygimp.sgml
|
||||
db2pdf $(srcdir)/pygimp.sgml
|
||||
XSL_FILES = \
|
||||
xsl/common.xsl \
|
||||
xsl/devhelp.xsl \
|
||||
xsl/html.xsl \
|
||||
xsl/pdf-style.xsl \
|
||||
xsl/pdf.xsl \
|
||||
xsl/ref-html-style.xsl
|
||||
|
||||
pygimp.html: pygimp.sgml
|
||||
cd $(srcdir) && db2html --nochunks pygimp.sgml
|
||||
cd $(srcdir) && mv pygimp/*.html .
|
||||
rm -rf $(srcdir)/pygimp
|
||||
# fixxref cannot be included in XSL_FILES, because automake is touching it
|
||||
# so the date is newer then the files in HTML_FILES
|
||||
FIXXREF = xsl/fixxref.py
|
||||
|
||||
.PHONY: printed #clean
|
||||
TARGET_DIR = $(datadir)/gtk-doc/html/pygimp
|
||||
CSSdir = $(TARGET_DIR)
|
||||
CSS_DATA = html/$(CSS_FILES)
|
||||
|
||||
|
||||
install-data-local:
|
||||
installfiles=`echo $(srcdir)/html/*`; \
|
||||
if test "$$installfiles" = '$(srcdir)/html/*'; \
|
||||
then echo '-- Nothing to install' ; \
|
||||
else \
|
||||
$(mkinstalldirs) $(DESTDIR)$(TARGET_DIR); \
|
||||
for i in $$installfiles; do \
|
||||
echo '-- Installing '$$i ; \
|
||||
$(INSTALL_DATA) $$i $(DESTDIR)$(TARGET_DIR); \
|
||||
done; \
|
||||
echo '-- Installing $(srcdir)/html/index.sgml' ; \
|
||||
$(INSTALL_DATA) $(srcdir)/html/index.sgml $(DESTDIR)$(TARGET_DIR) || :; \
|
||||
fi
|
||||
|
||||
uninstall-local:
|
||||
rm -f $(DESTDIR)$(TARGET_DIR)/*
|
||||
|
||||
|
||||
XSLdir = $(datadir)/pygimp/xsl
|
||||
XSL_DATA = $(XSL_FILES) $(FIXXREF)
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(HTML_FILES) \
|
||||
$(XML_FILES) \
|
||||
$(XSL_FILES) \
|
||||
$(FIXXREF) \
|
||||
$(CSS_FILES)
|
||||
|
||||
reference/builddate.xml:
|
||||
@$(PYTHON) -c 'import datetime; print datetime.date.today()' > $@
|
||||
|
||||
|
||||
|
||||
BUILT_SOURCES = reference/builddate.xml $(HTML_FILES)
|
||||
CLEANFILES = reference/builddate.xml $(HTML_FILES)
|
||||
|
||||
|
||||
# Do not add a builddate.xml dependency here, because the generated html
|
||||
# documentation will be included in the tarball so xsltproc is not needed to
|
||||
# install the documentation. Adding a builddate.xml dependency will force
|
||||
# the documentation to be rebuilt when it doesn't need to be.
|
||||
$(HTML_FILES): $(XML_FILES) $(XSL_FILES)
|
||||
@xsltproc --nonet --xinclude -o ./html/ \
|
||||
--path $(BUILDDIR)/reference:$(srcdir)/reference \
|
||||
--stringparam gtkdoc.bookname "pygimp" \
|
||||
--stringparam gtkdoc.version ${REF_VERSION} \
|
||||
$(srcdir)/xsl/ref-html-style.xsl \
|
||||
$(srcdir)/reference/pygimp-ref.xml
|
||||
|
||||
|
0
plug-ins/pygimp/doc/html/style.css
Normal file
0
plug-ins/pygimp/doc/html/style.css
Normal file
1
plug-ins/pygimp/doc/reference/entities.docbook
Normal file
1
plug-ins/pygimp/doc/reference/entities.docbook
Normal file
@@ -0,0 +1 @@
|
||||
<!ENTITY version "2.15.0">
|
1
plug-ins/pygimp/doc/reference/entities.docbook.in
Normal file
1
plug-ins/pygimp/doc/reference/entities.docbook.in
Normal file
@@ -0,0 +1 @@
|
||||
<!ENTITY version "@PACKAGE_VERSION@">
|
199
plug-ins/pygimp/doc/reference/pygimp-channel.xml
Normal file
199
plug-ins/pygimp/doc/reference/pygimp-channel.xml
Normal file
@@ -0,0 +1,199 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
|
||||
<refentry id="class-channel">
|
||||
<refmeta>
|
||||
<refentrytitle>gimp.Channel</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo>PyGimp Docs</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gimp.Channel</refname>
|
||||
<refpurpose>Channel objects represent a Gimp Image's color channels.</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 id="synopsis-channel">
|
||||
<title>Synopsis</title>
|
||||
|
||||
<classsynopsis language="python">
|
||||
<ooclass><classname>gimp.Channel</classname></ooclass>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-channel--copy">copy</link></methodname>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-channel--combine-masks">combine_mask</link></methodname>
|
||||
<methodparam><parameter>channel</parameter></methodparam>
|
||||
<methodparam><parameter>operation</parameter></methodparam>
|
||||
<methodparam><parameter>offset_x</parameter></methodparam>
|
||||
<methodparam><parameter>offset_y</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id="ancestry-channel">
|
||||
<title>Ancestry</title>
|
||||
<synopsis>
|
||||
+-- <link linkend="class-drawable">gimp.Drawable</link>
|
||||
</synopsis>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id="attributes-channel">
|
||||
<title>Attributes</title>
|
||||
<para><link linkend="attributes-drawable">gimp.Channel Attributes</link></para>
|
||||
|
||||
<blockquote role="properties">
|
||||
<informaltable pgwide="1" frame="none">
|
||||
<tgroup cols="3">
|
||||
<colspec column="1" colwidth="1in"/>
|
||||
<colspec column="2" colwidth="1in"/>
|
||||
<colspec column="3" colwidth="4in"/>
|
||||
<tbody>
|
||||
<row valign="top">
|
||||
<entry>"color"</entry>
|
||||
<entry>Read/Write</entry>
|
||||
<entry>
|
||||
<para>The channel's compositing color.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"opacity"</entry>
|
||||
<entry>Read/Write</entry>
|
||||
<entry>
|
||||
<para>The channel's opacity.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"show_masked"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>The channel's composite method. If it <literal>True</literal>, then the channel is composited with the image so that masked regions are shown. Otherwise, selected regions are shown.</para>
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</blockquote>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id="description-channel">
|
||||
<title>Description</title>
|
||||
<para>Channel objects represent a Gimp Image's color channels.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id="constructor-channel">
|
||||
<title>Constructor</title>
|
||||
<programlisting><constructorsynopsis language="python">
|
||||
<methodname>gimp.Channel</methodname>
|
||||
<methodparam><parameter>image</parameter></methodparam>
|
||||
<methodparam><parameter>name</parameter></methodparam>
|
||||
<methodparam><parameter>width</parameter></methodparam>
|
||||
<methodparam><parameter>height</parameter></methodparam>
|
||||
<methodparam><parameter>type</parameter></methodparam>
|
||||
<methodparam><parameter>opacity</parameter></methodparam>
|
||||
<methodparam><parameter>color</parameter></methodparam>
|
||||
</constructorsynopsis></programlisting>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>image</parameter> :</term>
|
||||
<listitem><simpara>The image to which to add the channel.</simpara></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>name</parameter> :</term>
|
||||
<listitem><simpara>The channel's name.</simpara></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>width</parameter> :</term>
|
||||
<listitem><simpara>The channel's width.</simpara></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>height</parameter> :</term>
|
||||
<listitem><simpara>The channel's height.</simpara></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>type</parameter> :</term>
|
||||
<listitem><simpara>The channel's type.</simpara></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>opacity</parameter> :</term>
|
||||
<listitem><simpara>The channel's opacity.</simpara></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>color</parameter> :</term>
|
||||
<listitem><simpara>The channel's compositing color.</simpara></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis>Returns</emphasis> :</term>
|
||||
<listitem><simpara>A new gimp.Channel object.</simpara></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Creats a new channel object</para>
|
||||
<para>Creates a new channel with the specified width and height. Name, opacity, and color are also supplied parameters. The new channel still needs to be added to the image, as this is not automatic. Add the new channel with the <link linkend="gimp-image--add-channel">gimp.Image.add_channel</link> command. Other attributes such as channel show masked, should be set with explicitly. The channel's contents are undefined initially.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id="methods-channel">
|
||||
<title>Methods</title>
|
||||
|
||||
<refsect2 id="method-channel--copy">
|
||||
<title>gimp.Channel.copy</title>
|
||||
<programlisting><methodsynopsis language="python">
|
||||
<methodname>copy</methodname>
|
||||
</methodsynopsis></programlisting>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><emphasis>Returns</emphasis> :</term>
|
||||
<listitem><simpara>A newly created gimp.Channel which is a copy of this channel.</simpara></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Copys the channel.</para>
|
||||
<para>This procedure copies the channel and returns the copy.</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="method-channel--combine-masks">
|
||||
<title>gimp.Channel.combine_masks</title>
|
||||
<programlisting><methodsynopsis language="python">
|
||||
<methodname>combine_masks</methodname>
|
||||
<methodparam>channel</methodparam>
|
||||
<methodparam>operation</methodparam>
|
||||
<methodparam>offset_x</methodparam>
|
||||
<methodparam>offset_y</methodparam>
|
||||
</methodsynopsis></programlisting>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>channel</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>The channel to be combined with.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>operation</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>The selection operation. One of <link linkend="gimp-enums-gimp-chanel-ops">gimp.enums.GimpChannelOps</link></simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>offset_x</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>The x offset between upper left corner of this channel and the one combined with.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>offset_y</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>The y offset between upper left corner of this channel and the one combined with.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis>Returns</emphasis> :</term>
|
||||
<listitem><simpara>A newly created gimp.Channel.</simpara></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Combines two channel masks.</para>
|
||||
<para>This method combines <parameter>channel</parameter> with this channel using <parameter>operation</parameter>. The result is stored in this channel.</para>
|
||||
</refsect2>
|
||||
|
||||
</refsect1>
|
||||
</refentry>
|
18
plug-ins/pygimp/doc/reference/pygimp-classes.xml
Normal file
18
plug-ins/pygimp/doc/reference/pygimp-classes.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
|
||||
<chapter id="pygimp-class-reference"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
|
||||
<title>The PyGimp Class Reference</title>
|
||||
|
||||
<xi:include href="pygimp.xml"/>
|
||||
<xi:include href="pygimp-channel.xml"/>
|
||||
<xi:include href="pygimp-drawable.xml"/>
|
||||
<xi:include href="pygimp-image.xml"/>
|
||||
<xi:include href="pygimp-layer.xml"/>
|
||||
<xi:include href="pygimp-parasite.xml"/>
|
||||
<xi:include href="pygimp-pixel-rgn.xml"/>
|
||||
<xi:include href="pygimp-pixel-fetcher.xml"/>
|
||||
|
||||
</chapter>
|
512
plug-ins/pygimp/doc/reference/pygimp-drawable.xml
Normal file
512
plug-ins/pygimp/doc/reference/pygimp-drawable.xml
Normal file
@@ -0,0 +1,512 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
|
||||
<refentry id="class-drawable">
|
||||
<refmeta>
|
||||
<refentrytitle>gimp.Drawable</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo>PyGimp Docs</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gimp.Drawable</refname>
|
||||
<refpurpose></refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1>
|
||||
<title>Synopsis</title>
|
||||
|
||||
<classsynopsis language="python">
|
||||
<ooclass><classname>gimp.Drawable</classname></ooclass>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-drawable--attach-new-parasite">attach_new_parasite</link></methodname>
|
||||
<methodparam><parameter>parasite</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-drawable--fill">fill</link></methodname>
|
||||
<methodparam><parameter>fill_mode</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-drawable--flush">flush</link></methodname>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-drawable--get-pixel">get_pixel</link></methodname>
|
||||
<methodparam><parameter>x</parameter></methodparam>
|
||||
<methodparam><parameter>y</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-drawable--get-pixel-rgn">get_pixel_rgn</link></methodname>
|
||||
<methodparam><parameter>x</parameter></methodparam>
|
||||
<methodparam><parameter>y</parameter></methodparam>
|
||||
<methodparam><parameter>width</parameter></methodparam>
|
||||
<methodparam><parameter>height</parameter></methodparam>
|
||||
<methodparam><parameter>dirty</parameter><initializer>True</initializer></methodparam>
|
||||
<methodparam><parameter>shadow</parameter><initializer>False</initializer></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-drawable--get-tile">get_tile</link></methodname>
|
||||
<methodparam><parameter>shadow</parameter></methodparam>
|
||||
<methodparam><parameter>row</parameter></methodparam>
|
||||
<methodparam><parameter>colum</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-drawable--get-tile2">get_tile2</link></methodname>
|
||||
<methodparam><parameter>shadow</parameter></methodparam>
|
||||
<methodparam><parameter>x</parameter></methodparam>
|
||||
<methodparam><parameter>y</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-drawable--mask-intersect">mask_intersect</link></methodname>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-drawable--merge-shadow">merge_shadow</link></methodname>
|
||||
<methodparam><parameter>undo</parameter><initializer>False</initializer></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-drawable--offset">offset</link></methodname>
|
||||
<methodparam><parameter>wrap_around</parameter></methodparam>
|
||||
<methodparam><parameter>fill_type</parameter></methodparam>
|
||||
<methodparam><parameter>offset_x</parameter></methodparam>
|
||||
<methodparam><parameter>offset_y</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-drawable--parasite-attach">parasite_attach</link></methodname>
|
||||
<methodparam><parameter>parasite</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-drawable--parasite-detach">parasite_detach</link></methodname>
|
||||
<methodparam><parameter>parasite</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-drawable--parasite-find">parasite_find</link></methodname>
|
||||
<methodparam><parameter>parasite_name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-drawable--parasite-list">parasite_list</link></methodname>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-drawable--set-pixel">set_pixel</link></methodname>
|
||||
<methodparam><parameter>x</parameter></methodparam>
|
||||
<methodparam><parameter>y</parameter></methodparam>
|
||||
<methodparam><parameter>value</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-drawable--set-pixel">update</link></methodname>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id="attributes-drawable">
|
||||
<title>Attributes</title>
|
||||
|
||||
<blockquote role="properties">
|
||||
<informaltable pgwide="1" frame="none">
|
||||
<tgroup cols="3">
|
||||
<colspec column="1" colwidth="1in"/>
|
||||
<colspec column="2" colwidth="1in"/>
|
||||
<colspec column="3" colwidth="4in"/>
|
||||
<tbody>
|
||||
<row valign="top">
|
||||
<entry>"bpp"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>The drawable's bytes-per-pixel.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"height"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>The drawable's height in pixel.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"is_grey"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para><literal>True</literal> if the drawable is a grayscale type (Gray, GrayA).</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"is_indexed"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para><literal>True</literal> if the drawable is an indexed type (Indexed, IndexedA).</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"is_layer_mask"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para><literal>True</literal> if the drawable is a layer mas.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"is_rgb"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para><literal>True</literal> if the drawable is an RGB type (RGB, RGBA).</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"image"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>The image to which the drawable is attached.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"name"</entry>
|
||||
<entry>Read/Write</entry>
|
||||
<entry>
|
||||
<para>The drawable's name.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"linked"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>The link state of the drawable.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"tattoo"</entry>
|
||||
<entry>Read/Write</entry>
|
||||
<entry>
|
||||
<para>The drawable's tattoo.</para>
|
||||
<para>A tattoo is a unique and permanent identifier attached to a drawable that can be used to uniquely identify a drawable within an image even between sessions.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"offsets"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>A 2-Tuple containing the drawable's x and y offset of the top left hand corner to it's image.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"has_alpha"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para><literal>True</literal> if the drawable has an alpha channel.</para>
|
||||
<para>This can only be true for layers, and the associated type will be one of: { RGBA , GRAYA, INDEXEDA }.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"mask_bounds"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>The bounding box of the current selection in relation to the drawable.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"type"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>The drawable's type.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"type"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>The drawable's type with alpha.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"visible"</entry>
|
||||
<entry>Read/Write</entry>
|
||||
<entry>
|
||||
<para><literal>True</literal> if the drawable is visible.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"type"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>The drawable's width in pixels.</para>
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</blockquote>
|
||||
</refsect1>
|
||||
<refsect1 id="methods-drawable">
|
||||
<title>Methods</title>
|
||||
<refsect2 id="method-drawable--fill">
|
||||
<title>gimp.Drawable.fill</title>
|
||||
<programlisting><methodsynopsis language="python">
|
||||
<methodname>fill</methodname>
|
||||
<methodparam>fill_mode</methodparam>
|
||||
</methodsynopsis></programlisting>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>fill_mode</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>The fill mode to use.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis>Returns</emphasis> :</term>
|
||||
<listitem><simpara><literal>True</literal> on success.</simpara></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Fills the drawable with the specified fill mode.</para>
|
||||
<para>This procedure fills the drawable. If the fill mode is foreground the current foreground color is used. If the fill mode is background, the current background color is used. If the fill type is white, then white is used. Transparent fill only affects layers with an alpha channel, in which case the alpha channel is set to transparent. If the drawable has no alpha channel, it is filled to white. No fill leaves the drawable's contents undefined. This procedure is unlike the bucket fill tool because it fills regardless of a selection. Its main purpose is to fill a newly created drawable before adding it to the image. This operation cannot be undone.</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="method-drawable--flush">
|
||||
<title>gimp.Drawable.flush</title>
|
||||
<programlisting><methodsynopsis language="python">
|
||||
<methodname>flush</methodname>
|
||||
</methodsynopsis></programlisting>
|
||||
<para>This function causes all tile data in the tile list of the drawable to be transferred to the core. It is usually called in situations where a plug-in acts on a drawable, and then needs to read the results of its actions. Data transferred back from the core will not generally be valid unless gimp_drawable_flush() has been called beforehand.</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="method-drawable--get-pixel">
|
||||
<title>gimp.Drawable.fill</title>
|
||||
<programlisting><methodsynopsis language="python">
|
||||
<methodname>get-pixel</methodname>
|
||||
<methodparam>x</methodparam>
|
||||
<methodparam>y</methodparam>
|
||||
</methodsynopsis></programlisting>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>x</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>The x coordinate.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>y</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>The y coordinate.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis>Returns</emphasis> :</term>
|
||||
<listitem><simpara>A string representing the pixel data. Each character of the string represents a byte of the color.</simpara></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Gets the value of the pixel at the specified coordinates.</para>
|
||||
<para>This procedure gets the pixel value at the specified coordinates. The pixel value is returned as a string. Each character of the string represents a byte of the color. For example if the drawable's mode is MODE_RGB then the first character is the red component of the color, the second character the green component and the third the blue.</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="method-drawable--get-pixel-rgn">
|
||||
<title>gimp.Drawable.get_pixel_rgn</title>
|
||||
<programlisting><methodsynopsis language="python">
|
||||
<methodname>get_pixel_rgn</methodname>
|
||||
<methodparam>x</methodparam>
|
||||
<methodparam>y</methodparam>
|
||||
<methodparam>width</methodparam>
|
||||
<methodparam>height</methodparam>
|
||||
<methodparam>dirty<initializer>True</initializer></methodparam>
|
||||
<methodparam>shadow<initializer>False</initializer></methodparam>
|
||||
</methodsynopsis></programlisting>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>x</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara></simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>y</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara></simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>width</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara></simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>height</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara></simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>dirty</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara></simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>shadow</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara></simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis>Returns</emphasis> :</term>
|
||||
<listitem><simpara>A newly created gimp.PixelRgn</simpara></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Fills the drawable with the specified fill mode.</para>
|
||||
<para>This procedure fills the drawable. If the fill mode is foreground the current foreground color is used. If the fill mode is background, the current background color is used. If the fill type is white, then white is used. Transparent fill only affects layers with an alpha channel, in which case the alpha channel is set to transparent. If the drawable has no alpha channel, it is filled to white. No fill leaves the drawable's contents undefined. This procedure is unlike the bucket fill tool because it fills regardless of a selection. Its main purpose is to fill a newly created drawable before adding it to the image. This operation cannot be undone.</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="method-drawable--get-tile">
|
||||
<title>gimp.Drawable.get_tile</title>
|
||||
<programlisting><methodsynopsis language="python">
|
||||
<methodname>get_tile</methodname>
|
||||
<methodparam>shadow</methodparam>
|
||||
<methodparam>col</methodparam>
|
||||
<methodparam>row</methodparam>
|
||||
</methodsynopsis></programlisting>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>shadow</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara></simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>row</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara></simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>col</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara></simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis>Returns</emphasis> :</term>
|
||||
<listitem><simpara>A gimp.Tile or <literal>None</literal></simpara></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Gets a tile at (row, col). Either on or off the shadow buffer.</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="method-drawable--get-tile2">
|
||||
<title>gimp.Drawable.get_tile2</title>
|
||||
<programlisting><methodsynopsis language="python">
|
||||
<methodname>get_tile2</methodname>
|
||||
<methodparam>shadow</methodparam>
|
||||
<methodparam>x</methodparam>
|
||||
<methodparam>y</methodparam>
|
||||
</methodsynopsis></programlisting>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>shadow</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara></simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>x</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara></simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>y</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara></simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis>Returns</emphasis> :</term>
|
||||
<listitem><simpara>A gimp.Tile or <literal>None</literal></simpara></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Gets the tile that contains the pixel (x, y).</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="method-drawable--mask-intersect">
|
||||
<title>gimp.Drawable.mask_intersect</title>
|
||||
<programlisting><methodsynopsis language="python">
|
||||
<methodname>mask_intersect</methodname>
|
||||
</methodsynopsis></programlisting>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><emphasis>Returns</emphasis> :</term>
|
||||
<listitem><simpara>A 4-tuple containing the x and y coordinate, width and height of the intersection between the drawable and the selection.</simpara></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Find the bounding box of the current selection in relation to the drawable.</para>
|
||||
<para>This procedure returns whether there is an intersection between the drawable and the selection. Unlike gimp_drawable_mask_bounds(), the intersection's bounds are returned as a 4-tuple with x, y, width, height. If there is no selection the returned bounds are the extents of the whole drawable.</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="method-drawable--merge-shadow">
|
||||
<title>gimp.Drawable.merge_shadow</title>
|
||||
<programlisting><methodsynopsis language="python">
|
||||
<methodname>merge_shadow</methodname>
|
||||
<methodparam>undo</methodparam>
|
||||
</methodsynopsis></programlisting>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><emphasis>Returns</emphasis> :</term>
|
||||
<listitem><simpara><literal>True</literal> on success.</simpara></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Merges the shadow buffer with the drawable.</para>
|
||||
<para>This procedure combines the contents of the image's shadow buffer (for temporary processing) with the drawable. The <parameter>undo</parameter> parameter specifies whether to add an undo step for the operation. Requesting no undo is useful for such applications as 'auto-apply'.</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="method-drawable--offset">
|
||||
<title>gimp.Drawable.offset</title>
|
||||
<programlisting><methodsynopsis language="python">
|
||||
<methodname>offset</methodname>
|
||||
<methodparam>wrap_around</methodparam>
|
||||
<methodparam>fill_type</methodparam>
|
||||
<methodparam>offset_x</methodparam>
|
||||
<methodparam>offset_y</methodparam>
|
||||
</methodsynopsis></programlisting>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>wrap_around</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>If <literal>True</literal> wrap image around else fill vacated regions. </simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>fill_type</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>Fill vacated regions of the drawable with background or transparent. </simpara>
|
||||
</listitem>
|
||||
</varlistentry> <varlistentry>
|
||||
<term><parameter>offset_x</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>Offset the drawable by this ammount of pixels in the x direction.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>offset_y</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>Offset the drawable by this ammount of pixels in the y direction.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis>Returns</emphasis> :</term>
|
||||
<listitem><simpara><literal>True</literal> on success.</simpara></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Offsets the drawable by the specified amounts in the x and y directions.</para>
|
||||
<para>This procedure offsets the drawable by the amounts specified by <parameter>offset_x</parameter> and <parameter>offset_y</parameter>. If <parameter>wrap_around</parameter> is set to <literal>True</literal>, then portions of the drawable which are offset out of bounds are wrapped around. Alternatively, the undefined regions of the drawable can be filled with transparency or the background color, as specified by the <parameter>fill_type</parameter> parameter..</para>
|
||||
</refsect2>
|
||||
</refsect1>
|
||||
</refentry>
|
537
plug-ins/pygimp/doc/reference/pygimp-image.xml
Normal file
537
plug-ins/pygimp/doc/reference/pygimp-image.xml
Normal file
@@ -0,0 +1,537 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
|
||||
<refentry id="class-image">
|
||||
<refmeta>
|
||||
<refentrytitle>gimp.Image</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo>PyGimp Docs</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gimp.Image</refname>
|
||||
<refpurpose>This is the object that represents an open image.</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 id="synopsis-image">
|
||||
<title>Synopsis</title>
|
||||
|
||||
<classsynopsis language="python">
|
||||
<ooclass><classname>gimp.Image</classname></ooclass>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--add-channel">add_channel</link></methodname>
|
||||
<methodparam><parameter>channel</parameter></methodparam>
|
||||
<methodparam><parameter>position</parameter><initializer>-1</initializer></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--add-hguide">add_hguide</link></methodname>
|
||||
<methodparam><parameter>ypos</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--add-layer">add_layer</link></methodname>
|
||||
<methodparam><parameter>layer</parameter></methodparam>
|
||||
<methodparam><parameter>position</parameter><initializer>-1</initializer></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--add-vguide">add_vguide</link></methodname>
|
||||
<methodparam><parameter>xpos</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--attach-new-parasite">attach_new_parasite</link></methodname>
|
||||
<methodparam><parameter>name</parameter></methodparam>
|
||||
<methodparam><parameter>flags</parameter></methodparam>
|
||||
<methodparam><parameter>data</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--attach-new-parasite">attach_new_parasite</link></methodname>
|
||||
<methodparam><parameter>name</parameter></methodparam>
|
||||
<methodparam><parameter>flags</parameter></methodparam>
|
||||
<methodparam><parameter>data</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--clean-all">clean_all</link></methodname>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--crop">crop</link></methodname>
|
||||
<methodparam><parameter>width</parameter></methodparam>
|
||||
<methodparam><parameter>height</parameter></methodparam>
|
||||
<methodparam><parameter>offset_x</parameter></methodparam>
|
||||
<methodparam><parameter>offset_y</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--delete-guid">delete_guide</link></methodname>
|
||||
<methodparam><parameter>guide</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--disable-undo">disable_undo</link></methodname>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--duplicate">duplicate</link></methodname>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--enable-undo">enable_undo</link></methodname>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--find-next-guid">find_next_guide</link></methodname>
|
||||
<methodparam><parameter>guide</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--flatten">flatten</link></methodname>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--free-shadow">free_shadow</link></methodname>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--get-channel-by-tattoo">get_channel_by_tattoo</link></methodname>
|
||||
<methodparam><parameter>tatoo</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--get-component-active">get_component_active</link></methodname>
|
||||
<methodparam><parameter>component</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--get-component-visible">get_component_visible</link></methodname>
|
||||
<methodparam><parameter>component</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--get-guide-orientation">get_guide_orientation</link></methodname>
|
||||
<methodparam><parameter>guide</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--get-guide-position">get_guide_position</link></methodname>
|
||||
<methodparam><parameter>guide</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--get-layer-by-tattoo">get_layer_by_tattoo</link></methodname>
|
||||
<methodparam><parameter>tattoo</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--lower-channel">lower_channel</link></methodname>
|
||||
<methodparam><parameter>channel</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--lower-layer">lower_layer</link></methodname>
|
||||
<methodparam><parameter>layer</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--lower-layer-to-bottom">lower_layar_to_bottom</link></methodname>
|
||||
<methodparam><parameter>layer</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--merge-down">merge_down</link></methodname>
|
||||
<methodparam><parameter>layer</parameter></methodparam>
|
||||
<methodparam><parameter>type</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--merge-visible-layers">merge_visible_layers</link></methodname>
|
||||
<methodparam><parameter>type</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--new-layer">new_layer</link></methodname>
|
||||
<methodparam><parameter>name</parameter><initializer>"New Layer"</initializer></methodparam>
|
||||
<methodparam><parameter>width</parameter><initializer>-1</initializer></methodparam>
|
||||
<methodparam><parameter>height</parameter><initializer>-1</initializer></methodparam>
|
||||
<methodparam><parameter>offset_x</parameter><initializer>-1</initializer></methodparam>
|
||||
<methodparam><parameter>offset_y</parameter><initializer>-1</initializer></methodparam>
|
||||
<methodparam><parameter>alpha</parameter><initializer>True</initializer></methodparam>
|
||||
<methodparam><parameter>pos</parameter><initializer>-1</initializer></methodparam>
|
||||
<methodparam><parameter>opacity</parameter><initializer>100.0</initializer></methodparam>
|
||||
<methodparam><parameter>mode</parameter><initializer>gimp.enums.NORMAL_MODE</initializer></methodparam>
|
||||
<methodparam><parameter>fill_mode</parameter><initializer>-1</initializer></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--parasite-attach">parasite_attach</link></methodname>
|
||||
<methodparam><parameter>parasite</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--parasite-detach">parasite_detach</link></methodname>
|
||||
<methodparam><parameter>parasite</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--parasite-find">parasite_find</link></methodname>
|
||||
<methodparam><parameter>parasite_name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--parasite-list">parasite_list</link></methodname>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--pick-correlate-layer">pick_correlate_layer</link></methodname>
|
||||
<methodparam><parameter>x</parameter></methodparam>
|
||||
<methodparam><parameter>y</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--raise-channel">raise_channel</link></methodname>
|
||||
<methodparam><parameter>channel</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--raise-layer">raise_layer</link></methodname>
|
||||
<methodparam><parameter>layer</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--raise-layer-to-top">raise_layer_to_top</link></methodname>
|
||||
<methodparam><parameter>layer</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--remove-channel">remove_channel</link></methodname>
|
||||
<methodparam><parameter>channel</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--remove-layer">remove_layer</link></methodname>
|
||||
<methodparam><parameter>layer</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--resize-to-layers">resize_to_layers</link></methodname>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--scale">scale</link></methodname>
|
||||
<methodparam><parameter>new_width</parameter></methodparam>
|
||||
<methodparam><parameter>new_width</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--set-component-active">set_component_active</link></methodname>
|
||||
<methodparam><parameter>component</parameter></methodparam>
|
||||
<methodparam><parameter>active</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--set-component-visible">set_component_visible</link></methodname>
|
||||
<methodparam><parameter>component</parameter></methodparam>
|
||||
<methodparam><parameter>visible</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--undo-freeze">undo_freeze</link></methodname>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--undo-group-end">undo_group_end</link></methodname>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--undo-group-start">undo_group_start</link></methodname>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--undo-is-enabled">undo_is_enabled</link></methodname>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--undo-thaw">undo_thaw</link></methodname>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-image--unset-active-channel">unset_active_channel</link></methodname>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id="ancestry-image">
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id="attributes-image">
|
||||
<title>Attributes</title>
|
||||
<blockquote role="properties">
|
||||
<informaltable pgwide="1" frame="none">
|
||||
<tgroup cols="3">
|
||||
<colspec column="1" colwidth="1in"/>
|
||||
<colspec column="2" colwidth="1in"/>
|
||||
<colspec column="3" colwidth="4in"/>
|
||||
<tbody>
|
||||
<row valign="top">
|
||||
<entry>"active_channel"</entry>
|
||||
<entry>Read/Write</entry>
|
||||
<entry>
|
||||
<para>The image's active channel, or <literal>None</literal> if there is no active channel.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"active_drawable"</entry>
|
||||
<entry>Read/Write</entry>
|
||||
<entry>
|
||||
<para>The image's active drawable, or None if there is no active drawable.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"active_layer"</entry>
|
||||
<entry>Read/Write</entry>
|
||||
<entry>
|
||||
<para>The image's active layer, or <literal>None</literal> if there is no active layer.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"base_type"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>This is the type of the image (eg RGB, INDEXED).</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"channels"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>A list of <link linked="gimp-channel">gimp.Channel</link> objects which containins the channels of the image.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"colormap"</entry>
|
||||
<entry>Read/Write</entry>
|
||||
<entry>
|
||||
<para>The image's color map.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"dirty"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para><literal>True</literal> if the dirty flag is set on the image.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"filename"</entry>
|
||||
<entry>Read/Write</entry>
|
||||
<entry>
|
||||
<para>The image's filename. A file load or save handler might assign to this.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"floating_sel_attached_to"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>The layer to which the floating selection is attached to, or <literal>None</literal>.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"floating_selection"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>The floating selection layer, or <literal>None</literal> if there is no floating selection.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"height"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>The image's height in pixel.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"layers"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>A list of <link linked="gimp-layer">gimp.Layer</link> objects which containins the layers of the image..</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"name"</entry>
|
||||
<entry>Read/Write</entry>
|
||||
<entry>
|
||||
<para>The image's name.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"resolution"</entry>
|
||||
<entry>Read/Write</entry>
|
||||
<entry>
|
||||
<para>The image's resolution.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"selection"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>The image's selection mask.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"tattoo_state"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>The image's tattoo_state.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"unit"</entry>
|
||||
<entry>Read/Write</entry>
|
||||
<entry>
|
||||
<para>The image's unit.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"vectors"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>A list of <link linked="gimp-layer">gimp.Vectors</link> objects which containins the vectors of the image..</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"width"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>The image's width in pixel.</para>
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</blockquote>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id="description-image">
|
||||
<title>Description</title>
|
||||
<para>Channel objects represent a Gimp Image's color channels.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id="constructor-image">
|
||||
<title>Constructor</title>
|
||||
<programlisting><constructorsynopsis language="python">
|
||||
<methodname>gimp.Image</methodname>
|
||||
<methodparam><parameter>image</parameter></methodparam>
|
||||
<methodparam><parameter>name</parameter></methodparam>
|
||||
<methodparam><parameter>width</parameter></methodparam>
|
||||
<methodparam><parameter>height</parameter></methodparam>
|
||||
<methodparam><parameter>type</parameter></methodparam>
|
||||
<methodparam><parameter>opacity</parameter></methodparam>
|
||||
<methodparam><parameter>color</parameter></methodparam>
|
||||
</constructorsynopsis></programlisting>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>image</parameter> :</term>
|
||||
<listitem><simpara>The image to which to add the channel.</simpara></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>name</parameter> :</term>
|
||||
<listitem><simpara>The channel's name.</simpara></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>width</parameter> :</term>
|
||||
<listitem><simpara>The channel's width.</simpara></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>height</parameter> :</term>
|
||||
<listitem><simpara>The channel's height.</simpara></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>type</parameter> :</term>
|
||||
<listitem><simpara>The channel's type.</simpara></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>opacity</parameter> :</term>
|
||||
<listitem><simpara>The channel's opacity.</simpara></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>color</parameter> :</term>
|
||||
<listitem><simpara>The channel's compositing color.</simpara></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis>Returns</emphasis> :</term>
|
||||
<listitem><simpara>A new gimp.Image object.</simpara></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Creats a new channel object</para>
|
||||
<para>Creates a new channel with the specified width and height. Name, opacity, and color are also supplied parameters. The new channel still needs to be added to the image, as this is not automatic. Add the new channel with the <link linkend="gimp-image--add-image">gimp.Image.add_channel</link> command. Other attributes such as channel show masked, should be set with explicitly. The channel's contents are undefined initially.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id="methods-image">
|
||||
<title>Methods</title>
|
||||
|
||||
<refsect2 id="method-image--copy">
|
||||
<title>gimp.Image.copy</title>
|
||||
<programlisting><methodsynopsis language="python">
|
||||
<methodname>copy</methodname>
|
||||
</methodsynopsis></programlisting>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><emphasis>Returns</emphasis> :</term>
|
||||
<listitem><simpara>A newly created gimp.Image which is a copy of this channel.</simpara></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Copys the channel.</para>
|
||||
<para>This procedure copies the channel and returns the copy.</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="method-image--combine-masks">
|
||||
<title>gimp.Image.combine_masks</title>
|
||||
<programlisting><methodsynopsis language="python">
|
||||
<methodname>combine_masks</methodname>
|
||||
<methodparam>channel</methodparam>
|
||||
<methodparam>operation</methodparam>
|
||||
<methodparam>offset_x</methodparam>
|
||||
<methodparam>offset_y</methodparam>
|
||||
</methodsynopsis></programlisting>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>channel</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>The channel to be combined with.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>operation</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>The selection operation. One of <link linkend="gimp-enums-gimp-chanel-ops">gimp.enums.GimpChannelOps</link></simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>offset_x</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>The x offset between upper left corner of this channel and the one combined with.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>offset_y</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>The y offset between upper left corner of this channel and the one combined with.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis>Returns</emphasis> :</term>
|
||||
<listitem><simpara>A newly created gimp.Image.</simpara></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Combines two channel masks.</para>
|
||||
<para>This method combines <parameter>channel</parameter> with this channel using <parameter>operation</parameter>. The result is stored in this channel.</para>
|
||||
</refsect2>
|
||||
|
||||
</refsect1>
|
||||
</refentry>
|
430
plug-ins/pygimp/doc/reference/pygimp-layer.xml
Normal file
430
plug-ins/pygimp/doc/reference/pygimp-layer.xml
Normal file
@@ -0,0 +1,430 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
|
||||
<refentry id="class-layer">
|
||||
<refmeta>
|
||||
<refentrytitle>gimp.Layer</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo>PyGimp Docs</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gimp.Layer</refname>
|
||||
<refpurpose></refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1 id="synopsis-layer">
|
||||
<title>Synopsis</title>
|
||||
|
||||
<classsynopsis language="python">
|
||||
<ooclass><classname>gimp.Layer</classname></ooclass>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-layer--add-alpha">add_alpha</link></methodname>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-layer--add-mask">add_mask</link></methodname>
|
||||
<methodparam><parameter>mask</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-layer--copy">copy</link></methodname>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-layer--create-mask">create_mask</link></methodname>
|
||||
<methodparam><parameter>mask_type</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-layer--remove-mask">remove_mask</link></methodname>
|
||||
<methodparam><parameter>mode</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-layer--resize">resize</link></methodname>
|
||||
<methodparam><parameter>new_width</parameter></methodparam>
|
||||
<methodparam><parameter>new_height</parameter></methodparam>
|
||||
<methodparam><parameter>x_offset</parameter><initializer>0</initializer></methodparam>
|
||||
<methodparam><parameter>y_offset</parameter><initializer>0</initializer></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-layer--resize-to-image-size">resize_to_image_size</link></methodname>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-layer--scale">scale</link></methodname>
|
||||
<methodparam><parameter>new_width</parameter></methodparam>
|
||||
<methodparam><parameter>new_height</parameter></methodparam>
|
||||
<methodparam><parameter>local_origin</parameter><initializer>False</initializer></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-layer--set-offsets">set_offsets</link></methodname>
|
||||
<methodparam><parameter>x</parameter></methodparam>
|
||||
<methodparam><parameter>y</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id="ancestry-layer">
|
||||
<title>Ancestry</title>
|
||||
<synopsis>
|
||||
+-- <link linkend="class-drawable">gimp.Drawable</link>
|
||||
</synopsis>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id="attributes-layer">
|
||||
<title>Attributes</title>
|
||||
<para><link linkend="attributes-drawable">gimp.Layer Attributes</link></para>
|
||||
|
||||
<blockquote role="properties">
|
||||
<informaltable pgwide="1" frame="none">
|
||||
<tgroup cols="3">
|
||||
<colspec column="1" colwidth="1in"/>
|
||||
<colspec column="2" colwidth="1in"/>
|
||||
<colspec column="3" colwidth="4in"/>
|
||||
<tbody>
|
||||
<row valign="top">
|
||||
<entry>"apply_mask"</entry>
|
||||
<entry>Read/Write</entry>
|
||||
<entry>
|
||||
<para>True if the layer's mask is currently affecting the alpha channel.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"edit_mask"</entry>
|
||||
<entry>Read/Write</entry>
|
||||
<entry>
|
||||
<para>True if the layer or it's mask is currently active for editing.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"mask"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>The layer's mask or None if none exists.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"mode"</entry>
|
||||
<entry>Read/Write</entry>
|
||||
<entry>
|
||||
<para>The layer's combination mode.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"opacity"</entry>
|
||||
<entry>Read/Write</entry>
|
||||
<entry>
|
||||
<para>The layer's opacity.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"show_mask"</entry>
|
||||
<entry>Read/Write</entry>
|
||||
<entry>
|
||||
<para>True if the layer or its mask is visible.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"is_floating_sel"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>True if the layer is a floating selection.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"lock_alpha"</entry>
|
||||
<entry>Read/Write</entry>
|
||||
<entry>
|
||||
<para>The lock alpha channel setting of the layer.</para>
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</blockquote>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id="description-layer">
|
||||
<title>Description</title>
|
||||
<para>Layer objects represent the layers of a Gimp image.</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id="constructor-layer">
|
||||
<title>Constructor</title>
|
||||
<programlisting><constructorsynopsis language="python">
|
||||
<methodname>gimp.Layer</methodname>
|
||||
<methodparam><parameter>image</parameter></methodparam>
|
||||
<methodparam><parameter>name</parameter></methodparam>
|
||||
<methodparam><parameter>width</parameter></methodparam>
|
||||
<methodparam><parameter>height</parameter></methodparam>
|
||||
<methodparam><parameter>type</parameter><initializer>gimp.enums.RGB_IMAGE</initializer></methodparam>
|
||||
<methodparam><parameter>opacity</parameter><initializer>100.0</initializer></methodparam>
|
||||
<methodparam><parameter>mode</parameter><initializer>gimp.enums.NORMAL_MODE</initializer></methodparam>
|
||||
</constructorsynopsis></programlisting>
|
||||
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>image</parameter> :</term>
|
||||
<listitem><simpara>The image to which to add the layer.</simpara></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>name</parameter> :</term>
|
||||
<listitem><simpara>The layer's name.</simpara></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>width</parameter> :</term>
|
||||
<listitem><simpara>The layer's width.</simpara></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>height</parameter> :</term>
|
||||
<listitem><simpara>The layer's height.</simpara></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>type</parameter> :</term>
|
||||
<listitem><simpara>The layer's type.</simpara></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>opacity</parameter> :</term>
|
||||
<listitem><simpara>The layer's opacity.</simpara></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>mode</parameter> :</term>
|
||||
<listitem><simpara>The layer's combination mode.</simpara></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis>Returns</emphasis> :</term>
|
||||
<listitem><simpara>A new gimp.Layer object.</simpara></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Creats a new layer object</para>
|
||||
<para>This procedure creates a new layer with the specified width, height, and type. Name, opacity, and mode are also supplied parameters. The new layer still needs to be added to the image, as this is not automatic. Add the new layer with the <link linkend="method-image--add-layer">gimp.Image.add_layer</link> method. Other attributes such as layer mask modes, and offsets should be set with explicit procedure calls.</para>
|
||||
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id="methods-layer">
|
||||
<title>Methods</title>
|
||||
<refsect2 id="method-layer--add-alpha">
|
||||
<title>gimp.Layer.add_alpha</title>
|
||||
<programlisting><methodsynopsis language="python">
|
||||
<methodname>add_alpha</methodname>
|
||||
</methodsynopsis></programlisting>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><emphasis>Returns</emphasis> :</term>
|
||||
<listitem><simpara><literal>True</literal> on success.</simpara></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Adds an alpha channel to the layer if it doesn't already have one.</para>
|
||||
<para>This procedure adds an additional component to the layer if it does not already possess an alpha channel. An alpha channel makes it possible to clear and erase to transparency, instead of the background color. This transforms layers of type RGB to RGBA, GRAY to GRAYA, and INDEXED to INDEXEDA.</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="method-layer--add-mask">
|
||||
<title>gimp.Layer.add_mask</title>
|
||||
<programlisting><methodsynopsis language="python">
|
||||
<methodname>add_mask</methodname>
|
||||
<methodparam>mask</methodparam>
|
||||
</methodsynopsis></programlisting>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>mask</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>The mask to add to the layer.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis>Returns</emphasis> :</term>
|
||||
<listitem><simpara><literal>True</literal> on success.</simpara></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Adds a layer mask to the layer.</para>
|
||||
<para>This procedure adds a layer mask to the layer. Layer masks serve as an additional alpha channel for a layer. This procedure will fail if a number of prerequisites aren't met. The layer cannot already have a layer mask. The specified mask must exist and have the same dimensions as the layer. The layer must have been created for use with the specified image and the mask must have been created with the method <link linkend="method-layer--create-mask">create_mask</link>.</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="method-layer--copy">
|
||||
<title>gimp.Layer.copy</title>
|
||||
<programlisting><methodsynopsis language="python">
|
||||
<methodname>copy</methodname>
|
||||
</methodsynopsis></programlisting>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><emphasis>Returns</emphasis> :</term>
|
||||
<listitem><simpara>A newly created gimp.Layer which is a copy of this layer.</simpara></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Copys the layer.</para>
|
||||
<para>This procedure copies the layer and returns the copy. The newly copied layer is for use within the original layer's image. It should not be subsequently added to any other image.</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="method-layer--create-mask">
|
||||
<title>gimp.Layer.create_mask</title>
|
||||
<programlisting><methodsynopsis language="python">
|
||||
<methodname>create_mask</methodname>
|
||||
<methodparam>mask_type</methodparam>
|
||||
</methodsynopsis></programlisting>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>mask_type</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>The type of the created mask.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis>Returns</emphasis> :</term>
|
||||
<listitem><simpara>A newly created gimp.Channel.</simpara></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Creates a layer mask for the layer.</para>
|
||||
<para>This procedure creates a layer mask for the layer. Layer masks serve as an additional alpha channel for a layer. A number of different types of masks are allowed for initialisation: completely white masks (which will leave the layer fully visible), completely black masks (which will give the layer complete transparency, the layer's already existing alpha channel (which will leave the layer fully visible, but which may be more useful than a white mask), the current selection or a grayscale copy of the layer. The layer mask still needs to be added to the layer. This can be done with a call to <link linkend="method-layer--add-mask">add_mask</link>.</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="method-layer--remove-mask">
|
||||
<title>gimp.Layer.remove_mask</title>
|
||||
<programlisting><methodsynopsis language="python">
|
||||
<methodname>remove_mask</methodname>
|
||||
<methodparam>mask_type</methodparam>
|
||||
</methodsynopsis></programlisting>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>mode</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>Removal mode.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis>Returns</emphasis> :</term>
|
||||
<listitem><simpara><literal>True</literal> on succsess.</simpara></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Removes the specified layer mask from the layer.</para>
|
||||
<para>This procedure removes the specified layer mask from the layer.</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="method-layer--resize">
|
||||
<title>gimp.Layer.resize</title>
|
||||
<programlisting><methodsynopsis language="python">
|
||||
<methodname>resize</methodname>
|
||||
<methodparam>new_width</methodparam>
|
||||
<methodparam>new_height</methodparam>
|
||||
<methodparam>offset_x<initializer>0</initializer></methodparam>
|
||||
<methodparam>offset_y<initializer>0</initializer></methodparam>
|
||||
</methodsynopsis></programlisting>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>new_width</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>New layer width in pixels.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>new_height</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>New layer height in pixels.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>offset_x</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>x offset between upper left corner of old and new layers: (old - new).</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>offset_y</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>y offset between upper left corner of old and new layers: (old - new).</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis>Returns</emphasis> :</term>
|
||||
<listitem><simpara><literal>True</literal> on succsess.</simpara></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Resizes the layer to the specified extents.</para>
|
||||
<para>This procedure resizes the layer so that its new width and height are equal to the supplied parameters. Offsets are also provided which describe the position of the previous layer's content. This operation only works if the layer has been added to an image.</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="method-layer--resize-to-image-size">
|
||||
<title>gimp.Layer.resize_to_image_size</title>
|
||||
<programlisting><methodsynopsis language="python">
|
||||
<methodname>resize_to_image_size</methodname>
|
||||
</methodsynopsis></programlisting>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><emphasis>Returns</emphasis> :</term>
|
||||
<listitem><simpara><literal>True</literal> on succsess.</simpara></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Resize a layer to the image size.</para>
|
||||
<para>This procedure resizes the layer so that it's new width and height are equal to the width and height of its image container.</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="method-layer--scale">
|
||||
<title>gimp.Layer.scale</title>
|
||||
<programlisting><methodsynopsis language="python">
|
||||
<methodname>scale</methodname>
|
||||
<methodparam>new_width</methodparam>
|
||||
<methodparam>new_height</methodparam>
|
||||
<methodparam>local_origin<initializer>False</initializer></methodparam>
|
||||
</methodsynopsis></programlisting>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>new_width</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>New layer width in pixels.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>new_height</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>New layer height in pixels.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>local_origin</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>If <literal>True</literal> use a local origin (as opposed to the image origin).</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis>Returns</emphasis> :</term>
|
||||
<listitem><simpara><literal>True</literal> on succsess.</simpara></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Scales the layer to the specified extents.</para>
|
||||
<para>This procedure scales the layer so that its new width and height are equal to the supplied parameters. The <parameter>local_origin</parameter> 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.</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="method-layer--set-offsets">
|
||||
<title>gimp.Layer.set_offsets</title>
|
||||
<programlisting><methodsynopsis language="python">
|
||||
<methodname>set_offsets</methodname>
|
||||
<methodparam>offset_x</methodparam>
|
||||
<methodparam>offset_y</methodparam>
|
||||
</methodsynopsis></programlisting>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>offset_x</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>Offset in x direction.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>offset_y</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>Offset in y direction.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis>Returns</emphasis> :</term>
|
||||
<listitem><simpara><literal>True</literal> on succsess.</simpara></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Sets the layer offsets.</para>
|
||||
<para>This procedure sets the offsets for the layer. The offsets are relative to the image origin and can be any values. This operation is valid only on layers which have been added to an image.</para>
|
||||
</refsect2>
|
||||
</refsect1>
|
||||
</refentry>
|
145
plug-ins/pygimp/doc/reference/pygimp-parasite.xml
Normal file
145
plug-ins/pygimp/doc/reference/pygimp-parasite.xml
Normal file
@@ -0,0 +1,145 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
|
||||
<refentry id="class-parasite">
|
||||
<refmeta>
|
||||
<refentrytitle>gimp.Parasite</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo>PyGimp Docs</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gimp.Parasite</refname>
|
||||
<refpurpose></refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1>
|
||||
<title>Synopsis</title>
|
||||
|
||||
<classsynopsis language="python">
|
||||
<ooclass><classname>gimp.Parasite</classname></ooclass>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-parasite--copy">copy</link></methodname>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-parasite--is-type">is_type</link></methodname>
|
||||
<methodparam><parameter>name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-parasite--has-flag">has_flag</link></methodname>
|
||||
<methodparam><parameter>flag</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id="attributes-parasite">
|
||||
<title>Attributes</title>
|
||||
|
||||
<blockquote role="properties">
|
||||
<informaltable pgwide="1" frame="none">
|
||||
<tgroup cols="3">
|
||||
<colspec column="1" colwidth="1in"/>
|
||||
<colspec column="2" colwidth="1in"/>
|
||||
<colspec column="3" colwidth="4in"/>
|
||||
<tbody>
|
||||
<row valign="top">
|
||||
<entry>"data"</entry>
|
||||
<entry>Read/Write</entry>
|
||||
<entry>
|
||||
<para>The parasite's data.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"flags"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>The parasite's flags.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"is_persistent"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para><literal>True</literal> if the parasite is persistent.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"is_undoable"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para><literal>True</literal> if the parasite can be undone.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"name"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>The parasite's name.</para>
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</blockquote>
|
||||
</refsect1>
|
||||
<refsect1 id="methods-parasite">
|
||||
<title>Methods</title>
|
||||
<refsect2 id="method-parasite--copy">
|
||||
<title>gimp.Parasite.get_pixel</title>
|
||||
<programlisting><methodsynopsis language="python">
|
||||
<methodname>get_pixel</methodname>
|
||||
<methodparam>x</methodparam>
|
||||
<methodparam>y</methodparam>
|
||||
</methodsynopsis></programlisting>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><emphasis>Returns</emphasis> :</term>
|
||||
<listitem>
|
||||
<simpara>A newly created gimp.Parasite which is a copy of this parasite.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Returns the pixel value at position <parameter>x</parameter>, <parameter>y</parameter> of the pixel fetcher's drawable.</para>
|
||||
<para>Returns a string who's length is equal to the bytes-per-pixel value of the fetcher's drawable. Each character represents one color channel.</para>
|
||||
</refsect2>
|
||||
<refsect2 id="method-parasite--put_pixel">
|
||||
<title>gimp.Parasite.put_pixel</title>
|
||||
<programlisting><methodsynopsis language="python">
|
||||
<methodname>put_pixel</methodname>
|
||||
<methodparam>x</methodparam>
|
||||
<methodparam>y</methodparam>
|
||||
<methodparam>value</methodparam>
|
||||
</methodsynopsis></programlisting>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>x</parameter> :</term>
|
||||
<listitem> <methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-parasite--put-pixel">is_type</link></methodname>
|
||||
<methodparam><parameter>name</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
|
||||
<simpara>The pixels x position.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>y</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>The pixels y position.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>value</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>The new pixels value.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Sets the pixel value of the pixel fetcher's drawable to <parameter>value</parameter>.</para>
|
||||
<para>Sets the pixel value of the pixel fetcher's drawable to <parameter>value</parameter>. <parameter>value</parameter> muss be a string with it's length equal to the pixel fetcher's drawable byte-per-pixel value. Each character of the sting represents one color channel.</para>
|
||||
</refsect2>
|
||||
</refsect1>
|
||||
</refentry>
|
129
plug-ins/pygimp/doc/reference/pygimp-pixel-fetcher.xml
Normal file
129
plug-ins/pygimp/doc/reference/pygimp-pixel-fetcher.xml
Normal file
@@ -0,0 +1,129 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
|
||||
<refentry id="class-pixel-fetcher">
|
||||
<refmeta>
|
||||
<refentrytitle>gimp.PixelFetcher</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo>PyGimp Docs</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gimp.PixelFetcher</refname>
|
||||
<refpurpose></refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1>
|
||||
<title>Synopsis</title>
|
||||
|
||||
<classsynopsis language="python">
|
||||
<ooclass><classname>gimp.PixelFetcher</classname></ooclass>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-pixel-fetcher--get-pixel">get_pixel</link></methodname>
|
||||
<methodparam><parameter>x</parameter></methodparam>
|
||||
<methodparam><parameter>y</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-pixel-fetcher--put-pixel">put_pixel</link></methodname>
|
||||
<methodparam><parameter>x</parameter></methodparam>
|
||||
<methodparam><parameter>y</parameter></methodparam>
|
||||
<methodparam><parameter>value</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id="attributes-pixel-fetcher">
|
||||
<title>Attributes</title>
|
||||
|
||||
<blockquote role="properties">
|
||||
<informaltable pgwide="1" frame="none">
|
||||
<tgroup cols="3">
|
||||
<colspec column="1" colwidth="1in"/>
|
||||
<colspec column="2" colwidth="1in"/>
|
||||
<colspec column="3" colwidth="4in"/>
|
||||
<tbody>
|
||||
<row valign="top">
|
||||
<entry>"bg_color"</entry>
|
||||
<entry>Read/Write</entry>
|
||||
<entry>
|
||||
<para></para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"edge_mode"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para></para>
|
||||
</entry>
|
||||
</row> </tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</blockquote>
|
||||
</refsect1>
|
||||
<refsect1 id="methods-pixel-fetcher">
|
||||
<title>Methods</title>
|
||||
<refsect2 id="method-pixel-fetcher--get_pixel">
|
||||
<title>gimp.PixelFetcher.get_pixel</title>
|
||||
<programlisting><methodsynopsis language="python">
|
||||
<methodname>get_pixel</methodname>
|
||||
<methodparam>x</methodparam>
|
||||
<methodparam>y</methodparam>
|
||||
</methodsynopsis></programlisting>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>x</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>The pixels x position.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>y</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>The pixels y position.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><emphasis>Returns</emphasis> :</term>
|
||||
<listitem>
|
||||
<simpara>The pixel value at position x, y of the pixel fetcher's drawable.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Returns the pixel value at position <parameter>x</parameter>, <parameter>y</parameter> of the pixel fetcher's drawable.</para>
|
||||
<para>Returns a string who's length is equal to the bytes-per-pixel value of the fetcher's drawable. Each character represents one color channel.</para>
|
||||
</refsect2>
|
||||
<refsect2 id="method-pixel-fetcher--put_pixel">
|
||||
<title>gimp.PixelFetcher.put_pixel</title>
|
||||
<programlisting><methodsynopsis language="python">
|
||||
<methodname>put_pixel</methodname>
|
||||
<methodparam>x</methodparam>
|
||||
<methodparam>y</methodparam>
|
||||
<methodparam>value</methodparam>
|
||||
</methodsynopsis></programlisting>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>x</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>The pixels x position.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>y</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>The pixels y position.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>value</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>The new pixels value.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Sets the pixel value of the pixel fetcher's drawable to <parameter>value</parameter>.</para>
|
||||
<para>Sets the pixel value of the pixel fetcher's drawable to <parameter>value</parameter>. <parameter>value</parameter> muss be a string with it's length equal to the pixel fetcher's drawable byte-per-pixel value. Each character of the sting represents one color channel.</para>
|
||||
</refsect2>
|
||||
</refsect1>
|
||||
</refentry>
|
151
plug-ins/pygimp/doc/reference/pygimp-pixel-rgn.xml
Normal file
151
plug-ins/pygimp/doc/reference/pygimp-pixel-rgn.xml
Normal file
@@ -0,0 +1,151 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
|
||||
<refentry id="class-pixel-rgn">
|
||||
<refmeta>
|
||||
<refentrytitle>gimp.PixelRgn</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo>PyGimp Docs</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gimp.PixelRgn</refname>
|
||||
<refpurpose></refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1>
|
||||
<title>Synopsis</title>
|
||||
|
||||
<classsynopsis language="python">
|
||||
<ooclass><classname>gimp.PixelRgn</classname></ooclass>
|
||||
<methodsynopsis language="python">
|
||||
<methodname><link
|
||||
linkend="method-pixel-rgn--resize">resize</link></methodname>
|
||||
<methodparam><parameter>x</parameter></methodparam>
|
||||
<methodparam><parameter>y</parameter></methodparam>
|
||||
<methodparam><parameter>width</parameter></methodparam>
|
||||
<methodparam><parameter>height</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
</classsynopsis>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id="attributes-pixel-rgn">
|
||||
<title>Attributes</title>
|
||||
|
||||
<blockquote role="properties">
|
||||
<informaltable pgwide="1" frame="none">
|
||||
<tgroup cols="3">
|
||||
<colspec column="1" colwidth="1in"/>
|
||||
<colspec column="2" colwidth="1in"/>
|
||||
<colspec column="3" colwidth="4in"/>
|
||||
<tbody>
|
||||
<row valign="top">
|
||||
<entry>"bpp"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>The pixel region's bytes-per-pixel.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"dirty"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para></para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"drawable"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>The drawable the pixel region was created for.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"h"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>The pixel region's height. in pixel</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"rowstride"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>The pixel region's number of bytes per pixel row.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"shadow"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para><literal>True</literal> if the pixel region uses shadow tile as opposed to normal tiles. If you draw on the shadow tiles, you must call <link linked="gimp-drawable--merge-shadow">gimp.Drawable.merge_shadow()</link> for changes to take effect.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"w"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>The pixel region's width in pixel.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"x"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>The pixel region's x offset relativ to it's drawable.</para>
|
||||
</entry>
|
||||
</row>
|
||||
<row valign="top">
|
||||
<entry>"y"</entry>
|
||||
<entry>Read</entry>
|
||||
<entry>
|
||||
<para>The pixel region's y offset relativ to it's drawable.</para>
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</blockquote>
|
||||
</refsect1>
|
||||
|
||||
<refsect1 id="methods-pixel-rgn">
|
||||
<title>Methods</title>
|
||||
<refsect2 id="method-pixel-rgn--resize">
|
||||
<title>gimp.PixelRgn.resize</title>
|
||||
<programlisting><methodsynopsis language="python">
|
||||
<methodname>resize</methodname>
|
||||
<methodparam>x</methodparam>
|
||||
<methodparam>y</methodparam>
|
||||
<methodparam>width</methodparam>
|
||||
<methodparam>height</methodparam>
|
||||
</methodsynopsis></programlisting>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><parameter>x</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>The pixel region's new x offset.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>y</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>The pixel region's new y offset.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>width</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>The pixel region's new width.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><parameter>height</parameter> :</term>
|
||||
<listitem>
|
||||
<simpara>The pixel region's new height.</simpara>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<para>Changes the position and the size of the pixel region.</para>
|
||||
</refsect2>
|
||||
</refsect1>
|
||||
</refentry>
|
33
plug-ins/pygimp/doc/reference/pygimp-ref.xml
Normal file
33
plug-ins/pygimp/doc/reference/pygimp-ref.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version='1.0'?>
|
||||
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
|
||||
<!ENTITY % entities SYSTEM "entities.docbook">
|
||||
%entities;
|
||||
<!ENTITY builddate SYSTEM "builddate.xml">
|
||||
]>
|
||||
|
||||
<book id="pygimp-reference" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<bookinfo>
|
||||
<pubdate>&builddate;</pubdate>
|
||||
<title>PyGimp Reference Manual</title>
|
||||
<edition>for version version;</edition>
|
||||
<releaseinfo>for PyGimp version version;</releaseinfo>
|
||||
<abstract>
|
||||
<para>This reference describes the classes of the gimp python
|
||||
module.</para>
|
||||
</abstract>
|
||||
</bookinfo>
|
||||
<toc>
|
||||
</toc>
|
||||
|
||||
<!--<xi:include href="pygimp-introduction.xml"/>-->
|
||||
|
||||
<xi:include href="pygimp-classes.xml"/>
|
||||
|
||||
<!--
|
||||
<index>
|
||||
<title>Index</title>
|
||||
</index>
|
||||
-->
|
||||
|
||||
</book>
|
16
plug-ins/pygimp/doc/reference/pygimp.xml
Normal file
16
plug-ins/pygimp/doc/reference/pygimp.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
|
||||
<refentry id="module-gimp">
|
||||
<refmeta>
|
||||
<refentrytitle>gimp</refentrytitle>
|
||||
<manvolnum>3</manvolnum>
|
||||
<refmiscinfo>PyGimp Docs</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gimp</refname>
|
||||
<refpurpose></refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
</refentry>
|
19
plug-ins/pygimp/doc/xsl/common.xsl
Normal file
19
plug-ins/pygimp/doc/xsl/common.xsl
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version='1.0'?>
|
||||
<!DOCTYPE xsl:stylesheet [
|
||||
]>
|
||||
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
version='1.0'>
|
||||
|
||||
<xsl:template match="parameter">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@role = 'keyword'">
|
||||
<xsl:call-template name="inline.boldmonoseq"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="inline.italicmonoseq"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
154
plug-ins/pygimp/doc/xsl/devhelp.xsl
Normal file
154
plug-ins/pygimp/doc/xsl/devhelp.xsl
Normal file
@@ -0,0 +1,154 @@
|
||||
<?xml version='1.0'?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
version='1.0'
|
||||
xmlns="http://www.devhelp.net/book"
|
||||
exclude-result-prefixes="#default">
|
||||
|
||||
<xsl:template name="generate.devhelp">
|
||||
<xsl:call-template name="write.chunk">
|
||||
<xsl:with-param name="filename">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$gtkdoc.bookname">
|
||||
<xsl:value-of select="$gtkdoc.bookname"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>book</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:text>.devhelp</xsl:text>
|
||||
</xsl:with-param>
|
||||
<xsl:with-param name="method" select="'xml'"/>
|
||||
<xsl:with-param name="indent" select="'yes'"/>
|
||||
<xsl:with-param name="encoding" select="'utf-8'"/>
|
||||
<xsl:with-param name="content">
|
||||
<xsl:call-template name="devhelp"/>
|
||||
</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="devhelp">
|
||||
<xsl:variable name="title">
|
||||
<xsl:apply-templates select="." mode="generate.devhelp.toc.title.mode"/>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="link">
|
||||
<xsl:call-template name="href.target"/>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="author">
|
||||
<xsl:if test="articleinfo|bookinfo">
|
||||
<xsl:apply-templates mode="generate.devhelp.authors"
|
||||
select="articleinfo|bookinfo"/>
|
||||
</xsl:if>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="toc.nodes" select="part|reference|preface|chapter|
|
||||
appendix|article|bibliography|
|
||||
glossary|index|refentry|
|
||||
bridgehead|sect1"/>
|
||||
|
||||
<book title="{$title}" link="{$link}" author="{$author}" name="{$gtkdoc.bookname}">
|
||||
<xsl:if test="$toc.nodes">
|
||||
<chapters>
|
||||
<xsl:apply-templates select="$toc.nodes"
|
||||
mode="generate.devhelp.toc.mode"/>
|
||||
</chapters>
|
||||
</xsl:if>
|
||||
<functions>
|
||||
<xsl:apply-templates select="//refsect1"
|
||||
mode="generate.devhelp.constructor.index.mode"/>
|
||||
<xsl:apply-templates select="//refsect2"
|
||||
mode="generate.devhelp.index.mode"/>
|
||||
</functions>
|
||||
</book>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="generate.devhelp.toc.mode">
|
||||
<xsl:variable name="title">
|
||||
<xsl:apply-templates select="." mode="generate.devhelp.toc.title.mode"/>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="target">
|
||||
<xsl:variable name="anchor" select="title/anchor"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$anchor">
|
||||
<xsl:call-template name="href.target">
|
||||
<xsl:with-param name="object" select="$anchor"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="href.target"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<sub name="{$title}" link="{$target}">
|
||||
<xsl:apply-templates select="section|sect1|
|
||||
refentry|refsect|
|
||||
bridgehead|part|chapter"
|
||||
mode="generate.devhelp.toc.mode"/>
|
||||
</sub>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="generate.devhelp.index.mode">
|
||||
<xsl:variable name="title" select="title"/>
|
||||
<xsl:variable name="anchor" select="title/anchor"/>
|
||||
<xsl:variable name="target">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$anchor">
|
||||
<xsl:call-template name="href.target">
|
||||
<xsl:with-param name="object" select="$anchor"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="href.target"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<function name="{$title}" link="{$target}"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="generate.devhelp.constructor.index.mode">
|
||||
<xsl:variable name="title" select="title"/>
|
||||
<xsl:variable name="anchor" select="title/anchor"/>
|
||||
<xsl:variable name="target">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$anchor">
|
||||
<xsl:call-template name="href.target">
|
||||
<xsl:with-param name="object" select="$anchor"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="href.target"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:if test="$title='Constructor'">
|
||||
<xsl:variable name ="constructor" select="programlisting//methodname"/>
|
||||
<function name="{$constructor}" link="{$target}"/>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!-- get title -->
|
||||
<xsl:template match="article" mode="generate.devhelp.toc.title.mode">
|
||||
<xsl:value-of select="articleinfo/title"/>
|
||||
</xsl:template>
|
||||
<xsl:template match="book" mode="generate.devhelp.toc.title.mode">
|
||||
<xsl:value-of select="bookinfo/title"/>
|
||||
</xsl:template>
|
||||
<xsl:template match="refentry" mode="generate.devhelp.toc.title.mode">
|
||||
<xsl:value-of select="refnamediv/refname"/>
|
||||
</xsl:template>
|
||||
<xsl:template match="*" mode="generate.devhelp.toc.title.mode">
|
||||
<xsl:value-of select="title"/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- generate list of authors ... -->
|
||||
<xsl:template match="articleinfo|bookinfo" mode="generate.devhelp.authors">
|
||||
<xsl:for-each select="authorgroup/author">
|
||||
<xsl:value-of select="firstname"/>
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:value-of select="surname"/>
|
||||
<xsl:if test="not(last())">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
67
plug-ins/pygimp/doc/xsl/fixxref.py.in
Normal file
67
plug-ins/pygimp/doc/xsl/fixxref.py.in
Normal file
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- Mode: Python; py-indent-offset: 4 -*-
|
||||
|
||||
import getopt
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
anchors = {}
|
||||
anchor_pat = re.compile(r'''^\s*<ANCHOR\s+id\s*=\s*"([^"]*)"\s+
|
||||
href\s*=\s*"([^"]*)"\s*>''',
|
||||
re.MULTILINE | re.VERBOSE)
|
||||
link_pat = re.compile(r'''<PYGTKDOCLINK\s+HREF="([^"]*)"\s*>(.*?)
|
||||
</PYGTKDOCLINK\s*>''', re.DOTALL | re.VERBOSE)
|
||||
def scan_index_dir(idir):
|
||||
for root, dirs, files in os.walk(idir):
|
||||
if 'index.sgml' in files:
|
||||
scan_index_file(os.path.join(root, 'index.sgml'))
|
||||
return
|
||||
|
||||
def scan_index_file(ifile):
|
||||
buf = open(ifile).read()
|
||||
for id, href in anchor_pat.findall(buf):
|
||||
anchors[id] = href
|
||||
|
||||
def fix_xrefs(hdir):
|
||||
for f in os.listdir(hdir):
|
||||
if os.path.splitext(f)[1] == '.html':
|
||||
fix_html_file(os.path.join(hdir, f))
|
||||
|
||||
def link_subst(m):
|
||||
id, text = m.groups()
|
||||
if anchors.has_key(id):
|
||||
return '<a\nhref="../' + anchors[id] + '"\n>' + text + '</a>'
|
||||
return text
|
||||
|
||||
def fix_html_file(hfile):
|
||||
buf = open(hfile).read()
|
||||
buf = link_pat.sub(link_subst, buf)
|
||||
open(hfile, 'w').write(buf)
|
||||
|
||||
def usage(e=None):
|
||||
if e:
|
||||
sys.stderr.write('fixxref.py: %s\n' % e)
|
||||
sys.stderr.write('usage: fixxref.py [-i index-dir] html-dir\n')
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:], "i:h:",
|
||||
["index-dir=", "html-dir="])
|
||||
except getopt.error, e:
|
||||
usage(e)
|
||||
|
||||
index_dirs = []
|
||||
for opt, arg in opts:
|
||||
if opt in ('-i', '--index-dir'):
|
||||
index_dirs.append(arg)
|
||||
|
||||
if len(args) != 1:
|
||||
usage()
|
||||
|
||||
for idir in index_dirs:
|
||||
scan_index_dir(idir)
|
||||
|
||||
html_dir = args[0]
|
||||
fix_xrefs(html_dir)
|
285
plug-ins/pygimp/doc/xsl/html.xsl
Normal file
285
plug-ins/pygimp/doc/xsl/html.xsl
Normal file
@@ -0,0 +1,285 @@
|
||||
<?xml version='1.0'?>
|
||||
<!DOCTYPE xsl:stylesheet [
|
||||
<!ENTITY RE " ">
|
||||
<!ENTITY nbsp " ">
|
||||
]>
|
||||
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
version='1.0'>
|
||||
|
||||
<xsl:param name="html.stylesheet">style.css</xsl:param>
|
||||
<xsl:param name="use.id.as.filename" select="1"/>
|
||||
<xsl:param name="chunk.fast" select="1"/>
|
||||
<xsl:param name="chunker.output.encoding" select="'utf-8'"/>
|
||||
|
||||
<xsl:param name="linenumbering.extension" select="1"/>
|
||||
<xsl:param name="variablelist.as.table" select="1"/>
|
||||
|
||||
<xsl:template match="blockquote">
|
||||
<div class="{local-name(.)}">
|
||||
<xsl:if test="@lang or @xml:lang">
|
||||
<xsl:call-template name="language.attribute"/>
|
||||
</xsl:if>
|
||||
<xsl:call-template name="anchor"/>
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="attribution">
|
||||
<table border="0" width="100%"
|
||||
cellspacing="0" cellpadding="0" class="blockquote"
|
||||
summary="Block quote">
|
||||
<tr>
|
||||
<td width="10%" valign="top"> </td>
|
||||
<td width="80%" valign="top">
|
||||
<xsl:apply-templates select="child::*[local-name(.)!='attribution']"/>
|
||||
</td>
|
||||
<td width="10%" valign="top"> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right" valign="top">
|
||||
<xsl:text>--</xsl:text>
|
||||
<xsl:apply-templates select="attribution"/>
|
||||
</td>
|
||||
<td width="10%" valign="top"> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</xsl:when>
|
||||
<xsl:when test="@role = 'properties' or @role = 'prototypes'">
|
||||
<table width="100%" border="0">
|
||||
<tr>
|
||||
<td valign="top">
|
||||
<xsl:apply-templates select="child::*[local-name(.)!='attribution']"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<blockquote class="{local-name(.)}">
|
||||
<xsl:apply-templates/>
|
||||
</blockquote>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<!-- support for Python language for synopsises -->
|
||||
<xsl:template match="classsynopsis
|
||||
|fieldsynopsis
|
||||
|methodsynopsis
|
||||
|constructorsynopsis
|
||||
|destructorsynopsis">
|
||||
<xsl:param name="language">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@language">
|
||||
<xsl:value-of select="@language"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$default-classsynopsis-language"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:param>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$language='python'">
|
||||
<xsl:apply-templates select="." mode="python"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-imports/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="classsynopsis" mode="python">
|
||||
<table width="100%">
|
||||
<tr><td>
|
||||
<pre class="{name(.)}">
|
||||
<xsl:text>class </xsl:text>
|
||||
<xsl:apply-templates select="ooclass[1]" mode="python"/>
|
||||
<xsl:if test="ooclass[position() > 1]">
|
||||
<xsl:text>(</xsl:text>
|
||||
<xsl:apply-templates select="ooclass[position() > 1]" mode="python"/> <xsl:text>)</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text>:&RE;</xsl:text>
|
||||
|
||||
<xsl:apply-templates select="constructorsynopsis
|
||||
|destructorsynopsis
|
||||
|fieldsynopsis
|
||||
|methodsynopsis
|
||||
|classsynopsisinfo" mode="python"/>
|
||||
</pre></td></tr></table>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="classsynopsisinfo" mode="python">
|
||||
<xsl:apply-templates mode="python"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="ooclass|oointerface|ooexception" mode="python">
|
||||
<xsl:if test="position() > 1">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:if>
|
||||
<span class="{name(.)}">
|
||||
<xsl:apply-templates mode="python"/>
|
||||
</span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="modifier" mode="python">
|
||||
<span class="{name(.)}">
|
||||
<xsl:apply-templates mode="python"/>
|
||||
<xsl:text> </xsl:text>
|
||||
</span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="classname" mode="python">
|
||||
<xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:if>
|
||||
<span class="{name(.)}">
|
||||
<xsl:apply-templates mode="python"/>
|
||||
</span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="interfacename" mode="python">
|
||||
<xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:if>
|
||||
<span class="{name(.)}">
|
||||
<xsl:apply-templates mode="python"/>
|
||||
</span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="exceptionname" mode="python">
|
||||
<xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:if>
|
||||
<span class="{name(.)}">
|
||||
<xsl:apply-templates mode="python"/>
|
||||
</span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="fieldsynopsis" mode="python">
|
||||
<code class="{name(.)}">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:apply-templates mode="python"/>
|
||||
</code>
|
||||
<xsl:call-template name="synop-break"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="type" mode="python">
|
||||
<span class="{name(.)}">
|
||||
<xsl:apply-templates mode="python"/>
|
||||
<xsl:text> </xsl:text>
|
||||
</span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="varname" mode="python">
|
||||
<span class="{name(.)}">
|
||||
<xsl:apply-templates mode="python"/>
|
||||
<xsl:text> </xsl:text>
|
||||
</span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="initializer" mode="python">
|
||||
<span class="{name(.)}">
|
||||
<xsl:text>=</xsl:text>
|
||||
<xsl:apply-templates mode="python"/>
|
||||
</span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="void" mode="python">
|
||||
<span class="{name(.)}">
|
||||
<xsl:text>void </xsl:text>
|
||||
</span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="methodname" mode="python">
|
||||
<span class="{name(.)}">
|
||||
<xsl:apply-templates mode="python"/>
|
||||
</span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="methodparam" mode="python">
|
||||
<xsl:if test="position() > 1">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:if>
|
||||
<span class="{name(.)}">
|
||||
<xsl:apply-templates mode="python"/>
|
||||
</span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template mode="python"
|
||||
match="destructorsynopsis|methodsynopsis">
|
||||
|
||||
<code class="{name(.)}">
|
||||
<xsl:text> def </xsl:text>
|
||||
<xsl:apply-templates select="methodname" mode="python"/>
|
||||
<xsl:text>(</xsl:text>
|
||||
<xsl:apply-templates select="methodparam" mode="python"/>
|
||||
<xsl:text>)</xsl:text>
|
||||
</code>
|
||||
<xsl:call-template name="synop-break"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template mode="python"
|
||||
match="constructorsynopsis">
|
||||
|
||||
<code class="{name(.)}">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:apply-templates select="methodname" mode="python"/>
|
||||
<xsl:text>(</xsl:text>
|
||||
<xsl:apply-templates select="methodparam" mode="python"/>
|
||||
<xsl:text>)</xsl:text>
|
||||
</code>
|
||||
<xsl:call-template name="synop-break"/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- this was the original parameter python mode styling
|
||||
<xsl:template match="parameter" mode="python">
|
||||
<span class="{name(.)}">
|
||||
<xsl:apply-templates mode="python"/>
|
||||
</span>
|
||||
</xsl:template>
|
||||
-->
|
||||
|
||||
<!-- hack -->
|
||||
<xsl:template match="link" mode="python">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- ========================================================= -->
|
||||
<!-- template to output gtkdoclink elements for the unknown targets -->
|
||||
|
||||
<xsl:template match="link">
|
||||
<xsl:choose>
|
||||
<xsl:when test="id(@linkend)">
|
||||
<xsl:apply-imports/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<PYGTKDOCLINK HREF="{@linkend}">
|
||||
<xsl:apply-templates/>
|
||||
</PYGTKDOCLINK>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="parameter" mode="python">
|
||||
<span class="{name(.)}">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@role = 'keyword'">
|
||||
<xsl:call-template name="inline.boldmonoseq"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="inline.italicmonoseq"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</span>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="variablelist">
|
||||
<table border="0" width="100%">
|
||||
<col align="left" valign="top" width="0*">
|
||||
</col>
|
||||
<tbody>
|
||||
<xsl:apply-templates select="varlistentry" mode="varlist-table"/>
|
||||
</tbody>
|
||||
</table>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
11
plug-ins/pygimp/doc/xsl/pdf-style.xsl
Normal file
11
plug-ins/pygimp/doc/xsl/pdf-style.xsl
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version='1.0'?> <!--*- mode: xml -*-->
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
version='1.0'>
|
||||
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"/>
|
||||
<xsl:include href="common.xsl"/>
|
||||
<xsl:include href="pdf.xsl"/>
|
||||
|
||||
<xsl:param name="section.autolabel" select="1"/>
|
||||
<xsl:param name="section.label.includes.component.label" select="1"/>
|
||||
|
||||
</xsl:stylesheet>
|
259
plug-ins/pygimp/doc/xsl/pdf.xsl
Normal file
259
plug-ins/pygimp/doc/xsl/pdf.xsl
Normal file
@@ -0,0 +1,259 @@
|
||||
<?xml version='1.0'?>
|
||||
<!DOCTYPE xsl:stylesheet [
|
||||
<!ENTITY RE " ">
|
||||
<!ENTITY nbsp " ">
|
||||
]>
|
||||
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
||||
version='1.0'>
|
||||
|
||||
<xsl:param name="body.margin.top">0.5in</xsl:param>
|
||||
|
||||
<xsl:template name="is.graphic.extension">
|
||||
<xsl:param name="ext"></xsl:param>
|
||||
<xsl:if test="$ext = 'png'
|
||||
or $ext = 'pdf'
|
||||
or $ext = 'jpeg'
|
||||
or $ext = 'gif'
|
||||
or $ext = 'tif'
|
||||
or $ext = 'tiff'
|
||||
or $ext = 'bmp'">1</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!-- support for Python language for synopsises -->
|
||||
<xsl:template match="classsynopsis
|
||||
|fieldsynopsis
|
||||
|methodsynopsis
|
||||
|constructorsynopsis
|
||||
|destructorsynopsis">
|
||||
<xsl:param name="language">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@language">
|
||||
<xsl:value-of select="@language"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$default-classsynopsis-language"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:param>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$language='python'">
|
||||
<xsl:apply-templates select="." mode="python"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-imports/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="classsynopsis" mode="python">
|
||||
<fo:block wrap-option='no-wrap'
|
||||
white-space-collapse='false'
|
||||
linefeed-treatment="preserve"
|
||||
xsl:use-attribute-sets="monospace.verbatim.properties"
|
||||
background-color="#E0E0E0">
|
||||
<xsl:text>class </xsl:text>
|
||||
<xsl:apply-templates select="ooclass[1]" mode="python"/>
|
||||
<xsl:if test="ooclass[position() > 1]">
|
||||
<xsl:text>(</xsl:text>
|
||||
<xsl:apply-templates select="ooclass[position() > 1]" mode="python"/>
|
||||
<xsl:text>)</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:text> :</xsl:text>
|
||||
|
||||
<xsl:apply-templates select="constructorsynopsis
|
||||
|destructorsynopsis
|
||||
|fieldsynopsis
|
||||
|methodsynopsis
|
||||
|classsynopsisinfo" mode="python"/>
|
||||
|
||||
</fo:block>
|
||||
<xsl:text>&RE;</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="classsynopsisinfo" mode="python">
|
||||
<xsl:apply-templates mode="python"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="ooclass|oointerface|ooexception" mode="python">
|
||||
<xsl:if test="position() > 1">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates mode="python"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="modifier" mode="python">
|
||||
<xsl:apply-templates mode="python"/>
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="classname" mode="python">
|
||||
<xsl:if test="name(preceding-sibling::*[1]) = 'classname'">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates mode="python"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="interfacename" mode="python">
|
||||
<xsl:if test="name(preceding-sibling::*[1]) = 'interfacename'">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates mode="python"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="exceptionname" mode="python">
|
||||
<xsl:if test="name(preceding-sibling::*[1]) = 'exceptionname'">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates mode="python"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="fieldsynopsis" mode="python">
|
||||
<fo:block wrap-option='no-wrap'
|
||||
white-space-collapse='false'
|
||||
linefeed-treatment="preserve"
|
||||
xsl:use-attribute-sets="monospace.verbatim.properties">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:apply-templates mode="python"/>
|
||||
<xsl:call-template name="synop-break"/>
|
||||
</fo:block>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="type" mode="python">
|
||||
<xsl:apply-templates mode="python"/>
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="varname" mode="python">
|
||||
<xsl:apply-templates mode="python"/>
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="initializer" mode="python">
|
||||
<xsl:text>=</xsl:text>
|
||||
<xsl:apply-templates mode="python"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="void" mode="python">
|
||||
<xsl:text>void </xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="methodname" mode="python">
|
||||
<xsl:apply-templates mode="python"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="methodparam" mode="python">
|
||||
<xsl:if test="position() > 1">
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates mode="python"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template mode="python"
|
||||
match="destructorsynopsis|methodsynopsis">
|
||||
|
||||
<fo:block wrap-option='no-wrap'
|
||||
white-space-collapse='false'
|
||||
linefeed-treatment="preserve"
|
||||
xsl:use-attribute-sets="monospace.verbatim.properties">
|
||||
<xsl:text> def </xsl:text>
|
||||
<xsl:apply-templates select="methodname" mode="python"/>
|
||||
<xsl:text>(</xsl:text>
|
||||
<xsl:apply-templates select="methodparam" mode="python"/>
|
||||
<xsl:text>)</xsl:text>
|
||||
<!-- <xsl:call-template name="synop-break"/> -->
|
||||
</fo:block>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template mode="python"
|
||||
match="constructorsynopsis">
|
||||
<fo:block wrap-option='no-wrap'
|
||||
white-space-collapse='false'
|
||||
linefeed-treatment="preserve"
|
||||
xsl:use-attribute-sets="monospace.verbatim.properties">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:apply-templates select="methodname" mode="python"/>
|
||||
<xsl:text>(</xsl:text>
|
||||
<xsl:apply-templates select="methodparam" mode="python"/>
|
||||
<xsl:text>)</xsl:text>
|
||||
</fo:block>
|
||||
</xsl:template>
|
||||
|
||||
<!-- hack -->
|
||||
<xsl:template match="link" mode="python">
|
||||
<xsl:apply-templates select="."/>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
<xsl:template match="variablelist" mode="vl.as.blocks">
|
||||
<xsl:variable name="id">
|
||||
<xsl:call-template name="object.id"/>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:if test="title">
|
||||
<xsl:apply-templates select="title" mode="list.title.mode"/>
|
||||
</xsl:if>
|
||||
|
||||
<fo:block id="{$id}"
|
||||
xsl:use-attribute-sets="list.block.spacing"
|
||||
background-color="#FFECCE">
|
||||
<xsl:apply-templates mode="vl.as.blocks"/>
|
||||
</fo:block>
|
||||
</xsl:template>
|
||||
-->
|
||||
|
||||
<!--
|
||||
<xsl:template match="variablelist">
|
||||
<fo:table border="0"
|
||||
width="100%"
|
||||
background-color="#FFECCE"
|
||||
table-layout="fixed">
|
||||
<fo:table-column
|
||||
align="left"
|
||||
column-width="20%"
|
||||
column-number="1">
|
||||
</fo:table-column>
|
||||
<fo:table-column
|
||||
align="left"
|
||||
column-width="80%"
|
||||
column-number="2">
|
||||
</fo:table-column>
|
||||
<fo:table-body>
|
||||
<xsl:apply-templates select="varlistentry"/>
|
||||
</fo:table-body>
|
||||
</fo:table>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="varlistentry">
|
||||
<fo:table-row>
|
||||
<fo:table-cell>
|
||||
<fo:block
|
||||
background-color="#FFECCE">
|
||||
<xsl:apply-templates select="term"/>
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
<fo:table-cell>
|
||||
<fo:block
|
||||
background-color="#FFECCE">
|
||||
<xsl:apply-templates select="listitem"/>
|
||||
</fo:block>
|
||||
</fo:table-cell>
|
||||
</fo:table-row>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="varlistentry/term">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>, </xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="varlistentry/term[position()=last()]" priority="2">
|
||||
<xsl:apply-templates/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="varlistentry/listitem">
|
||||
<xsl:apply-templates/>
|
||||
</xsl:template>
|
||||
-->
|
||||
|
||||
</xsl:stylesheet>
|
54
plug-ins/pygimp/doc/xsl/ref-html-style.xsl
Normal file
54
plug-ins/pygimp/doc/xsl/ref-html-style.xsl
Normal file
@@ -0,0 +1,54 @@
|
||||
<?xml version='1.0'?>
|
||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
version='1.0'>
|
||||
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"/>
|
||||
<xsl:include href="common.xsl"/>
|
||||
<xsl:include href="html.xsl"/>
|
||||
<xsl:include href="devhelp.xsl"/>
|
||||
|
||||
<!-- ========================================================= -->
|
||||
<!-- template to create the index.sgml anchor index -->
|
||||
|
||||
<xsl:template name="generate.index">
|
||||
<xsl:call-template name="write.text.chunk">
|
||||
<xsl:with-param name="filename" select="'index.sgml'"/>
|
||||
<xsl:with-param name="content">
|
||||
<!-- check all anchor and refentry elements -->
|
||||
<xsl:apply-templates select="//anchor|//refentry|//refsect1|//refsect2|//book"
|
||||
mode="generate.index.mode"/>
|
||||
</xsl:with-param>
|
||||
<xsl:with-param name="encoding" select="'utf-8'"/>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="generate.index.mode">
|
||||
<xsl:if test="not(@href)">
|
||||
<xsl:if test="@id">
|
||||
<xsl:text><ANCHOR id="</xsl:text>
|
||||
<xsl:value-of select="@id"/>
|
||||
<xsl:text>" href="</xsl:text>
|
||||
<xsl:if test="$gtkdoc.bookname">
|
||||
<xsl:value-of select="$gtkdoc.bookname"/>
|
||||
<xsl:text>/</xsl:text>
|
||||
</xsl:if>
|
||||
<xsl:call-template name="href.target"/>
|
||||
<xsl:text>">
|
||||
</xsl:text>
|
||||
</xsl:if>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:param name="gtkdoc.version" select="''"/>
|
||||
<xsl:param name="gtkdoc.bookname" select="''"/>
|
||||
|
||||
<xsl:param name="refentry.generate.name" select="0"/>
|
||||
<xsl:param name="refentry.generate.title" select="1"/>
|
||||
<xsl:param name="chapter.autolabel" select="0"/>
|
||||
|
||||
<xsl:template match="book|article">
|
||||
<xsl:apply-imports/>
|
||||
<xsl:call-template name="generate.devhelp"/>
|
||||
<xsl:call-template name="generate.index"/>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
51
plug-ins/pygimp/enums.py
Normal file
51
plug-ins/pygimp/enums.py
Normal file
@@ -0,0 +1,51 @@
|
||||
# Gimp-Python - allows the writing of Gimp plugins in Python.
|
||||
# Copyright (C) 2005 Manish Singh <yosh@gimp.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# enums.py -- constants for use with the gimp module
|
||||
#
|
||||
# this file pulls in constants that are useful for use in
|
||||
# gimp plugins. Just add 'from gimpenums import *' to the top
|
||||
# of the script
|
||||
|
||||
from _enums import *
|
||||
|
||||
# This is from pygtk/gtk/__init__.py
|
||||
# Copyright (C) 1998-2003 James Henstridge
|
||||
|
||||
class _DeprecatedConstant:
|
||||
def __init__(self, value, name, suggestion):
|
||||
self._v = value
|
||||
self._name = name
|
||||
self._suggestion = suggestion
|
||||
|
||||
def _deprecated(self, value):
|
||||
import warnings
|
||||
message = '%s is deprecated, use %s instead' % (self._name,
|
||||
self._suggestion)
|
||||
warnings.warn(message, DeprecationWarning, 3)
|
||||
return value
|
||||
|
||||
__nonzero__ = lambda self: self._deprecated(self._v == True)
|
||||
__int__ = lambda self: self._deprecated(int(self._v))
|
||||
__str__ = lambda self: self._deprecated(str(self._v))
|
||||
__repr__ = lambda self: self._deprecated(repr(self._v))
|
||||
__cmp__ = lambda self, other: self._deprecated(cmp(self._v, other))
|
||||
|
||||
TRUE = _DeprecatedConstant(True, 'enums.TRUE', 'True')
|
||||
FALSE = _DeprecatedConstant(False, 'enums.FALSE', 'False')
|
||||
|
||||
del _DeprecatedConstant
|
2
plug-ins/pygimp/gimpcolor.py
Normal file
2
plug-ins/pygimp/gimpcolor.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from gimp.color import *
|
||||
from gimp.color import _PyGimpColor_API
|
@@ -392,17 +392,17 @@ static char gimpcolor_doc[] =
|
||||
"This module provides interfaces to allow you to write gimp plugins"
|
||||
;
|
||||
|
||||
void initgimpcolor(void);
|
||||
void initcolor(void);
|
||||
|
||||
PyMODINIT_FUNC
|
||||
initgimpcolor(void)
|
||||
initcolor(void)
|
||||
{
|
||||
PyObject *m, *d;
|
||||
|
||||
pygimp_init_pygobject();
|
||||
|
||||
/* Create the module and add the functions */
|
||||
m = Py_InitModule3("gimpcolor", gimpcolor_methods, gimpcolor_doc);
|
||||
m = Py_InitModule3("color", gimpcolor_methods, gimpcolor_doc);
|
||||
|
||||
d = PyModule_GetDict(m);
|
||||
|
||||
|
@@ -219,8 +219,462 @@
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum SelectCriterion
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpSelectCriterion")
|
||||
(gtype-id "GIMP_TYPE_SELECT_CRITERION")
|
||||
(values
|
||||
'("composite" "GIMP_SELECT_CRITERION_COMPOSITE")
|
||||
'("r" "GIMP_SELECT_CRITERION_R")
|
||||
'("g" "GIMP_SELECT_CRITERION_G")
|
||||
'("b" "GIMP_SELECT_CRITERION_B")
|
||||
'("h" "GIMP_SELECT_CRITERION_H")
|
||||
'("s" "GIMP_SELECT_CRITERION_S")
|
||||
'("v" "GIMP_SELECT_CRITERION_V")
|
||||
)
|
||||
)
|
||||
|
||||
;; From ../../libgimp/gimpenums.h
|
||||
(define-enum AddMaskType
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpAddMaskType")
|
||||
(gtype-id "GIMP_TYPE_ADD_MASK_TYPE")
|
||||
(values
|
||||
'("white-mask" "GIMP_ADD_WHITE_MASK")
|
||||
'("black-mask" "GIMP_ADD_BLACK_MASK")
|
||||
'("alpha-mask" "GIMP_ADD_ALPHA_MASK")
|
||||
'("alpha-transfer-mask" "GIMP_ADD_ALPHA_TRANSFER_MASK")
|
||||
'("selection-mask" "GIMP_ADD_SELECTION_MASK")
|
||||
'("copy-mask" "GIMP_ADD_COPY_MASK")
|
||||
'("channel-mask" "GIMP_ADD_CHANNEL_MASK")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum BlendMode
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpBlendMode")
|
||||
(gtype-id "GIMP_TYPE_BLEND_MODE")
|
||||
(values
|
||||
'("fg-bg-rgb-mode" "GIMP_FG_BG_RGB_MODE")
|
||||
'("fg-bg-hsv-mode" "GIMP_FG_BG_HSV_MODE")
|
||||
'("fg-transparent-mode" "GIMP_FG_TRANSPARENT_MODE")
|
||||
'("custom-mode" "GIMP_CUSTOM_MODE")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum BucketFillMode
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpBucketFillMode")
|
||||
(gtype-id "GIMP_TYPE_BUCKET_FILL_MODE")
|
||||
(values
|
||||
'("fg-bucket-fill" "GIMP_FG_BUCKET_FILL")
|
||||
'("bg-bucket-fill" "GIMP_BG_BUCKET_FILL")
|
||||
'("pattern-bucket-fill" "GIMP_PATTERN_BUCKET_FILL")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum ChannelOps
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpChannelOps")
|
||||
(gtype-id "GIMP_TYPE_CHANNEL_OPS")
|
||||
(values
|
||||
'("add" "GIMP_CHANNEL_OP_ADD")
|
||||
'("subtract" "GIMP_CHANNEL_OP_SUBTRACT")
|
||||
'("replace" "GIMP_CHANNEL_OP_REPLACE")
|
||||
'("intersect" "GIMP_CHANNEL_OP_INTERSECT")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum ChannelType
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpChannelType")
|
||||
(gtype-id "GIMP_TYPE_CHANNEL_TYPE")
|
||||
(values
|
||||
'("red-channel" "GIMP_RED_CHANNEL")
|
||||
'("green-channel" "GIMP_GREEN_CHANNEL")
|
||||
'("blue-channel" "GIMP_BLUE_CHANNEL")
|
||||
'("gray-channel" "GIMP_GRAY_CHANNEL")
|
||||
'("indexed-channel" "GIMP_INDEXED_CHANNEL")
|
||||
'("alpha-channel" "GIMP_ALPHA_CHANNEL")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum CheckSize
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpCheckSize")
|
||||
(gtype-id "GIMP_TYPE_CHECK_SIZE")
|
||||
(values
|
||||
'("small-checks" "GIMP_CHECK_SIZE_SMALL_CHECKS")
|
||||
'("medium-checks" "GIMP_CHECK_SIZE_MEDIUM_CHECKS")
|
||||
'("large-checks" "GIMP_CHECK_SIZE_LARGE_CHECKS")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum CheckType
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpCheckType")
|
||||
(gtype-id "GIMP_TYPE_CHECK_TYPE")
|
||||
(values
|
||||
'("light-checks" "GIMP_CHECK_TYPE_LIGHT_CHECKS")
|
||||
'("gray-checks" "GIMP_CHECK_TYPE_GRAY_CHECKS")
|
||||
'("dark-checks" "GIMP_CHECK_TYPE_DARK_CHECKS")
|
||||
'("white-only" "GIMP_CHECK_TYPE_WHITE_ONLY")
|
||||
'("gray-only" "GIMP_CHECK_TYPE_GRAY_ONLY")
|
||||
'("black-only" "GIMP_CHECK_TYPE_BLACK_ONLY")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum CloneType
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpCloneType")
|
||||
(gtype-id "GIMP_TYPE_CLONE_TYPE")
|
||||
(values
|
||||
'("image-clone" "GIMP_IMAGE_CLONE")
|
||||
'("pattern-clone" "GIMP_PATTERN_CLONE")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum DesaturateMode
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpDesaturateMode")
|
||||
(gtype-id "GIMP_TYPE_DESATURATE_MODE")
|
||||
(values
|
||||
'("lightness" "GIMP_DESATURATE_LIGHTNESS")
|
||||
'("luminosity" "GIMP_DESATURATE_LUMINOSITY")
|
||||
'("average" "GIMP_DESATURATE_AVERAGE")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum DodgeBurnType
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpDodgeBurnType")
|
||||
(gtype-id "GIMP_TYPE_DODGE_BURN_TYPE")
|
||||
(values
|
||||
'("dodge" "GIMP_DODGE")
|
||||
'("burn" "GIMP_BURN")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum ForegroundExtractMode
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpForegroundExtractMode")
|
||||
(gtype-id "GIMP_TYPE_FOREGROUND_EXTRACT_MODE")
|
||||
(values
|
||||
'("x" "GIMP_FOREGROUND_EXTRACT_SIOX")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum GradientType
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpGradientType")
|
||||
(gtype-id "GIMP_TYPE_GRADIENT_TYPE")
|
||||
(values
|
||||
'("linear" "GIMP_GRADIENT_LINEAR")
|
||||
'("bilinear" "GIMP_GRADIENT_BILINEAR")
|
||||
'("radial" "GIMP_GRADIENT_RADIAL")
|
||||
'("square" "GIMP_GRADIENT_SQUARE")
|
||||
'("conical-symmetric" "GIMP_GRADIENT_CONICAL_SYMMETRIC")
|
||||
'("conical-asymmetric" "GIMP_GRADIENT_CONICAL_ASYMMETRIC")
|
||||
'("shapeburst-angular" "GIMP_GRADIENT_SHAPEBURST_ANGULAR")
|
||||
'("shapeburst-spherical" "GIMP_GRADIENT_SHAPEBURST_SPHERICAL")
|
||||
'("shapeburst-dimpled" "GIMP_GRADIENT_SHAPEBURST_DIMPLED")
|
||||
'("spiral-clockwise" "GIMP_GRADIENT_SPIRAL_CLOCKWISE")
|
||||
'("spiral-anticlockwise" "GIMP_GRADIENT_SPIRAL_ANTICLOCKWISE")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum GridStyle
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpGridStyle")
|
||||
(gtype-id "GIMP_TYPE_GRID_STYLE")
|
||||
(values
|
||||
'("dots" "GIMP_GRID_DOTS")
|
||||
'("intersections" "GIMP_GRID_INTERSECTIONS")
|
||||
'("on-off-dash" "GIMP_GRID_ON_OFF_DASH")
|
||||
'("double-dash" "GIMP_GRID_DOUBLE_DASH")
|
||||
'("solid" "GIMP_GRID_SOLID")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum IconType
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpIconType")
|
||||
(gtype-id "GIMP_TYPE_ICON_TYPE")
|
||||
(values
|
||||
'("stock-id" "GIMP_ICON_TYPE_STOCK_ID")
|
||||
'("inline-pixbuf" "GIMP_ICON_TYPE_INLINE_PIXBUF")
|
||||
'("image-file" "GIMP_ICON_TYPE_IMAGE_FILE")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum ImageBaseType
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpImageBaseType")
|
||||
(gtype-id "GIMP_TYPE_IMAGE_BASE_TYPE")
|
||||
(values
|
||||
'("rgb" "GIMP_RGB")
|
||||
'("gray" "GIMP_GRAY")
|
||||
'("indexed" "GIMP_INDEXED")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum ImageType
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpImageType")
|
||||
(gtype-id "GIMP_TYPE_IMAGE_TYPE")
|
||||
(values
|
||||
'("rgb-image" "GIMP_RGB_IMAGE")
|
||||
'("rgba-image" "GIMP_RGBA_IMAGE")
|
||||
'("gray-image" "GIMP_GRAY_IMAGE")
|
||||
'("graya-image" "GIMP_GRAYA_IMAGE")
|
||||
'("indexed-image" "GIMP_INDEXED_IMAGE")
|
||||
'("indexeda-image" "GIMP_INDEXEDA_IMAGE")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum InterpolationType
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpInterpolationType")
|
||||
(gtype-id "GIMP_TYPE_INTERPOLATION_TYPE")
|
||||
(values
|
||||
'("none" "GIMP_INTERPOLATION_NONE")
|
||||
'("linear" "GIMP_INTERPOLATION_LINEAR")
|
||||
'("cubic" "GIMP_INTERPOLATION_CUBIC")
|
||||
'("lanczos" "GIMP_INTERPOLATION_LANCZOS")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum PaintApplicationMode
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpPaintApplicationMode")
|
||||
(gtype-id "GIMP_TYPE_PAINT_APPLICATION_MODE")
|
||||
(values
|
||||
'("constant" "GIMP_PAINT_CONSTANT")
|
||||
'("incremental" "GIMP_PAINT_INCREMENTAL")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum RepeatMode
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpRepeatMode")
|
||||
(gtype-id "GIMP_TYPE_REPEAT_MODE")
|
||||
(values
|
||||
'("none" "GIMP_REPEAT_NONE")
|
||||
'("sawtooth" "GIMP_REPEAT_SAWTOOTH")
|
||||
'("triangular" "GIMP_REPEAT_TRIANGULAR")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum RunMode
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpRunMode")
|
||||
(gtype-id "GIMP_TYPE_RUN_MODE")
|
||||
(values
|
||||
'("interactive" "GIMP_RUN_INTERACTIVE")
|
||||
'("noninteractive" "GIMP_RUN_NONINTERACTIVE")
|
||||
'("with-last-vals" "GIMP_RUN_WITH_LAST_VALS")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum SizeType
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpSizeType")
|
||||
(gtype-id "GIMP_TYPE_SIZE_TYPE")
|
||||
(values
|
||||
'("ixels" "GIMP_PIXELS")
|
||||
'("oints" "GIMP_POINTS")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum TransferMode
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpTransferMode")
|
||||
(gtype-id "GIMP_TYPE_TRANSFER_MODE")
|
||||
(values
|
||||
'("shadows" "GIMP_SHADOWS")
|
||||
'("midtones" "GIMP_MIDTONES")
|
||||
'("highlights" "GIMP_HIGHLIGHTS")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum TransformDirection
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpTransformDirection")
|
||||
(gtype-id "GIMP_TYPE_TRANSFORM_DIRECTION")
|
||||
(values
|
||||
'("forward" "GIMP_TRANSFORM_FORWARD")
|
||||
'("backward" "GIMP_TRANSFORM_BACKWARD")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum TransformResize
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpTransformResize")
|
||||
(gtype-id "GIMP_TYPE_TRANSFORM_RESIZE")
|
||||
(values
|
||||
'("adjust" "GIMP_TRANSFORM_RESIZE_ADJUST")
|
||||
'("clip" "GIMP_TRANSFORM_RESIZE_CLIP")
|
||||
'("crop" "GIMP_TRANSFORM_RESIZE_CROP")
|
||||
'("crop-with-aspect" "GIMP_TRANSFORM_RESIZE_CROP_WITH_ASPECT")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum Unit
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpUnit")
|
||||
(gtype-id "GIMP_TYPE_UNIT")
|
||||
(values
|
||||
'("pixel" "GIMP_UNIT_PIXEL")
|
||||
'("inch" "GIMP_UNIT_INCH")
|
||||
'("mm" "GIMP_UNIT_MM")
|
||||
'("point" "GIMP_UNIT_POINT")
|
||||
'("pica" "GIMP_UNIT_PICA")
|
||||
'("end" "GIMP_UNIT_END")
|
||||
'("percent" "GIMP_UNIT_PERCENT")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum PDBArgType
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpPDBArgType")
|
||||
(gtype-id "GIMP_TYPE_PDB_ARG_TYPE")
|
||||
(values
|
||||
'("int32" "GIMP_PDB_INT32")
|
||||
'("int16" "GIMP_PDB_INT16")
|
||||
'("int8" "GIMP_PDB_INT8")
|
||||
'("float" "GIMP_PDB_FLOAT")
|
||||
'("string" "GIMP_PDB_STRING")
|
||||
'("int32array" "GIMP_PDB_INT32ARRAY")
|
||||
'("int16array" "GIMP_PDB_INT16ARRAY")
|
||||
'("int8array" "GIMP_PDB_INT8ARRAY")
|
||||
'("floatarray" "GIMP_PDB_FLOATARRAY")
|
||||
'("stringarray" "GIMP_PDB_STRINGARRAY")
|
||||
'("color" "GIMP_PDB_COLOR")
|
||||
'("region" "GIMP_PDB_REGION")
|
||||
'("display" "GIMP_PDB_DISPLAY")
|
||||
'("image" "GIMP_PDB_IMAGE")
|
||||
'("layer" "GIMP_PDB_LAYER")
|
||||
'("channel" "GIMP_PDB_CHANNEL")
|
||||
'("drawable" "GIMP_PDB_DRAWABLE")
|
||||
'("selection" "GIMP_PDB_SELECTION")
|
||||
'("boundary" "GIMP_PDB_BOUNDARY")
|
||||
'("vectors" "GIMP_PDB_VECTORS")
|
||||
'("parasite" "GIMP_PDB_PARASITE")
|
||||
'("status" "GIMP_PDB_STATUS")
|
||||
'("end" "GIMP_PDB_END")
|
||||
'("path" "GIMP_PDB_PATH")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum PDBProcType
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpPDBProcType")
|
||||
(gtype-id "GIMP_TYPE_PDB_PROC_TYPE")
|
||||
(values
|
||||
'("internal" "GIMP_INTERNAL")
|
||||
'("plugin" "GIMP_PLUGIN")
|
||||
'("extension" "GIMP_EXTENSION")
|
||||
'("temporary" "GIMP_TEMPORARY")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum PDBStatusType
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpPDBStatusType")
|
||||
(gtype-id "GIMP_TYPE_PDB_STATUS_TYPE")
|
||||
(values
|
||||
'("execution-error" "GIMP_PDB_EXECUTION_ERROR")
|
||||
'("calling-error" "GIMP_PDB_CALLING_ERROR")
|
||||
'("pass-through" "GIMP_PDB_PASS_THROUGH")
|
||||
'("success" "GIMP_PDB_SUCCESS")
|
||||
'("cancel" "GIMP_PDB_CANCEL")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum MessageHandlerType
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpMessageHandlerType")
|
||||
(gtype-id "GIMP_TYPE_MESSAGE_HANDLER_TYPE")
|
||||
(values
|
||||
'("message-box" "GIMP_MESSAGE_BOX")
|
||||
'("console" "GIMP_CONSOLE")
|
||||
'("error-console" "GIMP_ERROR_CONSOLE")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum StackTraceMode
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpStackTraceMode")
|
||||
(gtype-id "GIMP_TYPE_STACK_TRACE_MODE")
|
||||
(values
|
||||
'("never" "GIMP_STACK_TRACE_NEVER")
|
||||
'("query" "GIMP_STACK_TRACE_QUERY")
|
||||
'("always" "GIMP_STACK_TRACE_ALWAYS")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum ProgressCommand
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpProgressCommand")
|
||||
(gtype-id "GIMP_TYPE_PROGRESS_COMMAND")
|
||||
(values
|
||||
'("start" "GIMP_PROGRESS_COMMAND_START")
|
||||
'("end" "GIMP_PROGRESS_COMMAND_END")
|
||||
'("set-text" "GIMP_PROGRESS_COMMAND_SET_TEXT")
|
||||
'("set-value" "GIMP_PROGRESS_COMMAND_SET_VALUE")
|
||||
'("pulse" "GIMP_PROGRESS_COMMAND_PULSE")
|
||||
'("get-window" "GIMP_PROGRESS_COMMAND_GET_WINDOW")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum TextDirection
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpTextDirection")
|
||||
(gtype-id "GIMP_TYPE_TEXT_DIRECTION")
|
||||
(values
|
||||
'("ltr" "GIMP_TEXT_DIRECTION_LTR")
|
||||
'("rtl" "GIMP_TEXT_DIRECTION_RTL")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum TextJustification
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpTextJustification")
|
||||
(gtype-id "GIMP_TYPE_TEXT_JUSTIFICATION")
|
||||
(values
|
||||
'("left" "GIMP_TEXT_JUSTIFY_LEFT")
|
||||
'("right" "GIMP_TEXT_JUSTIFY_RIGHT")
|
||||
'("center" "GIMP_TEXT_JUSTIFY_CENTER")
|
||||
'("fill" "GIMP_TEXT_JUSTIFY_FILL")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum UserDirectory
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpUserDirectory")
|
||||
(gtype-id "GIMP_TYPE_USER_DIRECTORY")
|
||||
(values
|
||||
'("desktop" "GIMP_USER_DIRECTORY_DESKTOP")
|
||||
'("documents" "GIMP_USER_DIRECTORY_DOCUMENTS")
|
||||
'("download" "GIMP_USER_DIRECTORY_DOWNLOAD")
|
||||
'("music" "GIMP_USER_DIRECTORY_MUSIC")
|
||||
'("pictures" "GIMP_USER_DIRECTORY_PICTURES")
|
||||
'("public-share" "GIMP_USER_DIRECTORY_PUBLIC_SHARE")
|
||||
'("templates" "GIMP_USER_DIRECTORY_TEMPLATES")
|
||||
'("videos" "GIMP_USER_DIRECTORY_VIDEOS")
|
||||
)
|
||||
)
|
||||
|
||||
(define-enum VectorsStrokeType
|
||||
(in-module "Gimp")
|
||||
(c-name "GimpVectorsStrokeType")
|
||||
(gtype-id "GIMP_TYPE_VECTORS_STROKE_TYPE")
|
||||
(values
|
||||
'("r" "GIMP_VECTORS_STROKE_TYPE_BEZIER")
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; From gimpenums.h
|
||||
|
||||
(define-function gimp_brush_application_mode_get_type
|
||||
(c-name "gimp_brush_application_mode_get_type")
|
||||
@@ -307,6 +761,11 @@
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_select_criterion_get_type
|
||||
(c-name "gimp_select_criterion_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_enums_init
|
||||
(c-name "gimp_enums_init")
|
||||
(return-type "none")
|
||||
@@ -321,3 +780,177 @@
|
||||
)
|
||||
|
||||
|
||||
|
||||
;; From gimpbaseenums.h
|
||||
|
||||
(define-function gimp_add_mask_type_get_type
|
||||
(c-name "gimp_add_mask_type_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_blend_mode_get_type
|
||||
(c-name "gimp_blend_mode_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_bucket_fill_mode_get_type
|
||||
(c-name "gimp_bucket_fill_mode_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_channel_ops_get_type
|
||||
(c-name "gimp_channel_ops_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_channel_type_get_type
|
||||
(c-name "gimp_channel_type_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_check_size_get_type
|
||||
(c-name "gimp_check_size_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_check_type_get_type
|
||||
(c-name "gimp_check_type_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_clone_type_get_type
|
||||
(c-name "gimp_clone_type_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_desaturate_mode_get_type
|
||||
(c-name "gimp_desaturate_mode_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_dodge_burn_type_get_type
|
||||
(c-name "gimp_dodge_burn_type_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_foreground_extract_mode_get_type
|
||||
(c-name "gimp_foreground_extract_mode_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_gradient_type_get_type
|
||||
(c-name "gimp_gradient_type_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_grid_style_get_type
|
||||
(c-name "gimp_grid_style_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_icon_type_get_type
|
||||
(c-name "gimp_icon_type_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_image_base_type_get_type
|
||||
(c-name "gimp_image_base_type_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_image_type_get_type
|
||||
(c-name "gimp_image_type_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_interpolation_type_get_type
|
||||
(c-name "gimp_interpolation_type_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_paint_application_mode_get_type
|
||||
(c-name "gimp_paint_application_mode_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_repeat_mode_get_type
|
||||
(c-name "gimp_repeat_mode_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_run_mode_get_type
|
||||
(c-name "gimp_run_mode_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_size_type_get_type
|
||||
(c-name "gimp_size_type_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_transfer_mode_get_type
|
||||
(c-name "gimp_transfer_mode_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_transform_direction_get_type
|
||||
(c-name "gimp_transform_direction_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_transform_resize_get_type
|
||||
(c-name "gimp_transform_resize_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_pdb_arg_type_get_type
|
||||
(c-name "gimp_pdb_arg_type_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_pdb_proc_type_get_type
|
||||
(c-name "gimp_pdb_proc_type_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_pdb_status_type_get_type
|
||||
(c-name "gimp_pdb_status_type_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_message_handler_type_get_type
|
||||
(c-name "gimp_message_handler_type_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_stack_trace_mode_get_type
|
||||
(c-name "gimp_stack_trace_mode_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_progress_command_get_type
|
||||
(c-name "gimp_progress_command_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_text_direction_get_type
|
||||
(c-name "gimp_text_direction_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_text_justification_get_type
|
||||
(c-name "gimp_text_justification_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_user_directory_get_type
|
||||
(c-name "gimp_user_directory_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
(define-function gimp_vectors_stroke_type_get_type
|
||||
(c-name "gimp_vectors_stroke_type_get_type")
|
||||
(return-type "GType")
|
||||
)
|
||||
|
||||
|
||||
|
@@ -1,51 +1 @@
|
||||
# Gimp-Python - allows the writing of Gimp plugins in Python.
|
||||
# Copyright (C) 2005 Manish Singh <yosh@gimp.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# gimpenums.py -- constants for use with the gimp module
|
||||
#
|
||||
# this file pulls in constants that are useful for use in
|
||||
# gimp plugins. Just add 'from gimpenums import *' to the top
|
||||
# of the script
|
||||
|
||||
from _gimpenums import *
|
||||
|
||||
# This is from pygtk/gtk/__init__.py
|
||||
# Copyright (C) 1998-2003 James Henstridge
|
||||
|
||||
class _DeprecatedConstant:
|
||||
def __init__(self, value, name, suggestion):
|
||||
self._v = value
|
||||
self._name = name
|
||||
self._suggestion = suggestion
|
||||
|
||||
def _deprecated(self, value):
|
||||
import warnings
|
||||
message = '%s is deprecated, use %s instead' % (self._name,
|
||||
self._suggestion)
|
||||
warnings.warn(message, DeprecationWarning, 3)
|
||||
return value
|
||||
|
||||
__nonzero__ = lambda self: self._deprecated(self._v == True)
|
||||
__int__ = lambda self: self._deprecated(int(self._v))
|
||||
__str__ = lambda self: self._deprecated(str(self._v))
|
||||
__repr__ = lambda self: self._deprecated(repr(self._v))
|
||||
__cmp__ = lambda self, other: self._deprecated(cmp(self._v, other))
|
||||
|
||||
TRUE = _DeprecatedConstant(True, 'gimpenums.TRUE', 'True')
|
||||
FALSE = _DeprecatedConstant(False, 'gimpenums.FALSE', 'False')
|
||||
|
||||
del _DeprecatedConstant
|
||||
from gimp.enums import *
|
||||
|
@@ -100,7 +100,7 @@ add_registered_enums(PyObject *m)
|
||||
pyg_enum_add_constants(m, GIMP_TYPE_CHECK_TYPE, "GIMP_");
|
||||
|
||||
for (i = 0; i < num_names; i++)
|
||||
pyg_enum_add_constants(m, g_type_from_name(names[i]), "GIMP_");
|
||||
pyg_enum_add(m, names[i], "GIMP_", g_type_from_name(names[i]));
|
||||
}
|
||||
|
||||
|
||||
@@ -110,10 +110,10 @@ static char gimpenums_doc[] =
|
||||
"This module provides interfaces to allow you to write gimp plugins"
|
||||
;
|
||||
|
||||
void init_gimpenums(void);
|
||||
void init_enums(void);
|
||||
|
||||
PyMODINIT_FUNC
|
||||
init_gimpenums(void)
|
||||
init_enums(void)
|
||||
{
|
||||
PyObject *m;
|
||||
|
||||
@@ -124,7 +124,7 @@ init_gimpenums(void)
|
||||
gimp_enums_init();
|
||||
|
||||
/* Create the module and add the functions */
|
||||
m = Py_InitModule3("_gimpenums", NULL, gimpenums_doc);
|
||||
m = Py_InitModule3("_enums", NULL, gimpenums_doc);
|
||||
|
||||
add_misc_enums(m);
|
||||
add_registered_enums(m);
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
/* -*- Mode: C; c-basic-offset: 4 -*-
|
||||
/* -*- Mode: C; c-basic-offset: 3 -*-
|
||||
Gimp-Python - allows the writing of Gimp plugins in Python.
|
||||
Copyright (C) 1997-2002 James Henstridge <james@daa.com.au>
|
||||
|
||||
@@ -162,7 +162,7 @@ pygimp_run_proc(const char *name, int nparams, const GimpParam *params,
|
||||
return;
|
||||
}
|
||||
|
||||
*return_vals = pygimp_param_from_tuple(ret, rv, nrv);
|
||||
*return_vals = pygimp_param_from_tuple(ret, rv, nrv, NULL);
|
||||
g_free(rv);
|
||||
|
||||
if (*return_vals == NULL) {
|
||||
@@ -1775,19 +1775,22 @@ static struct _PyGimp_Functions pygimp_api_functions = {
|
||||
pygimp_channel_new,
|
||||
&PyGimpVectors_Type,
|
||||
pygimp_vectors_new,
|
||||
NULL,
|
||||
&PyGimpPixelRgn_Type,
|
||||
pygimp_pixel_rgn_new
|
||||
};
|
||||
|
||||
|
||||
/* Initialization function for the module (*must* be called initgimp) */
|
||||
/* Initialization function for the module (*must* be called init_gimp) */
|
||||
|
||||
static char gimp_module_documentation[] =
|
||||
"This module provides interfaces to allow you to write gimp plugins"
|
||||
;
|
||||
|
||||
void initgimp(void);
|
||||
void init_gimp(void);
|
||||
|
||||
PyMODINIT_FUNC
|
||||
initgimp(void)
|
||||
init_gimp(void)
|
||||
{
|
||||
PyObject *m;
|
||||
|
||||
@@ -1809,7 +1812,6 @@ initgimp(void)
|
||||
if (PyType_Ready(&PyGimpImage_Type) < 0)
|
||||
return;
|
||||
|
||||
PyGimpDisplay_Type.ob_type = &PyType_Type;
|
||||
PyGimpDisplay_Type.ob_type = &PyType_Type;
|
||||
PyGimpDisplay_Type.tp_alloc = PyType_GenericAlloc;
|
||||
PyGimpDisplay_Type.tp_new = PyType_GenericNew;
|
||||
@@ -1830,13 +1832,13 @@ initgimp(void)
|
||||
|
||||
PyGimpTile_Type.ob_type = &PyType_Type;
|
||||
PyGimpTile_Type.tp_alloc = PyType_GenericAlloc;
|
||||
PyGimpTile_Type.tp_new = PyType_GenericNew;
|
||||
//PyGimpTile_Type.tp_new = PyType_GenericNew;
|
||||
if (PyType_Ready(&PyGimpTile_Type) < 0)
|
||||
return;
|
||||
|
||||
PyGimpPixelRgn_Type.ob_type = &PyType_Type;
|
||||
PyGimpPixelRgn_Type.tp_alloc = PyType_GenericAlloc;
|
||||
PyGimpPixelRgn_Type.tp_new = PyType_GenericNew;
|
||||
//PyGimpPixelRgn_Type.tp_new = PyType_GenericNew;
|
||||
if (PyType_Ready(&PyGimpPixelRgn_Type) < 0)
|
||||
return;
|
||||
|
||||
@@ -1883,7 +1885,7 @@ initgimp(void)
|
||||
PyUnicode_SetDefaultEncoding("utf-8");
|
||||
|
||||
/* Create the module and add the functions */
|
||||
m = Py_InitModule4("gimp", gimp_methods,
|
||||
m = Py_InitModule4("_gimp", gimp_methods,
|
||||
gimp_module_documentation,
|
||||
NULL, PYTHON_API_VERSION);
|
||||
|
||||
|
@@ -1,92 +1 @@
|
||||
# Gimp-Python - allows the writing of Gimp plugins in Python.
|
||||
# Copyright (C) 1997 James Henstridge <james@daa.com.au>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# gimpshelf.py -- a simple module to help gimp modules written in Python
|
||||
# store persistent data.
|
||||
#
|
||||
# Copyright (C) 1997, James Henstridge
|
||||
#
|
||||
# The gimp module provides a basic method for storing information that persists
|
||||
# for a whole gimp session, but only allows for the storage of strings. This
|
||||
# is because other Python types usually have pointers to other Python objects,
|
||||
# making it dificult to work out what to save. This module gives an interface
|
||||
# to the gimp module's primitive interface, which resembles the shelve module.
|
||||
|
||||
# use cPickle and cStringIO if available
|
||||
|
||||
try:
|
||||
import cPickle as pickle
|
||||
except ImportError:
|
||||
import pickle
|
||||
|
||||
try:
|
||||
import cStringIO as StringIO
|
||||
except ImportError:
|
||||
import StringIO
|
||||
|
||||
import gimp
|
||||
|
||||
import copy_reg
|
||||
|
||||
def _image_id(obj):
|
||||
return gimp._id2image, (obj.ID,)
|
||||
|
||||
def _drawable_id(obj):
|
||||
return gimp._id2drawable, (obj.ID,)
|
||||
|
||||
def _display_id(obj):
|
||||
return gimp._id2display, (obj.ID,)
|
||||
|
||||
def _vectors_id(obj):
|
||||
return gimp._id2vectors, int(obj.ID)
|
||||
|
||||
copy_reg.pickle(gimp.Image, _image_id, gimp._id2image)
|
||||
copy_reg.pickle(gimp.Layer, _drawable_id, gimp._id2drawable)
|
||||
copy_reg.pickle(gimp.Channel, _drawable_id, gimp._id2drawable)
|
||||
copy_reg.pickle(gimp.Display, _display_id, gimp._id2display)
|
||||
copy_reg.pickle(gimp.Vectors, _vectors_id, gimp._id2vectors)
|
||||
|
||||
del copy_reg, _image_id, _drawable_id, _display_id, _vectors_id
|
||||
|
||||
class Gimpshelf:
|
||||
def has_key(self, key):
|
||||
try:
|
||||
s = gimp.get_data(key)
|
||||
return 1
|
||||
except gimp.error:
|
||||
return 0
|
||||
|
||||
def __getitem__(self, key):
|
||||
try:
|
||||
s = gimp.get_data(key)
|
||||
except gimp.error:
|
||||
raise KeyError, key
|
||||
|
||||
f = StringIO.StringIO(s)
|
||||
return pickle.Unpickler(f).load()
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
f = StringIO.StringIO()
|
||||
p = pickle.Pickler(f)
|
||||
p.dump(value)
|
||||
gimp.set_data(key, f.getvalue())
|
||||
|
||||
def __delitem__(self, key):
|
||||
gimp.set_data(key, '')
|
||||
|
||||
shelf = Gimpshelf()
|
||||
del Gimpshelf
|
||||
from gimp.shelf import *
|
||||
|
1
plug-ins/pygimp/gimpthumb.py
Normal file
1
plug-ins/pygimp/gimpthumb.py
Normal file
@@ -0,0 +1 @@
|
||||
from gimp.thumb import *
|
@@ -42,16 +42,16 @@ static char gimpthumb_doc[] =
|
||||
"This module provides interfaces to allow you to write gimp plugins"
|
||||
;
|
||||
|
||||
void initgimpthumb(void);
|
||||
void initthumb(void);
|
||||
|
||||
PyMODINIT_FUNC
|
||||
initgimpthumb(void)
|
||||
initthumb(void)
|
||||
{
|
||||
PyObject *m, *d;
|
||||
|
||||
pygimp_init_pygobject();
|
||||
|
||||
m = Py_InitModule3("gimpthumb", gimpthumb_functions, gimpthumb_doc);
|
||||
m = Py_InitModule3("thumb", gimpthumb_functions, gimpthumb_doc);
|
||||
d = PyModule_GetDict(m);
|
||||
|
||||
gimpthumb_register_classes(d);
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,228 +1,2 @@
|
||||
# Gimp-Python - allows the writing of Gimp plugins in Python.
|
||||
# Copyright (C) 1997 James Henstridge <james@daa.com.au>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
'''This module implements the UI items found in the libgimpui library.
|
||||
It requires pygtk to work. These functions take use to callbacks -- one
|
||||
is a constraint function, and the other is the callback object. The
|
||||
constraint function takes an image object as its first argument, and
|
||||
a drawable object as its second if appropriate. The callback functions
|
||||
get the selected object as their first argument, and the user data as
|
||||
the second.
|
||||
|
||||
It also implements a number of selector widgets, which can be used to select
|
||||
various gimp data types. Each of these selectors takes default as an argument
|
||||
to the constructor, and has a get_value() method for retrieving the result.
|
||||
'''
|
||||
|
||||
import pygtk
|
||||
pygtk.require('2.0')
|
||||
|
||||
import gtk, gobject, gimp, gimpcolor
|
||||
|
||||
from _gimpui import *
|
||||
|
||||
import gettext
|
||||
t = gettext.translation('gimp20-python', gimp.locale_directory, fallback=True)
|
||||
_ = t.ugettext
|
||||
|
||||
def _callbackWrapper(menu_item, callback, data):
|
||||
callback(menu_item.get_data("Gimp-ID"), data)
|
||||
|
||||
def _createMenu(items, callback, data):
|
||||
menu = gtk.Menu()
|
||||
if not items:
|
||||
items = [("(none)", None)]
|
||||
for label, id in items:
|
||||
menu_item = gtk.MenuItem(label)
|
||||
menu_item.set_data("Gimp-ID", id)
|
||||
menu.add(menu_item)
|
||||
if callback:
|
||||
menu_item.connect("activate", _callbackWrapper,
|
||||
callback, data)
|
||||
menu_item.show()
|
||||
return menu
|
||||
|
||||
|
||||
def ImageMenu(constraint=None, callback=None, data=None):
|
||||
items = []
|
||||
for img in gimp.image_list():
|
||||
if constraint and not constraint(img):
|
||||
continue
|
||||
if not img.filename:
|
||||
filename = img.name
|
||||
else:
|
||||
filename = img.filename
|
||||
items.append((filename, img))
|
||||
items.sort()
|
||||
return _createMenu(items, callback, data)
|
||||
|
||||
def LayerMenu(constraint=None, callback=None, data=None):
|
||||
items = []
|
||||
for img in gimp.image_list():
|
||||
filename = img.filename
|
||||
if not filename:
|
||||
filename = img.name
|
||||
for layer in img.layers:
|
||||
if constraint and not constraint(img, layer):
|
||||
continue
|
||||
name = filename + "/" + layer.name
|
||||
items.append((name, layer))
|
||||
items.sort()
|
||||
return _createMenu(items, callback, data)
|
||||
|
||||
def ChannelMenu(constraint=None, callback=None, data=None):
|
||||
items = []
|
||||
for img in gimp.image_list():
|
||||
filename = img.filename
|
||||
if not filename:
|
||||
filename = img.name
|
||||
for channel in img.channels:
|
||||
if constraint and not constraint(img, channel):
|
||||
continue
|
||||
name = filename + "/" + channel.name
|
||||
items.append((name, channel))
|
||||
items.sort()
|
||||
return _createMenu(items, callback, data)
|
||||
|
||||
def DrawableMenu(constraint=None, callback=None, data=None):
|
||||
items = []
|
||||
for img in gimp.image_list():
|
||||
filename = img.filename
|
||||
if not filename:
|
||||
filename = img.name
|
||||
for drawable in img.layers + img.channels:
|
||||
if constraint and not constraint(img, drawable):
|
||||
continue
|
||||
name = filename + "/" + drawable.name
|
||||
items.append((name, drawable))
|
||||
items.sort()
|
||||
return _createMenu(items, callback, data)
|
||||
|
||||
def VectorsMenu(constraint=None, callback=None, data=None):
|
||||
items = []
|
||||
for img in gimp.image_list():
|
||||
filename = img.filename
|
||||
if not filename:
|
||||
filename = img.name
|
||||
for vectors in img.vectors:
|
||||
if constraint and not constraint(img, vectors):
|
||||
continue
|
||||
name = filename + "/" + vectors.name
|
||||
items.append((name, vectors))
|
||||
items.sort()
|
||||
return _createMenu(items, callback, data)
|
||||
|
||||
class ImageSelector(ImageComboBox):
|
||||
def __init__(self, default=None):
|
||||
ImageComboBox.__init__(self)
|
||||
if default is not None:
|
||||
self.set_active_image(default)
|
||||
def get_value(self):
|
||||
return self.get_active_image()
|
||||
|
||||
class LayerSelector(LayerComboBox):
|
||||
def __init__(self, default=None):
|
||||
LayerComboBox.__init__(self)
|
||||
if default is not None:
|
||||
self.set_active_layer(default)
|
||||
def get_value(self):
|
||||
return self.get_active_layer()
|
||||
|
||||
class ChannelSelector(ChannelComboBox):
|
||||
def __init__(self, default=None):
|
||||
ChannelComboBox.__init__(self)
|
||||
if default is not None:
|
||||
self.set_active_channel(default)
|
||||
def get_value(self):
|
||||
return self.get_active_channel()
|
||||
|
||||
class DrawableSelector(DrawableComboBox):
|
||||
def __init__(self, default=None):
|
||||
DrawableComboBox.__init__(self)
|
||||
if default is not None:
|
||||
self.set_active_drawable(default)
|
||||
def get_value(self):
|
||||
return self.get_active_drawable()
|
||||
|
||||
class VectorsSelector(VectorsComboBox):
|
||||
def __init__(self, default=None):
|
||||
VectorsComboBox.__init__(self)
|
||||
if default is not None:
|
||||
self.set_active_vectors(default)
|
||||
def get_value(self):
|
||||
return self.get_active_vectors()
|
||||
|
||||
class ColorSelector(ColorButton):
|
||||
def __init__(self, default=gimpcolor.RGB(1.0, 0, 0)):
|
||||
if isinstance(default, gimpcolor.RGB):
|
||||
color = default
|
||||
elif isinstance(default, tuple):
|
||||
color = apply(gimpcolor.RGB, default)
|
||||
elif isinstance(default, str):
|
||||
color = gimpcolor.rgb_parse_css(default)
|
||||
ColorButton.__init__(self, _("Python-Fu Color Selection"), 100, 20,
|
||||
color, COLOR_AREA_FLAT)
|
||||
def get_value(self):
|
||||
return self.get_color();
|
||||
|
||||
class PatternSelector(PatternSelectButton):
|
||||
def __init__(self, default=""):
|
||||
PatternSelectButton.__init__(self)
|
||||
if default:
|
||||
self.set_pattern(default)
|
||||
def get_value(self):
|
||||
return self.get_pattern()
|
||||
|
||||
class BrushSelector(BrushSelectButton):
|
||||
def __init__(self, default=""):
|
||||
BrushSelectButton.__init__(self)
|
||||
if default:
|
||||
self.set_brush(default, -1.0, -1, -1)
|
||||
def get_value(self):
|
||||
return self.get_brush()[0]
|
||||
|
||||
class GradientSelector(GradientSelectButton):
|
||||
def __init__(self, default=""):
|
||||
GradientSelectButton.__init__(self)
|
||||
if default:
|
||||
self.set_gradient(default)
|
||||
def get_value(self):
|
||||
return self.get_gradient()
|
||||
|
||||
class PaletteSelector(PaletteSelectButton):
|
||||
def __init__(self, default=""):
|
||||
PaletteSelectButton.__init__(self)
|
||||
if default:
|
||||
self.set_palette(default)
|
||||
def get_value(self):
|
||||
return self.get_palette()
|
||||
|
||||
class FontSelector(FontSelectButton):
|
||||
def __init__(self, default="Sans"):
|
||||
FontSelectButton.__init__(self)
|
||||
if default:
|
||||
self.set_font(default)
|
||||
def get_value(self):
|
||||
return self.get_font()
|
||||
|
||||
class FileSelector(gtk.FileChooserButton):
|
||||
def __init__(self, default=""):
|
||||
gtk.FileChooserButton.__init__(self, _("Python-Fu File Selection"))
|
||||
if default:
|
||||
self.set_filename(default)
|
||||
def get_value(self):
|
||||
return self.get_filename()
|
||||
from gimp.ui import *
|
||||
from gimp.ui import _, _callbackWrapper, _createMenu
|
||||
|
@@ -44,10 +44,10 @@ static char gimpui_doc[] =
|
||||
"This module provides interfaces to allow you to write gimp plugins"
|
||||
;
|
||||
|
||||
void init_gimpui(void);
|
||||
void init_ui(void);
|
||||
|
||||
PyMODINIT_FUNC
|
||||
init_gimpui(void)
|
||||
init_ui(void)
|
||||
{
|
||||
PyObject *m, *d;
|
||||
PyObject *av;
|
||||
@@ -71,7 +71,7 @@ init_gimpui(void)
|
||||
init_pygimpcolor();
|
||||
init_pygimp();
|
||||
|
||||
m = Py_InitModule3("_gimpui", gimpui_functions, gimpui_doc);
|
||||
m = Py_InitModule3("_ui", gimpui_functions, gimpui_doc);
|
||||
d = PyModule_GetDict(m);
|
||||
|
||||
gimpui_register_classes(d);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
!IFNDEF MODULE
|
||||
|
||||
MODULES = gimp _gimpenums gimpcolor _gimpui
|
||||
MODULES = _gimp _gimpenums gimpcolor _gimpui
|
||||
|
||||
all : sub-all
|
||||
|
||||
@@ -16,7 +16,7 @@ MODULE=$(MODULE)
|
||||
#OPTIMIZE = -Od -Op
|
||||
#DEBUG=1
|
||||
|
||||
!IFDEF OBJ_gimp
|
||||
!IFDEF OBJ__gimp
|
||||
OBJECTS = \
|
||||
gimpmodule.obj \
|
||||
pygimp-image.obj \
|
||||
@@ -84,4 +84,4 @@ clean::
|
||||
del gimpui.c
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -23,7 +23,7 @@ def code_eval(code):
|
||||
if code == '-':
|
||||
import sys
|
||||
code = sys.stdin
|
||||
exec code
|
||||
exec code in globals()
|
||||
|
||||
register(
|
||||
"python-fu-eval",
|
||||
|
@@ -101,12 +101,20 @@ register(
|
||||
(PF_INT, "radius", "Radius for sphere", 100),
|
||||
(PF_SLIDER, "light", "Light angle", 45, (0,360,1)),
|
||||
(PF_TOGGLE, "shadow", "Shadow?", 1),
|
||||
(PF_RADIO, "foo", "Test", "foo", (("Foo", "foo"), ("Bar", "bar"))),
|
||||
(PF_RADIO, "foo", "Test 123", "foo", (("Foo", "foo"), ("Bar", "bar"))),
|
||||
(PF_COLOR, "bg-color", "Background", (1.0, 1.0, 1.0)),
|
||||
(PF_COLOR, "sphere-color", "Sphere", "orange")
|
||||
],
|
||||
[],
|
||||
sphere,
|
||||
menu="<Image>/Filters/Languages/Python-Fu/Test")
|
||||
menu="<Image>/Filters/Languages/Python-Fu/Test",
|
||||
layout=((LAY_FIELD, "radius"),
|
||||
(LAY_FIELD, "light"),
|
||||
(LAY_EXPANDER, "Test expander", ((LAY_FIELD, "shadow"),
|
||||
(LAY_FIELD, "foo"))),
|
||||
(LAY_GROUP, "Test group", ((LAY_FIELD, "bg-color"),
|
||||
(LAY_FIELD, "sphere-color")))
|
||||
)
|
||||
)
|
||||
|
||||
main()
|
||||
|
@@ -46,6 +46,12 @@ typedef struct {
|
||||
gint32 ID;
|
||||
} PyGimpVectors;
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
GimpPixelRgn pr;
|
||||
PyGimpDrawable *drawable; /* keep the drawable around */
|
||||
} PyGimpPixelRgn;
|
||||
|
||||
struct _PyGimp_Functions {
|
||||
PyTypeObject *Image_Type;
|
||||
PyObject *(* image_new)(gint32 ID);
|
||||
@@ -66,6 +72,11 @@ struct _PyGimp_Functions {
|
||||
PyObject *(* vectors_new)(gint32 ID);
|
||||
|
||||
PyObject *pygimp_error;
|
||||
|
||||
PyTypeObject *PixelRgn_Type;
|
||||
PyObject *(* pixel_rgn_new)(PyGimpDrawable *drw, int x, int y,
|
||||
int w, int h, int dirty, int shadow);
|
||||
|
||||
};
|
||||
|
||||
#ifndef _INSIDE_PYGIMP_
|
||||
@@ -89,6 +100,8 @@ struct _PyGimp_Functions *_PyGimp_API;
|
||||
#define PyGimpVectors_Type (_PyGimp_API->Vectors_Type)
|
||||
#define pygimp_vectors_new (_PyGimp_API->vectors_new)
|
||||
#define pygimp_error (_PyGimp_API->pygimp_error)
|
||||
#define PyGimpPixelRgn_Type (_PyGimp_API->PixelRgn_Type)
|
||||
#define pygimp_pixel_rgn_new (_PyGimp_API->pixel_rgn_new)
|
||||
|
||||
#define init_pygimp() G_STMT_START { \
|
||||
PyObject *gimpmodule = PyImport_ImportModule("gimp"); \
|
||||
|
@@ -68,9 +68,9 @@ rgb_set(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
SET_MEMBER(b);
|
||||
}
|
||||
|
||||
if (a)
|
||||
if (a) {
|
||||
SET_MEMBER(a);
|
||||
|
||||
}
|
||||
#undef SET_MEMBER
|
||||
|
||||
*rgb = tmprgb;
|
||||
@@ -440,10 +440,10 @@ rgb_set_ ## m(PyObject *self, PyObject *value, void *closure) \
|
||||
return 0; \
|
||||
}
|
||||
|
||||
MEMBER_ACCESSOR(r);
|
||||
MEMBER_ACCESSOR(g);
|
||||
MEMBER_ACCESSOR(b);
|
||||
MEMBER_ACCESSOR(a);
|
||||
MEMBER_ACCESSOR(r)
|
||||
MEMBER_ACCESSOR(g)
|
||||
MEMBER_ACCESSOR(b)
|
||||
MEMBER_ACCESSOR(a)
|
||||
|
||||
#undef MEMBER_ACCESSOR
|
||||
|
||||
@@ -542,11 +542,11 @@ rgb_slice(PyObject *self, int start, int end)
|
||||
static PySequenceMethods rgb_as_sequence = {
|
||||
(inquiry)rgb_length,
|
||||
(binaryfunc)0,
|
||||
(intargfunc)0,
|
||||
(intargfunc)rgb_getitem,
|
||||
(intintargfunc)rgb_slice,
|
||||
(intobjargproc)rgb_setitem,
|
||||
(intintobjargproc)0,
|
||||
0,
|
||||
rgb_getitem,
|
||||
rgb_slice,
|
||||
rgb_setitem,
|
||||
0,
|
||||
(objobjproc)0,
|
||||
};
|
||||
|
||||
@@ -666,7 +666,7 @@ rgb_pretty_print(PyObject *self, gboolean inexact)
|
||||
PyObject *r_f = NULL, *g_f = NULL, *b_f = NULL, *a_f = NULL;
|
||||
PyObject *r = NULL, *g = NULL, *b = NULL, *a = NULL;
|
||||
reprfunc repr;
|
||||
char *prefix;
|
||||
const char *prefix;
|
||||
|
||||
if (inexact) {
|
||||
repr = PyObject_Str;
|
||||
@@ -852,9 +852,9 @@ hsv_set(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
SET_MEMBER(v, 100.0);
|
||||
}
|
||||
|
||||
if (a)
|
||||
if (a) {
|
||||
SET_MEMBER(a, 255.0);
|
||||
|
||||
}
|
||||
#undef SET_MEMBER
|
||||
|
||||
*hsv = tmphsv;
|
||||
@@ -963,10 +963,10 @@ hsv_set_ ## m(PyObject *self, PyObject *value, void *closure) \
|
||||
return 0; \
|
||||
}
|
||||
|
||||
MEMBER_ACCESSOR(h, 360.0);
|
||||
MEMBER_ACCESSOR(s, 100.0);
|
||||
MEMBER_ACCESSOR(v, 100.0);
|
||||
MEMBER_ACCESSOR(a, 255.0);
|
||||
MEMBER_ACCESSOR(h, 360.0)
|
||||
MEMBER_ACCESSOR(s, 100.0)
|
||||
MEMBER_ACCESSOR(v, 100.0)
|
||||
MEMBER_ACCESSOR(a, 255.0)
|
||||
|
||||
#undef MEMBER_ACCESSOR
|
||||
|
||||
@@ -1065,11 +1065,11 @@ hsv_slice(PyObject *self, int start, int end)
|
||||
static PySequenceMethods hsv_as_sequence = {
|
||||
(inquiry)hsv_length,
|
||||
(binaryfunc)0,
|
||||
(intargfunc)0,
|
||||
(intargfunc)hsv_getitem,
|
||||
(intintargfunc)hsv_slice,
|
||||
(intobjargproc)hsv_setitem,
|
||||
(intintobjargproc)0,
|
||||
0,
|
||||
hsv_getitem,
|
||||
hsv_slice,
|
||||
hsv_setitem,
|
||||
0,
|
||||
(objobjproc)0,
|
||||
};
|
||||
|
||||
@@ -1189,7 +1189,7 @@ hsv_pretty_print(PyObject *self, gboolean inexact)
|
||||
PyObject *h_f = NULL, *s_f = NULL, *v_f = NULL, *a_f = NULL;
|
||||
PyObject *h = NULL, *s = NULL, *v = NULL, *a = NULL;
|
||||
reprfunc repr;
|
||||
char *prefix;
|
||||
const char *prefix;
|
||||
|
||||
if (inexact) {
|
||||
repr = PyObject_Str;
|
||||
@@ -1375,9 +1375,9 @@ hsl_set(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
SET_MEMBER(l, 100.0);
|
||||
}
|
||||
|
||||
if (a)
|
||||
if (a) {
|
||||
SET_MEMBER(a, 255.0);
|
||||
|
||||
}
|
||||
#undef SET_MEMBER
|
||||
|
||||
*hsl = tmphsl;
|
||||
@@ -1476,10 +1476,10 @@ hsl_set_ ## m(PyObject *self, PyObject *value, void *closure) \
|
||||
return 0; \
|
||||
}
|
||||
|
||||
MEMBER_ACCESSOR(h, 360.0);
|
||||
MEMBER_ACCESSOR(s, 100.0);
|
||||
MEMBER_ACCESSOR(l, 100.0);
|
||||
MEMBER_ACCESSOR(a, 255.0);
|
||||
MEMBER_ACCESSOR(h, 360.0)
|
||||
MEMBER_ACCESSOR(s, 100.0)
|
||||
MEMBER_ACCESSOR(l, 100.0)
|
||||
MEMBER_ACCESSOR(a, 255.0)
|
||||
|
||||
#undef MEMBER_ACCESSOR
|
||||
|
||||
@@ -1578,11 +1578,11 @@ hsl_slice(PyObject *self, int start, int end)
|
||||
static PySequenceMethods hsl_as_sequence = {
|
||||
(inquiry)hsl_length,
|
||||
(binaryfunc)0,
|
||||
(intargfunc)0,
|
||||
(intargfunc)hsl_getitem,
|
||||
(intintargfunc)hsl_slice,
|
||||
(intobjargproc)hsl_setitem,
|
||||
(intintobjargproc)0,
|
||||
0,
|
||||
hsl_getitem,
|
||||
hsl_slice,
|
||||
hsl_setitem,
|
||||
0,
|
||||
(objobjproc)0,
|
||||
};
|
||||
|
||||
@@ -1702,7 +1702,7 @@ hsl_pretty_print(PyObject *self, gboolean inexact)
|
||||
PyObject *h_f = NULL, *s_f = NULL, *l_f = NULL, *a_f = NULL;
|
||||
PyObject *h = NULL, *s = NULL, *l = NULL, *a = NULL;
|
||||
reprfunc repr;
|
||||
char *prefix;
|
||||
const char *prefix;
|
||||
|
||||
if (inexact) {
|
||||
repr = PyObject_Str;
|
||||
@@ -1890,9 +1890,9 @@ cmyk_set(PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
SET_MEMBER(k);
|
||||
}
|
||||
|
||||
if (a)
|
||||
if (a) {
|
||||
SET_MEMBER(a);
|
||||
|
||||
}
|
||||
#undef SET_MEMBER
|
||||
|
||||
*cmyk = tmpcmyk;
|
||||
@@ -1977,11 +1977,11 @@ cmyk_set_ ## m(PyObject *self, PyObject *value, void *closure) \
|
||||
return 0; \
|
||||
}
|
||||
|
||||
MEMBER_ACCESSOR(c);
|
||||
MEMBER_ACCESSOR(m);
|
||||
MEMBER_ACCESSOR(y);
|
||||
MEMBER_ACCESSOR(k);
|
||||
MEMBER_ACCESSOR(a);
|
||||
MEMBER_ACCESSOR(c)
|
||||
MEMBER_ACCESSOR(m)
|
||||
MEMBER_ACCESSOR(y)
|
||||
MEMBER_ACCESSOR(k)
|
||||
MEMBER_ACCESSOR(a)
|
||||
|
||||
#undef MEMBER_ACCESSOR
|
||||
|
||||
@@ -2084,11 +2084,11 @@ cmyk_slice(PyObject *self, int start, int end)
|
||||
static PySequenceMethods cmyk_as_sequence = {
|
||||
(inquiry)cmyk_length,
|
||||
(binaryfunc)0,
|
||||
(intargfunc)0,
|
||||
(intargfunc)cmyk_getitem,
|
||||
(intintargfunc)cmyk_slice,
|
||||
(intobjargproc)cmyk_setitem,
|
||||
(intintobjargproc)0,
|
||||
0,
|
||||
cmyk_getitem,
|
||||
cmyk_slice,
|
||||
cmyk_setitem,
|
||||
0,
|
||||
(objobjproc)0,
|
||||
};
|
||||
|
||||
@@ -2211,7 +2211,7 @@ cmyk_pretty_print(PyObject *self, gboolean inexact)
|
||||
PyObject *c_f = NULL, *m_f = NULL, *y_f = NULL, *k_f = NULL, *a_f = NULL;
|
||||
PyObject *c = NULL, *m = NULL, *y = NULL, *k = NULL, *a = NULL;
|
||||
reprfunc repr;
|
||||
char *prefix;
|
||||
const char *prefix;
|
||||
|
||||
if (inexact) {
|
||||
repr = PyObject_Str;
|
||||
|
@@ -46,7 +46,7 @@ pygimp_display_new(gint32 ID)
|
||||
{
|
||||
PyGimpDisplay *self;
|
||||
|
||||
if (ID == -1) {
|
||||
if (!gimp_display_is_valid(ID)) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
@@ -72,7 +72,7 @@ disp_repr(PyGimpDisplay *self)
|
||||
{
|
||||
PyObject *s;
|
||||
|
||||
s = PyString_FromString("<display>");
|
||||
s = PyString_FromString("<gimp.Display>");
|
||||
|
||||
return s;
|
||||
}
|
||||
|
@@ -31,18 +31,16 @@
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
static void
|
||||
/*static void
|
||||
ensure_drawable(PyGimpDrawable *self)
|
||||
{
|
||||
if (!self->drawable)
|
||||
self->drawable = gimp_drawable_get(self->ID);
|
||||
}
|
||||
}*/
|
||||
|
||||
static PyObject *
|
||||
drw_flush(PyGimpDrawable *self)
|
||||
{
|
||||
ensure_drawable(self);
|
||||
|
||||
gimp_drawable_flush(self->drawable);
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
@@ -129,8 +127,6 @@ drw_get_tile(PyGimpDrawable *self, PyObject *args, PyObject *kwargs)
|
||||
&shadow, &row, &col))
|
||||
return NULL;
|
||||
|
||||
ensure_drawable(self);
|
||||
|
||||
t = gimp_drawable_get_tile(self->drawable, shadow, row, col);
|
||||
return pygimp_tile_new(t, self);
|
||||
}
|
||||
@@ -147,8 +143,6 @@ drw_get_tile2(PyGimpDrawable *self, PyObject *args, PyObject *kwargs)
|
||||
&shadow, &x ,&y))
|
||||
return NULL;
|
||||
|
||||
ensure_drawable(self);
|
||||
|
||||
t = gimp_drawable_get_tile2(self->drawable, shadow, x, y);
|
||||
return pygimp_tile_new(t, self);
|
||||
}
|
||||
@@ -166,8 +160,6 @@ drw_get_pixel_rgn(PyGimpDrawable *self, PyObject *args, PyObject *kwargs)
|
||||
&x, &y, &width, &height, &dirty, &shadow))
|
||||
return NULL;
|
||||
|
||||
ensure_drawable(self);
|
||||
|
||||
return pygimp_pixel_rgn_new(self, x, y, width, height, dirty, shadow);
|
||||
}
|
||||
|
||||
@@ -578,7 +570,7 @@ drw_transform_rotate(PyGimpDrawable *self, PyObject *args, PyObject *kwargs)
|
||||
"clip_result", NULL };
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
|
||||
"diiii|iii:transform_rotate", kwlist,
|
||||
"diiiii|iii:transform_rotate", kwlist,
|
||||
&angle, &auto_center, ¢er_x, ¢er_y,
|
||||
&transform_direction, &interpolation,
|
||||
&supersample, &recursion_level,
|
||||
@@ -1200,31 +1192,36 @@ PyTypeObject PyGimpDrawable_Type = {
|
||||
PyObject *
|
||||
pygimp_drawable_new(GimpDrawable *drawable, gint32 ID)
|
||||
{
|
||||
PyObject *self;
|
||||
|
||||
if (drawable == NULL && ID == -1) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
PyObject *self = NULL;
|
||||
|
||||
if (drawable != NULL)
|
||||
ID = drawable->drawable_id;
|
||||
ID = drawable->drawable_id;
|
||||
|
||||
if (!gimp_drawable_is_valid(ID)) {
|
||||
if (drawable)
|
||||
gimp_drawable_detach(drawable);
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
||||
/* create the appropriate object type */
|
||||
|
||||
/* avoids calling gimp_drawable_is_layer with an invalid id
|
||||
* pygimp_channel_new handles it cleanly
|
||||
*/
|
||||
if (gimp_drawable_is_valid(ID) &&
|
||||
gimp_drawable_is_layer(ID))
|
||||
self = pygimp_layer_new(ID);
|
||||
if (gimp_drawable_is_layer(ID))
|
||||
self = (PyObject*)PyObject_NEW(PyGimpLayer, &PyGimpLayer_Type);
|
||||
else if (gimp_drawable_is_channel(ID))
|
||||
self = (PyObject*)PyObject_NEW(PyGimpChannel, &PyGimpChannel_Type);
|
||||
|
||||
if (self == NULL) {
|
||||
if (drawable)
|
||||
gimp_drawable_detach(drawable);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
((PyGimpDrawable*)self)->ID = ID;
|
||||
|
||||
if (drawable)
|
||||
((PyGimpDrawable*)self)->drawable = drawable;
|
||||
else
|
||||
self = pygimp_channel_new(ID);
|
||||
|
||||
if (self == NULL)
|
||||
return NULL;
|
||||
|
||||
((PyGimpDrawable *)self)->drawable = drawable;
|
||||
((PyGimpDrawable*)self)->drawable = gimp_drawable_get(ID);
|
||||
|
||||
return self;
|
||||
}
|
||||
@@ -1692,7 +1689,7 @@ lay_repr(PyGimpLayer *self)
|
||||
gchar *name;
|
||||
|
||||
name = gimp_drawable_get_name(self->ID);
|
||||
s = PyString_FromFormat("<gimp.Layer '%s'>", name);
|
||||
s = PyString_FromFormat("<gimp.Layer '%s'>", name ? name : "(null)");
|
||||
g_free(name);
|
||||
|
||||
return s;
|
||||
@@ -1717,7 +1714,6 @@ lay_init(PyGimpLayer *self, PyObject *args, PyObject *kwargs)
|
||||
self->ID = gimp_layer_new(img->ID, name, width, height,
|
||||
type, opacity, mode);
|
||||
|
||||
self->drawable = NULL;
|
||||
|
||||
if (self->ID < 0) {
|
||||
PyErr_Format(pygimp_error,
|
||||
@@ -1727,6 +1723,8 @@ lay_init(PyGimpLayer *self, PyObject *args, PyObject *kwargs)
|
||||
return -1;
|
||||
}
|
||||
|
||||
self->drawable = gimp_drawable_get(self->ID);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1778,7 +1776,7 @@ pygimp_layer_new(gint32 ID)
|
||||
{
|
||||
PyGimpLayer *self;
|
||||
|
||||
if (ID == -1) {
|
||||
if (!gimp_drawable_is_valid(ID) || !gimp_drawable_is_layer(ID)) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
@@ -1789,7 +1787,8 @@ pygimp_layer_new(gint32 ID)
|
||||
return NULL;
|
||||
|
||||
self->ID = ID;
|
||||
self->drawable = NULL;
|
||||
self->drawable = gimp_drawable_get(ID);
|
||||
|
||||
|
||||
return (PyObject *)self;
|
||||
}
|
||||
@@ -1971,7 +1970,7 @@ chn_repr(PyGimpChannel *self)
|
||||
gchar *name;
|
||||
|
||||
name = gimp_drawable_get_name(self->ID);
|
||||
s = PyString_FromFormat("<gimp.Channel '%s'>", name);
|
||||
s = PyString_FromFormat("<gimp.Channel '%s'>", name ? name : "(null)");
|
||||
g_free(name);
|
||||
|
||||
return s;
|
||||
@@ -2006,8 +2005,6 @@ chn_init(PyGimpChannel *self, PyObject *args, PyObject *kwargs)
|
||||
|
||||
self->ID = gimp_channel_new(img->ID, name, width, height, opacity, rgb);
|
||||
|
||||
self->drawable = NULL;
|
||||
|
||||
if (self->ID < 0) {
|
||||
PyErr_Format(pygimp_error,
|
||||
"could not create %dx%d channel '%s' on image (ID %d)",
|
||||
@@ -2015,6 +2012,8 @@ chn_init(PyGimpChannel *self, PyObject *args, PyObject *kwargs)
|
||||
return -1;
|
||||
}
|
||||
|
||||
self->drawable = gimp_drawable_get(self->ID);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2066,7 +2065,7 @@ pygimp_channel_new(gint32 ID)
|
||||
{
|
||||
PyGimpChannel *self;
|
||||
|
||||
if (ID == -1) {
|
||||
if (!gimp_drawable_is_valid(ID) || !gimp_drawable_is_channel(ID)) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
@@ -2077,7 +2076,7 @@ pygimp_channel_new(gint32 ID)
|
||||
return NULL;
|
||||
|
||||
self->ID = ID;
|
||||
self->drawable = NULL;
|
||||
self->drawable = gimp_drawable_get(ID);
|
||||
|
||||
return (PyObject *)self;
|
||||
}
|
||||
|
@@ -21,6 +21,10 @@
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef GIMP_DISABLE_DEPRECATED
|
||||
# undef GIMP_DISABLE_DEPRECATED
|
||||
#endif
|
||||
|
||||
#include "pygimp.h"
|
||||
|
||||
static PyObject *
|
||||
@@ -1314,7 +1318,7 @@ pygimp_image_new(gint32 ID)
|
||||
{
|
||||
PyGimpImage *self;
|
||||
|
||||
if (ID == -1) {
|
||||
if (!gimp_image_is_valid(ID)) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
@@ -308,8 +308,36 @@ pygimp_param_to_tuple(int nparams, const GimpParam *params)
|
||||
return args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to set a python exception when a wrong type was passed.
|
||||
* n - The parameter number which is set in the exception string
|
||||
* starting at 1. Pass 0 to omit.
|
||||
* expected - A string holding the expected types name.
|
||||
* got - The python object that was passed instead.
|
||||
* error_prefix - A string that prefixes the exception string. Should be the
|
||||
* name of the function which was called.
|
||||
*/
|
||||
static void
|
||||
pygimp_set_type_error(int n, gchar *expected, PyObject *got, const gchar *error_prefix)
|
||||
{
|
||||
static const gchar *positions[] = {"first", "second", "third"};
|
||||
|
||||
if(n < 1)
|
||||
PyErr_Format(PyExc_TypeError, "%sExpected %s, got %s "
|
||||
"instead.", error_prefix ? error_prefix : "", expected,
|
||||
got->ob_type->tp_name);
|
||||
if(n < 4)
|
||||
PyErr_Format(PyExc_TypeError, "%s%s argument must be %s, not %s.",
|
||||
error_prefix ? error_prefix : "", positions[n-1],
|
||||
expected, got->ob_type->tp_name);
|
||||
else
|
||||
PyErr_Format(PyExc_TypeError, "%s%dth argument must be %s, not %s.",
|
||||
error_prefix ? error_prefix : "", n, expected,
|
||||
got->ob_type->tp_name);
|
||||
}
|
||||
|
||||
GimpParam *
|
||||
pygimp_param_from_tuple(PyObject *args, const GimpParamDef *ptype, int nparams)
|
||||
pygimp_param_from_tuple(PyObject *args, const GimpParamDef *ptype, int nparams, const gchar* error_prefix)
|
||||
{
|
||||
PyObject *tuple, *item, *x, *y, *w, *h;
|
||||
GimpParam *ret;
|
||||
@@ -317,31 +345,31 @@ pygimp_param_from_tuple(PyObject *args, const GimpParamDef *ptype, int nparams)
|
||||
gint32 *i32a; gint16 *i16a; guint8 *i8a; gdouble *fa; gchar **sa;
|
||||
|
||||
if (nparams == 0)
|
||||
tuple = PyTuple_New(0);
|
||||
tuple = PyTuple_New(0);
|
||||
else if (!PyTuple_Check(args) && nparams == 1)
|
||||
tuple = Py_BuildValue("(O)", args);
|
||||
tuple = Py_BuildValue("(O)", args);
|
||||
else {
|
||||
Py_INCREF(args);
|
||||
tuple = args;
|
||||
if (!PyTuple_Check(args)) {
|
||||
PyErr_SetString(PyExc_TypeError, "wrong type of parameter");
|
||||
return NULL;
|
||||
}
|
||||
Py_INCREF(args);
|
||||
tuple = args;
|
||||
}
|
||||
if (!PyTuple_Check(tuple)) {
|
||||
PyErr_SetString(PyExc_TypeError, "wrong type of parameter");
|
||||
Py_DECREF(tuple);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
if (PyTuple_Size(tuple) != nparams) {
|
||||
PyErr_SetString(PyExc_TypeError, "wrong number of parameters");
|
||||
PyErr_Format(PyExc_TypeError, "%stakes exactly %d arguments (%d given)",
|
||||
error_prefix ? error_prefix : "", nparams, PyTuple_Size(tuple));
|
||||
Py_DECREF(tuple);
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = g_new(GimpParam, nparams+1);
|
||||
for (i = 0; i <= nparams; i++)
|
||||
ret[i].type = GIMP_PDB_STATUS;
|
||||
#define check(expr) if (expr) { \
|
||||
PyErr_SetString(PyExc_TypeError, "wrong parameter type"); \
|
||||
Py_DECREF(tuple); \
|
||||
#define check(expr, expected) if (expr) { \
|
||||
pygimp_set_type_error(i, expected, item, error_prefix); \
|
||||
Py_DECREF(tuple); \
|
||||
gimp_destroy_params(ret, nparams); \
|
||||
return NULL; \
|
||||
}
|
||||
@@ -356,22 +384,22 @@ pygimp_param_from_tuple(PyObject *args, const GimpParamDef *ptype, int nparams)
|
||||
item = PyTuple_GetItem(tuple, i-1);
|
||||
switch (ptype[i-1].type) {
|
||||
case GIMP_PDB_INT32:
|
||||
check((x = PyNumber_Int(item)) == NULL);
|
||||
check((x = PyNumber_Int(item)) == NULL, "int");
|
||||
ret[i].data.d_int32 = (gint32)PyInt_AsLong(x);
|
||||
Py_DECREF(x);
|
||||
break;
|
||||
case GIMP_PDB_INT16:
|
||||
check((x = PyNumber_Int(item)) == NULL);
|
||||
check((x = PyNumber_Int(item)) == NULL, "int");
|
||||
ret[i].data.d_int16 = (gint16)PyInt_AsLong(x);
|
||||
Py_DECREF(x);
|
||||
break;
|
||||
case GIMP_PDB_INT8:
|
||||
check((x = PyNumber_Int(item)) == NULL);
|
||||
check((x = PyNumber_Int(item)) == NULL, "int");
|
||||
ret[i].data.d_int8 = (guint8)PyInt_AsLong(x);
|
||||
Py_DECREF(x);
|
||||
break;
|
||||
case GIMP_PDB_FLOAT:
|
||||
check((x = PyNumber_Float(item)) == NULL);
|
||||
check((x = PyNumber_Float(item)) == NULL, "float");
|
||||
ret[i].data.d_float = PyFloat_AsDouble(x);
|
||||
Py_DECREF(x);
|
||||
break;
|
||||
@@ -380,12 +408,12 @@ pygimp_param_from_tuple(PyObject *args, const GimpParamDef *ptype, int nparams)
|
||||
ret[i].data.d_string = NULL;
|
||||
break;
|
||||
}
|
||||
check((x = PyObject_Str(item)) == NULL);
|
||||
check((x = PyObject_Str(item)) == NULL, "str");
|
||||
ret[i].data.d_string = g_strdup(PyString_AsString(x));
|
||||
Py_DECREF(x);
|
||||
break;
|
||||
case GIMP_PDB_INT32ARRAY:
|
||||
check(!PySequence_Check(item));
|
||||
check(!PySequence_Check(item), "sequence");
|
||||
len = PySequence_Length(item);
|
||||
i32a = g_new(gint32, len);
|
||||
for (j = 0; j < len; j++) {
|
||||
@@ -398,7 +426,7 @@ pygimp_param_from_tuple(PyObject *args, const GimpParamDef *ptype, int nparams)
|
||||
ret[i].data.d_int32array = i32a;
|
||||
break;
|
||||
case GIMP_PDB_INT16ARRAY:
|
||||
check(!PySequence_Check(item));
|
||||
check(!PySequence_Check(item), "sequence");
|
||||
len = PySequence_Length(item);
|
||||
i16a = g_new(gint16, len);
|
||||
for (j = 0; j < len; j++) {
|
||||
@@ -411,7 +439,7 @@ pygimp_param_from_tuple(PyObject *args, const GimpParamDef *ptype, int nparams)
|
||||
ret[i].data.d_int16array = i16a;
|
||||
break;
|
||||
case GIMP_PDB_INT8ARRAY:
|
||||
check(!PySequence_Check(item));
|
||||
check(!PySequence_Check(item), "sequence");
|
||||
len = PySequence_Length(item);
|
||||
i8a = g_new(guint8, len);
|
||||
for (j = 0; j < len; j++) {
|
||||
@@ -424,7 +452,7 @@ pygimp_param_from_tuple(PyObject *args, const GimpParamDef *ptype, int nparams)
|
||||
ret[i].data.d_int8array = i8a;
|
||||
break;
|
||||
case GIMP_PDB_FLOATARRAY:
|
||||
check(!PySequence_Check(item));
|
||||
check(!PySequence_Check(item), "sequence");
|
||||
len = PySequence_Length(item);
|
||||
fa = g_new(gdouble, len);
|
||||
for (j = 0; j < len; j++) {
|
||||
@@ -437,7 +465,7 @@ pygimp_param_from_tuple(PyObject *args, const GimpParamDef *ptype, int nparams)
|
||||
ret[i].data.d_floatarray = fa;
|
||||
break;
|
||||
case GIMP_PDB_STRINGARRAY:
|
||||
check(!PySequence_Check(item));
|
||||
check(!PySequence_Check(item), "sequence");
|
||||
len = PySequence_Length(item);
|
||||
sa = g_new(gchar *, len);
|
||||
for (j = 0; j < len; j++) {
|
||||
@@ -458,6 +486,7 @@ pygimp_param_from_tuple(PyObject *args, const GimpParamDef *ptype, int nparams)
|
||||
GimpRGB rgb;
|
||||
|
||||
if (!pygimp_rgb_from_pyobject(item, &rgb)) {
|
||||
pygimp_set_type_error(i, "color", item, error_prefix);
|
||||
Py_DECREF(tuple);
|
||||
gimp_destroy_params(ret, nparams);
|
||||
return NULL;
|
||||
@@ -468,20 +497,20 @@ pygimp_param_from_tuple(PyObject *args, const GimpParamDef *ptype, int nparams)
|
||||
break;
|
||||
case GIMP_PDB_REGION:
|
||||
check(!PySequence_Check(item) ||
|
||||
PySequence_Length(item) < 4);
|
||||
PySequence_Length(item) < 4, "sequence");
|
||||
x = PySequence_GetItem(item, 0);
|
||||
y = PySequence_GetItem(item, 1);
|
||||
w = PySequence_GetItem(item, 2);
|
||||
h = PySequence_GetItem(item, 3);
|
||||
check(!PyInt_Check(x) || !PyInt_Check(y) ||
|
||||
!PyInt_Check(w) || !PyInt_Check(h));
|
||||
!PyInt_Check(w) || !PyInt_Check(h), "int");
|
||||
ret[i].data.d_region.x = PyInt_AsLong(x);
|
||||
ret[i].data.d_region.y = PyInt_AsLong(y);
|
||||
ret[i].data.d_region.width = PyInt_AsLong(w);
|
||||
ret[i].data.d_region.height = PyInt_AsLong(h);
|
||||
break;
|
||||
case GIMP_PDB_DISPLAY:
|
||||
check(!pygimp_display_check(item));
|
||||
check(!pygimp_display_check(item), "gimp.Display");
|
||||
ret[i].data.d_display = ((PyGimpDisplay *)item)->ID;
|
||||
break;
|
||||
case GIMP_PDB_IMAGE:
|
||||
@@ -489,7 +518,7 @@ pygimp_param_from_tuple(PyObject *args, const GimpParamDef *ptype, int nparams)
|
||||
ret[i].data.d_image = -1;
|
||||
break;
|
||||
}
|
||||
check(!pygimp_image_check(item));
|
||||
check(!pygimp_image_check(item), "gimp.Image");
|
||||
ret[i].data.d_image = ((PyGimpImage *)item)->ID;
|
||||
break;
|
||||
case GIMP_PDB_LAYER:
|
||||
@@ -497,7 +526,7 @@ pygimp_param_from_tuple(PyObject *args, const GimpParamDef *ptype, int nparams)
|
||||
ret[i].data.d_layer = -1;
|
||||
break;
|
||||
}
|
||||
check(!pygimp_layer_check(item));
|
||||
check(!pygimp_layer_check(item), "gimp.Layer");
|
||||
ret[i].data.d_layer = ((PyGimpLayer *)item)->ID;
|
||||
break;
|
||||
case GIMP_PDB_CHANNEL:
|
||||
@@ -505,7 +534,7 @@ pygimp_param_from_tuple(PyObject *args, const GimpParamDef *ptype, int nparams)
|
||||
ret[i].data.d_channel = -1;
|
||||
break;
|
||||
}
|
||||
check(!pygimp_channel_check(item));
|
||||
check(!pygimp_channel_check(item), "gimp.Channel");
|
||||
ret[i].data.d_channel = ((PyGimpChannel *)item)->ID;
|
||||
break;
|
||||
case GIMP_PDB_DRAWABLE:
|
||||
@@ -513,26 +542,26 @@ pygimp_param_from_tuple(PyObject *args, const GimpParamDef *ptype, int nparams)
|
||||
ret[i].data.d_channel = -1;
|
||||
break;
|
||||
}
|
||||
check(!pygimp_drawable_check(item));
|
||||
check(!pygimp_drawable_check(item), "gimp.Drawable");
|
||||
ret[i].data.d_channel = ((PyGimpDrawable *)item)->ID;
|
||||
break;
|
||||
case GIMP_PDB_SELECTION:
|
||||
check(!pygimp_layer_check(item));
|
||||
check(!pygimp_layer_check(item), "gimp.Layer");
|
||||
ret[i].data.d_selection = ((PyGimpLayer *)item)->ID;
|
||||
break;
|
||||
case GIMP_PDB_BOUNDARY:
|
||||
check(!PyInt_Check(item));
|
||||
check(!PyInt_Check(item), "int");
|
||||
ret[i].data.d_boundary = PyInt_AsLong(item);
|
||||
break;
|
||||
case GIMP_PDB_VECTORS:
|
||||
check(!pygimp_vectors_check(item));
|
||||
check(!pygimp_vectors_check(item), "gimp.Vectors");
|
||||
ret[i].data.d_vectors = ((PyGimpVectors *)item)->ID;
|
||||
break;
|
||||
case GIMP_PDB_PARASITE:
|
||||
/* can't do anything, since size of GimpParasite is not known */
|
||||
break;
|
||||
case GIMP_PDB_STATUS:
|
||||
check(!PyInt_Check(item));
|
||||
check(!PyInt_Check(item), "int");
|
||||
ret[i].data.d_status = PyInt_AsLong(item);
|
||||
break;
|
||||
case GIMP_PDB_END:
|
||||
@@ -677,7 +706,7 @@ pdb_getattro(PyGimpPDB *self, PyObject *attr)
|
||||
}
|
||||
|
||||
if (attr_name[0] == '_') {
|
||||
if (strcmp(attr_name, "__members__")) {
|
||||
if (strcmp(attr_name, "__members__") == 0) {
|
||||
return build_procedure_list();
|
||||
} else {
|
||||
return PyObject_GenericGetAttr((PyObject *)self, attr);
|
||||
@@ -751,7 +780,7 @@ pygimp_pdb_function_new_from_proc_db(char *name)
|
||||
|
||||
if (!gimp_procedural_db_proc_info (name, &b, &h, &a, &c, &d, &pt,
|
||||
&np, &nr, &p, &r)) {
|
||||
PyErr_SetString(pygimp_error, "procedure not found");
|
||||
PyErr_Format(pygimp_error, "%s: Procedure not found", name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -785,17 +814,36 @@ pf_dealloc(PyGimpPDBFunction *self)
|
||||
|
||||
#define OFF(x) offsetof(PyGimpPDBFunction, x)
|
||||
static struct PyMemberDef pf_members[] = {
|
||||
{"proc_name", T_OBJECT, OFF(proc_name), RO},
|
||||
{"proc_blurb", T_OBJECT, OFF(proc_blurb), RO},
|
||||
{"proc_help", T_OBJECT, OFF(proc_help), RO},
|
||||
{"proc_author", T_OBJECT, OFF(proc_author), RO},
|
||||
{"proc_copyright", T_OBJECT, OFF(proc_copyright), RO},
|
||||
{"proc_date", T_OBJECT, OFF(proc_date), RO},
|
||||
{"proc_type", T_OBJECT, OFF(proc_type), RO},
|
||||
{"nparams", T_INT, OFF(nparams), RO},
|
||||
{"nreturn_vals", T_INT, OFF(nreturn_vals), RO},
|
||||
{"params", T_OBJECT, OFF(py_params), RO},
|
||||
{"return_vals", T_OBJECT, OFF(py_return_vals), RO},
|
||||
{"proc_name", T_OBJECT, OFF(proc_name), RO,
|
||||
"The name of the procedure."},
|
||||
{"proc_blurb", T_OBJECT, OFF(proc_blurb), RO,
|
||||
"A short piece of information about the procedure."},
|
||||
{"proc_help", T_OBJECT, OFF(proc_help), RO,
|
||||
"More detailed information about the procedure."},
|
||||
{"proc_author", T_OBJECT, OFF(proc_author), RO,
|
||||
"The author of the procedure."},
|
||||
{"proc_copyright", T_OBJECT, OFF(proc_copyright), RO,
|
||||
"The copyright holder for the procedure (usually the same as the author)."},
|
||||
{"proc_date", T_OBJECT, OFF(proc_date), RO,
|
||||
"The date when the procedure was written."},
|
||||
{"proc_type", T_OBJECT, OFF(proc_type), RO,
|
||||
"The type of procedure. This will be one of PROC_PLUG_IN, "\
|
||||
"PROC_EXTENSION or PROC_TEMPORARY."},
|
||||
{"nparams", T_INT, OFF(nparams), RO,
|
||||
"The number of parameters the procedure takes."},
|
||||
{"nreturn_vals", T_INT, OFF(nreturn_vals), RO,
|
||||
"The number of return values the procedure gives."},
|
||||
{"params", T_OBJECT, OFF(py_params), RO,
|
||||
"A description of parameters of the procedure. It takes the form of a "\
|
||||
"tuple of 3-tuples, where each 3-tuple describes a parameter. The items "\
|
||||
"in the 3-tuple are a parameter type (one of the GimpPDBArgType constants), a "\
|
||||
"name for the parameter, and a description of the parameter. "},
|
||||
{"return_vals", T_OBJECT, OFF(py_return_vals), RO,
|
||||
"A description of return values of the procedure. It takes the form of a "\
|
||||
"tuple of 3-tuples, where each 3-tuple describes a return value. The "\
|
||||
"items in the 3-tuple are a return value type (one of the GimpPDBArgType "\
|
||||
"constants), a name for the return value, and a description of the "\
|
||||
"return value. "},
|
||||
{NULL} /* Sentinel */
|
||||
};
|
||||
#undef OFF
|
||||
@@ -814,11 +862,13 @@ pf_call(PyGimpPDBFunction *self, PyObject *args, PyObject *kwargs)
|
||||
int nret;
|
||||
PyObject *t = NULL, *r;
|
||||
GimpRunMode run_mode = GIMP_RUN_NONINTERACTIVE;
|
||||
|
||||
gchar *error_prefix;
|
||||
#if PG_DEBUG > 0
|
||||
g_printerr("--- %s --- ", PyString_AsString(self->proc_name));
|
||||
#endif
|
||||
|
||||
error_prefix = g_strdup_printf("%s: ", self->name);
|
||||
|
||||
if (kwargs) {
|
||||
int len, pos;
|
||||
PyObject *key, *val;
|
||||
@@ -851,41 +901,46 @@ pf_call(PyGimpPDBFunction *self, PyObject *args, PyObject *kwargs)
|
||||
}
|
||||
|
||||
if (self->nparams > 0 && !strcmp(self->params[0].name, "run-mode")) {
|
||||
params = pygimp_param_from_tuple(args, self->params + 1,
|
||||
self->nparams - 1);
|
||||
params = pygimp_param_from_tuple(args, self->params + 1,
|
||||
self->nparams - 1, error_prefix);
|
||||
|
||||
if (params == NULL)
|
||||
return NULL;
|
||||
if (params == NULL) {
|
||||
g_free(error_prefix);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
params[0].type = self->params[0].type;
|
||||
params[0].data.d_int32 = run_mode;
|
||||
params[0].type = self->params[0].type;
|
||||
params[0].data.d_int32 = run_mode;
|
||||
|
||||
#if PG_DEBUG > 1
|
||||
pygimp_param_print(self->nparams, params);
|
||||
#endif
|
||||
#if PG_DEBUG > 1
|
||||
pygimp_param_print(self->nparams, params);
|
||||
#endif
|
||||
|
||||
ret = gimp_run_procedure2(self->name, &nret, self->nparams, params);
|
||||
ret = gimp_run_procedure2(self->name, &nret, self->nparams, params);
|
||||
} else {
|
||||
params = pygimp_param_from_tuple(args, self->params, self->nparams);
|
||||
params = pygimp_param_from_tuple(args, self->params, self->nparams, error_prefix);
|
||||
|
||||
if (params == NULL)
|
||||
return NULL;
|
||||
if (params == NULL) {
|
||||
g_free(error_prefix);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if PG_DEBUG > 1
|
||||
pygimp_param_print(self->nparams, params+1);
|
||||
#endif
|
||||
#if PG_DEBUG > 1
|
||||
pygimp_param_print(self->nparams, params+1);
|
||||
#endif
|
||||
|
||||
ret = gimp_run_procedure2(self->name, &nret, self->nparams, params + 1);
|
||||
ret = gimp_run_procedure2(self->name, &nret, self->nparams, params + 1);
|
||||
}
|
||||
|
||||
gimp_destroy_params(params, self->nparams);
|
||||
|
||||
if (!ret) {
|
||||
PyErr_SetString(pygimp_error, "no status returned");
|
||||
#if PG_DEBUG >= 1
|
||||
g_printerr("ret == NULL\n");
|
||||
#endif
|
||||
return NULL;
|
||||
PyErr_Format(pygimp_error, "%sNo status returned", error_prefix);
|
||||
#if PG_DEBUG >= 1
|
||||
g_printerr("ret == NULL\n");
|
||||
#endif
|
||||
g_free(error_prefix);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch(ret[0].data.d_status) {
|
||||
@@ -894,7 +949,8 @@ pf_call(PyGimpPDBFunction *self, PyObject *args, PyObject *kwargs)
|
||||
g_printerr("execution error\n");
|
||||
#endif
|
||||
gimp_destroy_params(ret, nret);
|
||||
PyErr_SetString(PyExc_RuntimeError, "execution error");
|
||||
PyErr_Format(PyExc_RuntimeError, "%sExecution error", error_prefix);
|
||||
g_free(error_prefix);
|
||||
return NULL;
|
||||
break;
|
||||
|
||||
@@ -903,7 +959,8 @@ pf_call(PyGimpPDBFunction *self, PyObject *args, PyObject *kwargs)
|
||||
g_printerr("calling error\n");
|
||||
#endif
|
||||
gimp_destroy_params(ret, nret);
|
||||
PyErr_SetString(PyExc_TypeError, "invalid arguments");
|
||||
PyErr_Format(PyExc_TypeError, "%sInvalid arguments", error_prefix);
|
||||
g_free(error_prefix);
|
||||
return NULL;
|
||||
break;
|
||||
|
||||
@@ -915,7 +972,8 @@ pf_call(PyGimpPDBFunction *self, PyObject *args, PyObject *kwargs)
|
||||
gimp_destroy_params(ret, nret);
|
||||
|
||||
if (t == NULL) {
|
||||
PyErr_SetString(pygimp_error, "could not make return value");
|
||||
PyErr_Format(pygimp_error, "%sCould not make return value", error_prefix);
|
||||
g_free(error_prefix);
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
@@ -925,11 +983,14 @@ pf_call(PyGimpPDBFunction *self, PyObject *args, PyObject *kwargs)
|
||||
g_printerr("unknown - %i (type %i)\n",
|
||||
ret[0].data.d_status, ret[0].type);
|
||||
#endif
|
||||
PyErr_SetString(pygimp_error, "unknown return code");
|
||||
PyErr_SetString(pygimp_error, "%sUnknown return code");
|
||||
g_free(error_prefix);
|
||||
return NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
g_free(error_prefix);
|
||||
|
||||
if (PyTuple_Size(t) == 1) {
|
||||
r = PyTuple_GetItem(t, 0);
|
||||
Py_INCREF(r);
|
||||
@@ -991,6 +1052,68 @@ PyTypeObject PyGimpPDBFunction_Type = {
|
||||
(newfunc)0, /* tp_new */
|
||||
};
|
||||
|
||||
/*
|
||||
* pygim_pdb_build_param_info_tuple:
|
||||
* @n_params: Number of elements in @params.
|
||||
* @params: A array of GimpParamDef for which a description is created.
|
||||
*
|
||||
* Creates a tuple with of 3-tuples in the form of (type, name, description)
|
||||
* describing the passed pdb parameter definitions. When gimpenums is
|
||||
* available type is a gimpenums.GimpPDBArgType else a integer, name and
|
||||
* description are strings.
|
||||
*
|
||||
* Return value: A python tuple with @n_params elements of 3-tuples
|
||||
* describing @params or NULL if an error accured.
|
||||
*/
|
||||
static PyObject *
|
||||
pygimp_pdb_build_param_info_tuple(int n_params, GimpParamDef *params)
|
||||
{
|
||||
PyObject *result;
|
||||
PyObject *gimpenums;
|
||||
PyObject *pdb_arg_type;
|
||||
int i;
|
||||
PyObject *arglist;
|
||||
PyObject* type;
|
||||
|
||||
result = PyTuple_New(n_params);
|
||||
|
||||
gimpenums = PyImport_ImportModule("gimp.enums");
|
||||
|
||||
if(gimpenums == NULL ||
|
||||
(pdb_arg_type = PyObject_GetAttrString(gimpenums, "GimpPDBArgType")) == NULL) {
|
||||
PyErr_Clear();
|
||||
for(i = 0; i < n_params; ++i)
|
||||
PyTuple_SetItem(result, i,
|
||||
Py_BuildValue("(iss)",
|
||||
params[i].type,
|
||||
params[i].name,
|
||||
params[i].description));
|
||||
} else {
|
||||
for(i = 0; i < n_params; ++i) {
|
||||
if(!(arglist = Py_BuildValue("(i)", params[i].type))) break;
|
||||
if(!(type = PyEval_CallObject(pdb_arg_type, arglist))) {
|
||||
Py_DECREF(arglist);
|
||||
break;
|
||||
}
|
||||
PyTuple_SetItem(result, i,
|
||||
Py_BuildValue("(Oss)",
|
||||
type,
|
||||
params[i].name,
|
||||
params[i].description));
|
||||
Py_DECREF(type);
|
||||
Py_DECREF(arglist);
|
||||
}
|
||||
|
||||
if(i != n_params) {
|
||||
Py_DECREF(result);
|
||||
result = NULL;
|
||||
}
|
||||
Py_DECREF(pdb_arg_type);
|
||||
Py_DECREF(gimpenums);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
PyObject *
|
||||
pygimp_pdb_function_new(const char *name, const char *blurb, const char *help,
|
||||
const char *author, const char *copyright,
|
||||
@@ -999,7 +1122,6 @@ pygimp_pdb_function_new(const char *name, const char *blurb, const char *help,
|
||||
GimpParamDef *params, GimpParamDef *return_vals)
|
||||
{
|
||||
PyGimpPDBFunction *self;
|
||||
int i;
|
||||
|
||||
self = PyObject_NEW(PyGimpPDBFunction, &PyGimpPDBFunction_Type);
|
||||
|
||||
@@ -1018,22 +1140,10 @@ pygimp_pdb_function_new(const char *name, const char *blurb, const char *help,
|
||||
self->nreturn_vals = n_return_vals;
|
||||
self->params = params;
|
||||
self->return_vals = return_vals;
|
||||
PyDict_SetItemString(self->ob_type->tp_dict, "__doc__", PyString_FromString(help ? help : ""));
|
||||
|
||||
self->py_params = PyTuple_New(n_params);
|
||||
for (i = 0; i < n_params; i++)
|
||||
PyTuple_SetItem(self->py_params, i,
|
||||
Py_BuildValue("(iss)",
|
||||
params[i].type,
|
||||
params[i].name,
|
||||
params[i].description));
|
||||
|
||||
self->py_return_vals = PyTuple_New(n_return_vals);
|
||||
for (i = 0; i < n_return_vals; i++)
|
||||
PyTuple_SetItem(self->py_return_vals, i,
|
||||
Py_BuildValue("(iss)",
|
||||
return_vals[i].type,
|
||||
return_vals[i].name,
|
||||
return_vals[i].description));
|
||||
self->py_params = pygimp_pdb_build_param_info_tuple(n_params, params);
|
||||
self->py_return_vals = pygimp_pdb_build_param_info_tuple(n_return_vals, return_vals);
|
||||
|
||||
return (PyObject *)self;
|
||||
}
|
||||
|
@@ -76,9 +76,10 @@ pygimp_tile_new(GimpTile *t, PyGimpDrawable *drw)
|
||||
static void
|
||||
tile_dealloc(PyGimpTile *self)
|
||||
{
|
||||
gimp_tile_unref(self->tile, FALSE);
|
||||
if(self->tile)
|
||||
gimp_tile_unref(self->tile, FALSE);
|
||||
|
||||
Py_DECREF(self->drawable);
|
||||
Py_XDECREF(self->drawable);
|
||||
PyObject_DEL(self);
|
||||
}
|
||||
|
||||
@@ -146,10 +147,10 @@ tile_repr(PyGimpTile *self)
|
||||
return s;
|
||||
}
|
||||
|
||||
static int
|
||||
tile_length(PyGimpTile *self)
|
||||
static Py_ssize_t
|
||||
tile_length(PyObject *self)
|
||||
{
|
||||
return self->tile->ewidth * self->tile->eheight;
|
||||
return ((PyGimpTile*)self)->tile->ewidth * ((PyGimpTile*)self)->tile->eheight;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
@@ -251,7 +252,7 @@ tile_ass_sub(PyGimpTile *self, PyObject *v, PyObject *w)
|
||||
}
|
||||
|
||||
static PyMappingMethods tile_as_mapping = {
|
||||
(inquiry)tile_length, /*length*/
|
||||
tile_length, /*length*/
|
||||
(binaryfunc)tile_subscript, /*subscript*/
|
||||
(objobjargproc)tile_ass_sub, /*ass_sub*/
|
||||
};
|
||||
@@ -302,15 +303,31 @@ PyTypeObject PyGimpTile_Type = {
|
||||
/* End of code for Tile objects */
|
||||
/* -------------------------------------------------------- */
|
||||
|
||||
/* Ensures that the dimensions of the pixel region are inside its drawable.
|
||||
* Should be called before accessing the pixel region to avoid crashes. */
|
||||
static void
|
||||
pr_ensure(PyGimpPixelRgn *self)
|
||||
{
|
||||
GimpPixelRgn *pr = &(self->pr);
|
||||
if (pr->x >= pr->drawable->width) pr->x = pr->drawable->width - 1;
|
||||
if (pr->y >= pr->drawable->height) pr->y = pr->drawable->height - 1;
|
||||
if (pr->w > pr->drawable->width - pr->x) pr->w = pr->drawable->width - pr->x;
|
||||
if (pr->h > pr->drawable->height - pr->y) pr->h = pr->drawable->height - pr->y;
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
pr_resize(PyGimpPixelRgn *self, PyObject *args)
|
||||
{
|
||||
int x, y, w, h;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "iiii:resize", &x, &y, &w, &h))
|
||||
return NULL;
|
||||
|
||||
if (x < 0) x = 0;
|
||||
if (y < 0) y = 0;
|
||||
if (w < 0) w = 0;
|
||||
if (h < 0) h = 0;
|
||||
pr_ensure(self);
|
||||
|
||||
gimp_pixel_rgn_resize(&(self->pr), x, y, w, h);
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
@@ -339,12 +356,18 @@ pygimp_pixel_rgn_new(PyGimpDrawable *drawable, int x, int y,
|
||||
if (self == NULL)
|
||||
return NULL;
|
||||
|
||||
if (x < 0) x = 0;
|
||||
if (y < 0) y = 0;
|
||||
if (width < 0) width = 0;
|
||||
if (height < 0) height = 0;
|
||||
|
||||
gimp_pixel_rgn_init(&(self->pr), drawable->drawable, x, y, width, height,
|
||||
dirty, shadow);
|
||||
|
||||
self->drawable = drawable;
|
||||
Py_INCREF(drawable);
|
||||
|
||||
pr_ensure(self);
|
||||
|
||||
return (PyObject *)self;
|
||||
}
|
||||
|
||||
@@ -352,14 +375,14 @@ pygimp_pixel_rgn_new(PyGimpDrawable *drawable, int x, int y,
|
||||
static void
|
||||
pr_dealloc(PyGimpPixelRgn *self)
|
||||
{
|
||||
Py_DECREF(self->drawable);
|
||||
Py_XDECREF(self->drawable);
|
||||
PyObject_DEL(self);
|
||||
}
|
||||
|
||||
/* Code to access pr objects as mappings */
|
||||
|
||||
static int
|
||||
pr_length(PyGimpPixelRgn *self)
|
||||
static Py_ssize_t
|
||||
pr_length(PyObject *self)
|
||||
{
|
||||
PyErr_SetString(pygimp_error, "Can't get size of pixel region");
|
||||
return -1;
|
||||
@@ -369,230 +392,212 @@ static PyObject *
|
||||
pr_subscript(PyGimpPixelRgn *self, PyObject *key)
|
||||
{
|
||||
GimpPixelRgn *pr = &(self->pr);
|
||||
int bpp = pr->bpp;
|
||||
PyObject *x, *y;
|
||||
int x1, y1, x2, y2, xs, ys;
|
||||
Py_ssize_t x1, y1, x2, y2, xs, ys;
|
||||
PyObject *ret;
|
||||
guchar *buf;
|
||||
|
||||
pr_ensure(self);
|
||||
|
||||
if (!PyTuple_Check(key) || PyTuple_Size(key) != 2) {
|
||||
PyErr_SetString(PyExc_TypeError, "subscript must be a 2-tuple");
|
||||
return NULL;
|
||||
PyErr_SetString(PyExc_TypeError, "subscript must be a 2-tuple");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!PyArg_ParseTuple(key, "OO", &x, &y))
|
||||
return NULL;
|
||||
return NULL;
|
||||
|
||||
if (PyInt_Check(x)) {
|
||||
x1 = PyInt_AsLong(x);
|
||||
|
||||
if (pr->x > x1 || x1 >= pr->x + pr->w) {
|
||||
PyErr_SetString(PyExc_IndexError, "x subscript out of range");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (PyInt_Check(y)) {
|
||||
guchar buf[MAX_BPP];
|
||||
|
||||
y1 = PyInt_AsLong(y);
|
||||
|
||||
if (pr->y > y1 || y1 >= pr->y + pr->h) {
|
||||
PyErr_SetString(PyExc_IndexError, "y subscript out of range");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gimp_pixel_rgn_get_pixel(pr, buf, x1, y1);
|
||||
|
||||
return PyString_FromStringAndSize((char *)buf, bpp);
|
||||
} else if (PySlice_Check(y))
|
||||
if (PySlice_GetIndices((PySliceObject *)y,
|
||||
pr->y + pr->h, &y1, &y2, &ys) ||
|
||||
(y1 != 0 && pr->y > y1) ||
|
||||
pr->y > y2 || ys != 1) {
|
||||
PyErr_SetString(PyExc_IndexError, "invalid y slice");
|
||||
return NULL;
|
||||
} else {
|
||||
guchar *buf = g_new(guchar, bpp * (y2 - y1));
|
||||
PyObject *ret;
|
||||
|
||||
if (y1 == 0) y1 = pr->y;
|
||||
gimp_pixel_rgn_get_col(pr, buf, x1, y1, y2-y1);
|
||||
ret = PyString_FromStringAndSize((char *)buf, bpp * (y2 - y1));
|
||||
g_free(buf);
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_TypeError,"invalid y subscript");
|
||||
return NULL;
|
||||
}
|
||||
x1 = PyInt_AsSsize_t(x);
|
||||
if (x1 < 0)
|
||||
x1 += pr->x + pr->w;
|
||||
if (x1 < pr->x || x1 >= pr->x + pr->w) {
|
||||
PyErr_SetString(PyExc_IndexError, "x subscript out of range");
|
||||
return NULL;
|
||||
}
|
||||
x2 = x1 + 1;
|
||||
} else if (PySlice_Check(x)) {
|
||||
if (PySlice_GetIndices((PySliceObject *)x, pr->x + pr->w,
|
||||
&x1, &x2, &xs) || (x1 != 0 && pr->x > x1) ||
|
||||
pr->x > x2 || xs != 1) {
|
||||
PyErr_SetString(PyExc_IndexError, "invalid x slice");
|
||||
return NULL;
|
||||
}
|
||||
if (x1 == 0) x1 = pr->x;
|
||||
if (PyInt_Check(y)) {
|
||||
guchar *buf;
|
||||
PyObject *ret;
|
||||
|
||||
y1 = PyInt_AsLong(y);
|
||||
if (pr->y > y1 || y1 >= pr->y + pr->h) {
|
||||
PyErr_SetString(PyExc_IndexError, "y subscript out of range");
|
||||
return NULL;
|
||||
}
|
||||
buf = g_new(guchar, bpp * (x2 - x1));
|
||||
gimp_pixel_rgn_get_row(pr, buf, x1, y1, x2 - x1);
|
||||
ret = PyString_FromStringAndSize((char *)buf, bpp * (x2-x1));
|
||||
g_free(buf);
|
||||
return ret;
|
||||
} else if (PySlice_Check(y))
|
||||
if (PySlice_GetIndices((PySliceObject *)y,
|
||||
pr->y + pr->h, &y1, &y2, &ys) ||
|
||||
(y1 != 0 && pr->y) > y1 ||
|
||||
pr->y > y2 || ys != 1) {
|
||||
PyErr_SetString(PyExc_IndexError, "invalid y slice");
|
||||
return NULL;
|
||||
} else {
|
||||
guchar *buf = g_new(guchar, bpp * (x2 - x1) * (y2 - y1));
|
||||
PyObject *ret;
|
||||
|
||||
if (y1 == 0) y1 = pr->y;
|
||||
gimp_pixel_rgn_get_rect(pr, buf, x1, y1,
|
||||
x2 - x1, y2 - y1);
|
||||
ret = PyString_FromStringAndSize((char *)buf, bpp * (x2-x1) * (y2-y1));
|
||||
g_free(buf);
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_TypeError, "invalid y subscript");
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
PyErr_SetString(PyExc_TypeError, "invalid x subscript");
|
||||
return NULL;
|
||||
if (PySlice_GetIndices((PySliceObject *)x, pr->x + pr->w,
|
||||
&x1, &x2, &xs) ||
|
||||
x2 < x1 || xs != 1) {
|
||||
PyErr_SetString(PyExc_IndexError, "invalid x slice");
|
||||
return NULL;
|
||||
}
|
||||
if (x1 == 0)
|
||||
x1 = pr->x;
|
||||
if (x1 < pr->x || x2 < pr->x) {
|
||||
PyErr_SetString(PyExc_IndexError, "x subscript out of range");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_TypeError, "invalid x subscript");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (PyInt_Check(y)) {
|
||||
y1 = PyInt_AsSsize_t(y);
|
||||
if (y1 < 0)
|
||||
y1 += pr->y + pr->h;
|
||||
if (y1 < pr->y || y1 >= pr->y + pr->h) {
|
||||
PyErr_SetString(PyExc_IndexError, "y subscript out of range");
|
||||
return NULL;
|
||||
}
|
||||
y2 = y1 + 1;
|
||||
} else if (PySlice_Check(y)) {
|
||||
if (PySlice_GetIndices((PySliceObject *)y, pr->y + pr->h,
|
||||
&y1, &y2, &ys) ||
|
||||
y2 < y1 || ys != 1) {
|
||||
PyErr_SetString(PyExc_IndexError, "invalid y slice");
|
||||
return NULL;
|
||||
}
|
||||
if (y1 == 0)
|
||||
y1 = pr->y;
|
||||
if (y1 < pr->y || y2 < pr->y) {
|
||||
PyErr_SetString(PyExc_IndexError, "y subscript out of range");
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
PyErr_SetString(PyExc_TypeError, "invalid y subscript");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (x1 == x2 - 1) {
|
||||
if (y1 == y2 - 1) {
|
||||
guchar buf[MAX_BPP];
|
||||
gimp_pixel_rgn_get_pixel(pr, buf, x1, y1);
|
||||
return PyString_FromStringAndSize((char *)buf, pr->bpp);
|
||||
} else {
|
||||
buf = g_new(guchar, pr->bpp * (y2 - y1));
|
||||
gimp_pixel_rgn_get_col(pr, buf, x1, y1, y2 - y1);
|
||||
ret = PyString_FromStringAndSize((char *)buf, pr->bpp * (y2 - y1));
|
||||
}
|
||||
} else {
|
||||
if (y1 == y2 - 1) {
|
||||
buf = g_new(guchar, pr->bpp * (x2 - x1));
|
||||
gimp_pixel_rgn_get_row(pr, buf, x1, y1, x2 - x1);
|
||||
ret = PyString_FromStringAndSize((char *)buf, pr->bpp * (x2 - x1));
|
||||
} else {
|
||||
buf = g_new(guchar, pr->bpp * (x2 - x1) * (y2 - y1));
|
||||
gimp_pixel_rgn_get_rect(pr, buf, x1, y1, x2 - x1, y2 - y1);
|
||||
ret = PyString_FromStringAndSize((char *)buf, pr->bpp * (x2 - x1) * (y2 - y1));
|
||||
}
|
||||
}
|
||||
g_free(buf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
pr_ass_sub(PyGimpPixelRgn *self, PyObject *v, PyObject *w)
|
||||
{
|
||||
GimpPixelRgn *pr = &(self->pr);
|
||||
int bpp = pr->bpp;
|
||||
PyObject *x, *y;
|
||||
guchar *buf;
|
||||
int len, x1, x2, xs, y1, y2, ys;
|
||||
const guchar *buf;
|
||||
Py_ssize_t len, x1, x2, xs, y1, y2, ys;
|
||||
|
||||
if (w == NULL) {
|
||||
PyErr_SetString(PyExc_TypeError, "can't delete subscripts");
|
||||
return -1;
|
||||
PyErr_SetString(PyExc_TypeError, "can not delete pixels");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!PyString_Check(w)) {
|
||||
PyErr_SetString(PyExc_TypeError, "must assign string to subscript");
|
||||
return -1;
|
||||
PyErr_SetString(PyExc_TypeError, "must assign string to subscript");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!PyTuple_Check(v) || PyTuple_Size(v) != 2) {
|
||||
PyErr_SetString(PyExc_TypeError, "subscript must be a 2-tuple");
|
||||
return -1;
|
||||
PyErr_SetString(PyExc_TypeError, "subscript must be a 2-tuple");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!PyArg_ParseTuple(v, "OO", &x, &y))
|
||||
return -1;
|
||||
return -1;
|
||||
|
||||
buf = (guchar *)PyString_AsString(w);
|
||||
len = PyString_Size(w);
|
||||
pr_ensure(self);
|
||||
|
||||
if (PyInt_Check(x)) {
|
||||
x1 = PyInt_AsLong(x);
|
||||
|
||||
if (pr->x > x1 || x1 >= pr->x + pr->w) {
|
||||
PyErr_SetString(PyExc_IndexError, "x subscript out of range");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (PyInt_Check(y)) {
|
||||
y1 = PyInt_AsLong(y);
|
||||
|
||||
if (pr->y > y1 || y1 >= pr->y + pr->h) {
|
||||
PyErr_SetString(PyExc_IndexError, "y subscript out of range");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (len != bpp) {
|
||||
PyErr_SetString(PyExc_TypeError, "string is wrong length");
|
||||
return -1;
|
||||
}
|
||||
|
||||
gimp_pixel_rgn_set_pixel(pr, buf, x1, y1);
|
||||
return 0;
|
||||
} else if (PySlice_Check(y)) {
|
||||
if (PySlice_GetIndices((PySliceObject *)y,
|
||||
pr->y + pr->h, &y1, &y2, &ys) ||
|
||||
(y1 != 0 && pr->y > y1) ||
|
||||
pr->y > y2 || ys != 1) {
|
||||
PyErr_SetString(PyExc_IndexError, "invalid y slice");
|
||||
return -1;
|
||||
}
|
||||
if (y1 == 0) y1 = pr->y;
|
||||
if (len != bpp * (y2 - y1)) {
|
||||
PyErr_SetString(PyExc_TypeError, "string is wrong length");
|
||||
return -1;
|
||||
}
|
||||
gimp_pixel_rgn_set_col(pr, buf, x1, y1, y2 - y1);
|
||||
return 0;
|
||||
} else {
|
||||
PyErr_SetString(PyExc_IndexError,"invalid y subscript");
|
||||
return -1;
|
||||
}
|
||||
x1 = PyInt_AsSsize_t(x);
|
||||
if (x1 < 0)
|
||||
x1 += pr->x + pr->w;
|
||||
if (x1 < pr->x || x1 >= pr->x + pr->w) {
|
||||
PyErr_SetString(PyExc_IndexError, "x subscript out of range");
|
||||
return -1;
|
||||
}
|
||||
x2 = x1 + 1;
|
||||
} else if (PySlice_Check(x)) {
|
||||
if (PySlice_GetIndices((PySliceObject *)x, pr->x + pr->w,
|
||||
&x1, &x2, &xs) || (x1 != 0 && pr->x > x1) ||
|
||||
pr->x > x2 || xs != 1) {
|
||||
PyErr_SetString(PyExc_IndexError, "invalid x slice");
|
||||
return -1;
|
||||
}
|
||||
if (x1 == 0) x1 = pr->x;
|
||||
if (PyInt_Check(y)) {
|
||||
y1 = PyInt_AsLong(y);
|
||||
if (pr->y > y1 || y1 >= pr->y + pr->h) {
|
||||
PyErr_SetString(PyExc_IndexError, "y subscript out of range");
|
||||
return -1;
|
||||
}
|
||||
if (len != bpp * (x2 - x1)) {
|
||||
PyErr_SetString(PyExc_TypeError, "string is wrong length");
|
||||
return -1;
|
||||
}
|
||||
gimp_pixel_rgn_set_row(pr, buf, x1, y1, x2 - x1);
|
||||
return 0;
|
||||
} else if (PySlice_Check(y)) {
|
||||
if (PySlice_GetIndices((PySliceObject *)y,
|
||||
pr->y + pr->h, &y1, &y2, &ys) ||
|
||||
(y1 != 0 && pr->y > y1) ||
|
||||
pr->y > y2 || ys != 1) {
|
||||
PyErr_SetString(PyExc_IndexError, "invalid y slice");
|
||||
return -1;
|
||||
}
|
||||
if (y1 == 0) y1 = pr->y;
|
||||
if (len != bpp * (x2 - x1) * (y2 - y1)) {
|
||||
PyErr_SetString(PyExc_TypeError, "string is wrong length");
|
||||
return -1;
|
||||
}
|
||||
gimp_pixel_rgn_set_rect(pr, buf, x1, y1, x2-x1, y2-y1);
|
||||
return 0;
|
||||
} else {
|
||||
PyErr_SetString(PyExc_TypeError,"invalid y subscript");
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
PyErr_SetString(PyExc_TypeError, "invalid x subscript");
|
||||
return -1;
|
||||
if (PySlice_GetIndices((PySliceObject *)x, pr->x + pr->w,
|
||||
&x1, &x2, &xs) ||
|
||||
x2 < x1 || xs != 1) {
|
||||
PyErr_SetString(PyExc_IndexError, "invalid x slice");
|
||||
return -1;
|
||||
}
|
||||
if (x1 == 0)
|
||||
x1 = pr->x;
|
||||
if (x1 < pr->x || x2 < pr->x) {
|
||||
PyErr_SetString(PyExc_IndexError, "x subscript out of range");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
else {
|
||||
PyErr_SetString(PyExc_TypeError, "invalid x subscript");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (PyInt_Check(y)) {
|
||||
y1 = PyInt_AsSsize_t(y);
|
||||
if (y1 < 0)
|
||||
y1 += pr->y + pr->h;
|
||||
if (y1 < pr->y || y1 >= pr->y + pr->h) {
|
||||
PyErr_SetString(PyExc_IndexError, "y subscript out of range");
|
||||
return -1;
|
||||
}
|
||||
y2 = y1 + 1;
|
||||
} else if (PySlice_Check(y)) {
|
||||
if (PySlice_GetIndices((PySliceObject *)y, pr->y + pr->h,
|
||||
&y1, &y2, &ys) ||
|
||||
y2 < y1 || ys != 1) {
|
||||
PyErr_SetString(PyExc_IndexError, "invalid y slice");
|
||||
return -1;
|
||||
}
|
||||
if (y1 == 0)
|
||||
y1 = pr->y;
|
||||
if (y1 < pr->y || y2 < pr->y) {
|
||||
PyErr_SetString(PyExc_IndexError, "y subscript out of range");
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
PyErr_SetString(PyExc_TypeError, "invalid y subscript");
|
||||
return -1;
|
||||
}
|
||||
|
||||
buf = (const guchar *)PyString_AsString(w);
|
||||
len = PyString_Size(w);
|
||||
|
||||
if (len > INT_MAX || len != pr->bpp * (x2 - x1) * (y2 - y1)) {
|
||||
PyErr_SetString(PyExc_TypeError, "string is wrong length");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (x1 == x2 - 1) {
|
||||
if (y1 == y2 - 1) {
|
||||
gimp_pixel_rgn_set_pixel(pr, buf, x1, y1);
|
||||
} else {
|
||||
gimp_pixel_rgn_set_col(pr, buf, x1, y1, y2 - y1);
|
||||
}
|
||||
} else {
|
||||
if(y1 == y2 - 1) {
|
||||
gimp_pixel_rgn_set_row(pr, buf, x1, y1, x2 - x1);
|
||||
} else {
|
||||
gimp_pixel_rgn_set_rect(pr, buf, x1, y1, x2 - x1, y2 - y1);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static PyMappingMethods pr_as_mapping = {
|
||||
(inquiry)pr_length, /*mp_length*/
|
||||
pr_length, /*mp_length*/
|
||||
(binaryfunc)pr_subscript, /*mp_subscript*/
|
||||
(objobjargproc)pr_ass_sub, /*mp_ass_subscript*/
|
||||
};
|
||||
@@ -706,7 +711,7 @@ static PyObject *
|
||||
pf_get_pixel(PyGimpPixelFetcher *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
int x, y;
|
||||
guchar pixel[4];
|
||||
guchar pixel[4] = {0, 0, 0, 0};
|
||||
static char *kwlist[] = { "x", "y", NULL };
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords(args, kwargs,
|
||||
@@ -748,8 +753,8 @@ static PyMethodDef pf_methods[] = {
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
static int
|
||||
pf_length(PyGimpPixelFetcher *self)
|
||||
static Py_ssize_t
|
||||
pf_length(PyObject *self)
|
||||
{
|
||||
PyErr_SetString(pygimp_error, "Can't get size of pixel fetcher");
|
||||
return -1;
|
||||
@@ -760,7 +765,7 @@ pf_subscript(PyGimpPixelFetcher *self, PyObject *key)
|
||||
{
|
||||
PyObject *py_x, *py_y;
|
||||
int x, y;
|
||||
guchar pixel[4];
|
||||
guchar pixel[4] = {0, 0, 0, 0};
|
||||
|
||||
if (!PyTuple_Check(key) || PyTuple_Size(key) != 2) {
|
||||
PyErr_SetString(PyExc_TypeError, "subscript must be a 2-tuple");
|
||||
@@ -791,8 +796,9 @@ static int
|
||||
pf_ass_sub(PyGimpPixelFetcher *self, PyObject *v, PyObject *w)
|
||||
{
|
||||
PyObject *py_x, *py_y;
|
||||
int x, y, len;
|
||||
guchar *pixel;
|
||||
int x, y;
|
||||
Py_ssize_t len;
|
||||
const guchar *pixel;
|
||||
|
||||
if (w == NULL) {
|
||||
PyErr_SetString(PyExc_TypeError, "can't delete subscripts");
|
||||
@@ -812,11 +818,11 @@ pf_ass_sub(PyGimpPixelFetcher *self, PyObject *v, PyObject *w)
|
||||
if (!PyArg_ParseTuple(v, "OO", &py_x, &py_y))
|
||||
return -1;
|
||||
|
||||
pixel = (guchar *)PyString_AsString(w);
|
||||
pixel = (const guchar *)PyString_AsString(w);
|
||||
len = PyString_Size(w);
|
||||
|
||||
if (len != self->bpp) {
|
||||
PyErr_Format(PyExc_TypeError, "pixel must be %d bpp", self->bpp);
|
||||
if (len > INT_MAX || len != self->bpp) {
|
||||
PyErr_Format(PyExc_TypeError, "pixel must be %d bpp", self->bpp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -838,7 +844,7 @@ pf_ass_sub(PyGimpPixelFetcher *self, PyObject *v, PyObject *w)
|
||||
}
|
||||
|
||||
static PyMappingMethods pf_as_mapping = {
|
||||
(inquiry)pf_length,
|
||||
pf_length,
|
||||
(binaryfunc)pf_subscript,
|
||||
(objobjargproc)pf_ass_sub,
|
||||
};
|
||||
@@ -900,9 +906,10 @@ static PyGetSetDef pf_getsets[] = {
|
||||
static void
|
||||
pf_dealloc(PyGimpPixelFetcher *self)
|
||||
{
|
||||
gimp_pixel_fetcher_destroy(self->pf);
|
||||
if(self->pf)
|
||||
gimp_pixel_fetcher_destroy(self->pf);
|
||||
|
||||
Py_DECREF(self->drawable);
|
||||
Py_XDECREF(self->drawable);
|
||||
PyObject_DEL(self);
|
||||
}
|
||||
|
||||
@@ -927,7 +934,7 @@ pf_repr(PyGimpPixelFetcher *self)
|
||||
static int
|
||||
pf_init(PyGimpPixelFetcher *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
PyGimpDrawable *drw;
|
||||
PyGimpDrawable *drw = NULL;
|
||||
gboolean shadow = FALSE;
|
||||
GimpRGB bg_color = { 0.0, 0.0, 0.0, 1.0 };
|
||||
GimpPixelFetcherEdgeMode edge_mode = GIMP_PIXEL_FETCHER_EDGE_NONE;
|
||||
|
@@ -215,6 +215,8 @@ vs_interpolate(PyGimpVectorsStroke *self, PyObject *args, PyObject *kwargs)
|
||||
PyTuple_SetItem(ret, 0, ret_coords);
|
||||
PyTuple_SetItem(ret, 1, PyBool_FromLong(closed));
|
||||
|
||||
g_free(coords);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -270,6 +272,8 @@ vs_get_points(PyGimpVectorsStroke *self, void *closure)
|
||||
PyTuple_SetItem(ret, 0, ret_points);
|
||||
PyTuple_SetItem(ret, 1, PyBool_FromLong(closed));
|
||||
|
||||
g_free(controlpoints);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -981,7 +985,7 @@ pygimp_vectors_new(gint32 ID)
|
||||
{
|
||||
PyGimpVectors *self;
|
||||
|
||||
if (ID == -1) {
|
||||
if (!gimp_vectors_is_valid(ID)) {
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
}
|
||||
|
@@ -33,7 +33,7 @@ extern PyObject *pygimp_error;
|
||||
|
||||
PyObject *pygimp_param_to_tuple(int nparams, const GimpParam *params);
|
||||
GimpParam *pygimp_param_from_tuple(PyObject *args, const GimpParamDef *ptype,
|
||||
int nparams);
|
||||
int nparams, const gchar *error_prefix);
|
||||
|
||||
|
||||
extern PyTypeObject PyGimpPDB_Type;
|
||||
@@ -80,12 +80,6 @@ extern PyTypeObject PyGimpTile_Type;
|
||||
#define pygimp_tile_check(v) (PyObject_TypeCheck(v, &PyGimpTile_Type))
|
||||
PyObject *pygimp_tile_new(GimpTile *tile, PyGimpDrawable *drw);
|
||||
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
GimpPixelRgn pr;
|
||||
PyGimpDrawable *drawable; /* keep the drawable around */
|
||||
} PyGimpPixelRgn;
|
||||
|
||||
extern PyTypeObject PyGimpPixelRgn_Type;
|
||||
#define pygimp_pixel_rgn_check(v) (PyObject_TypeCheck(v, &PyGimpPixelRgn_Type))
|
||||
PyObject *pygimp_pixel_rgn_new(PyGimpDrawable *drw, int x, int y,
|
||||
|
@@ -63,7 +63,7 @@ struct _PyGimpColor_Functions *_PyGimpColor_API;
|
||||
#define pygimp_rgb_from_pyobject (_PyGimpColor_API->rgb_from_pyobject)
|
||||
|
||||
#define init_pygimpcolor() G_STMT_START { \
|
||||
PyObject *gimpcolormodule = PyImport_ImportModule("gimpcolor"); \
|
||||
PyObject *gimpcolormodule = PyImport_ImportModule("gimp.color"); \
|
||||
if (gimpcolormodule != NULL) { \
|
||||
PyObject *mdict = PyModule_GetDict(gimpcolormodule); \
|
||||
PyObject *cobject = PyDict_GetItemString(mdict, "_PyGimpColor_API"); \
|
||||
|
92
plug-ins/pygimp/shelf.py
Normal file
92
plug-ins/pygimp/shelf.py
Normal file
@@ -0,0 +1,92 @@
|
||||
# Gimp-Python - allows the writing of Gimp plugins in Python.
|
||||
# Copyright (C) 1997 James Henstridge <james@daa.com.au>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
# shelf.py -- a simple module to help gimp modules written in Python
|
||||
# store persistent data.
|
||||
#
|
||||
# Copyright (C) 1997, James Henstridge
|
||||
#
|
||||
# The gimp module provides a basic method for storing information that persists
|
||||
# for a whole gimp session, but only allows for the storage of strings. This
|
||||
# is because other Python types usually have pointers to other Python objects,
|
||||
# making it dificult to work out what to save. This module gives an interface
|
||||
# to the gimp module's primitive interface, which resembles the shelve module.
|
||||
|
||||
# use cPickle and cStringIO if available
|
||||
|
||||
try:
|
||||
import cPickle as pickle
|
||||
except ImportError:
|
||||
import pickle
|
||||
|
||||
try:
|
||||
import cStringIO as StringIO
|
||||
except ImportError:
|
||||
import StringIO
|
||||
|
||||
import gimp
|
||||
|
||||
import copy_reg
|
||||
|
||||
def _image_id(obj):
|
||||
return gimp._id2image, (obj.ID,)
|
||||
|
||||
def _drawable_id(obj):
|
||||
return gimp._id2drawable, (obj.ID,)
|
||||
|
||||
def _display_id(obj):
|
||||
return gimp._id2display, (obj.ID,)
|
||||
|
||||
def _vectors_id(obj):
|
||||
return gimp._id2vectors, int(obj.ID)
|
||||
|
||||
copy_reg.pickle(gimp.Image, _image_id, gimp._id2image)
|
||||
copy_reg.pickle(gimp.Layer, _drawable_id, gimp._id2drawable)
|
||||
copy_reg.pickle(gimp.Channel, _drawable_id, gimp._id2drawable)
|
||||
copy_reg.pickle(gimp.Display, _display_id, gimp._id2display)
|
||||
copy_reg.pickle(gimp.Vectors, _vectors_id, gimp._id2vectors)
|
||||
|
||||
del copy_reg, _image_id, _drawable_id, _display_id, _vectors_id
|
||||
|
||||
class Gimpshelf:
|
||||
def has_key(self, key):
|
||||
try:
|
||||
s = gimp.get_data(key)
|
||||
return 1
|
||||
except gimp.error:
|
||||
return 0
|
||||
|
||||
def __getitem__(self, key):
|
||||
try:
|
||||
s = gimp.get_data(key)
|
||||
except gimp.error:
|
||||
raise KeyError, key
|
||||
|
||||
f = StringIO.StringIO(s)
|
||||
return pickle.Unpickler(f).load()
|
||||
|
||||
def __setitem__(self, key, value):
|
||||
f = StringIO.StringIO()
|
||||
p = pickle.Pickler(f)
|
||||
p.dump(value)
|
||||
gimp.set_data(key, f.getvalue())
|
||||
|
||||
def __delitem__(self, key):
|
||||
gimp.set_data(key, '')
|
||||
|
||||
shelf = Gimpshelf()
|
||||
del Gimpshelf
|
2
plug-ins/pygimp/testui
Executable file
2
plug-ins/pygimp/testui
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
gimp-2.5 -i --batch-interpreter python-fu-eval -b "-" < testui.py 2>&1
|
354
plug-ins/pygimp/testui.py
Normal file
354
plug-ins/pygimp/testui.py
Normal file
@@ -0,0 +1,354 @@
|
||||
import unittest
|
||||
import gimp
|
||||
import gtk
|
||||
import gobject
|
||||
|
||||
class TestAllWidgetFunctions(unittest.TestCase):
|
||||
|
||||
@classmethod
|
||||
def suite(cls):
|
||||
import unittest
|
||||
return unittest.makeSuite(cls,'test')
|
||||
|
||||
|
||||
def _testBoolGetterSetter(self, setter, getter):
|
||||
setter(True)
|
||||
assert getter() == True
|
||||
setter(False)
|
||||
assert getter() == False
|
||||
|
||||
def _testColorGetterSetter(self, setter, getter):
|
||||
setter(gimp.color.RGB(1,2,3))
|
||||
getter()
|
||||
|
||||
|
||||
def testAspectPreview(self):
|
||||
# FIXME
|
||||
# drawable = gimp.Image(100,100)
|
||||
# ap = gimp.ui.AspectPreview(drawable, False)
|
||||
# ap = gimp.ui.AspectPreview(drawable, True)
|
||||
pass
|
||||
|
||||
def testBrowser(self):
|
||||
browser = gimp.ui.Browser()
|
||||
browser.add_search_types((".gif", 1), (".png", 2))
|
||||
browser.set_widget(gtk.Button("some label"))
|
||||
browser.show_message("Some label")
|
||||
|
||||
def testBrushSelectButton(self):
|
||||
bs = gimp.ui.BrushSelectButton("Some title", gimp.context.get_brush(), 1.0, 10,
|
||||
gimp.enums.NORMAL_MODE)
|
||||
# FIXME
|
||||
bs.set_brush(str(gimp.context.get_brush()), 1.0, 10, gimp.enums.NORMAL_MODE)
|
||||
brush = bs.get_brush()
|
||||
|
||||
def testButton(self):
|
||||
button = gimp.ui.Button()
|
||||
button.extended_clicked(gtk.gdk.BUTTON1_MASK)
|
||||
|
||||
def testCellRendererColor(self):
|
||||
crc = gimp.ui.CellRendererColor()
|
||||
crc.props.color = gimp.color.RGB(255,0,0)
|
||||
crc.props.opaque = True
|
||||
crc.props.icon_size = 10
|
||||
|
||||
def testCellRendererToggle(self):
|
||||
crt = gimp.ui.CellRendererToggle("Some stock id")
|
||||
crt.props.stock_id = "foobar"
|
||||
crt.props.stock_size = 2
|
||||
|
||||
def testChainButton(self):
|
||||
cb = gimp.ui.ChainButton(gimp.ui.CHAIN_TOP)
|
||||
self._testBoolGetterSetter(cb.set_active, cb.get_active)
|
||||
|
||||
def testChannelComboBox(self):
|
||||
ccb = gimp.ui.ChannelComboBox(lambda value: True)
|
||||
ccb = gimp.ui.ChannelComboBox(lambda value, data: False, "Some Data")
|
||||
|
||||
def testColorArea(self):
|
||||
ca = gimp.ui.ColorArea(gimp.color.RGB(255, 0, 0), gimp.ui.COLOR_AREA_FLAT,
|
||||
gtk.gdk.BUTTON1_MASK)
|
||||
ca.set_color(gimp.color.RGB(255, 0, 0))
|
||||
color = ca.get_color()
|
||||
has_alpha = ca.has_alpha()
|
||||
ca.set_type(gimp.ui.COLOR_AREA_SMALL_CHECKS)
|
||||
ca.set_draw_border(True)
|
||||
|
||||
def testColorButton(self):
|
||||
cb = gimp.ui.ColorButton("Some title", 100, 40, gimp.color.RGB(200,255,10),
|
||||
gimp.ui.COLOR_AREA_FLAT)
|
||||
cb.set_color(gimp.color.RGB(255, 1, 2, 3))
|
||||
color = cb.get_color()
|
||||
has_alpha = cb.has_alpha()
|
||||
cb.set_type(gimp.ui.COLOR_AREA_SMALL_CHECKS)
|
||||
cb.set_update(True)
|
||||
update = cb.get_update()
|
||||
|
||||
def testColorDisplay(self):
|
||||
# FIXME
|
||||
pass
|
||||
|
||||
def testColorDisplayStack(self):
|
||||
# FIXME
|
||||
pass
|
||||
|
||||
def testColorHexEntry(self):
|
||||
che = gimp.ui.ColorHexEntry()
|
||||
che.set_color(gimp.color.RGB(0,0,0))
|
||||
color = che.get_color()
|
||||
|
||||
def testColorNotebook(self):
|
||||
cn = gimp.ui.ColorNotebook()
|
||||
page = cn.set_has_page(gimp._ui.ColorSelector.__gtype__, False)
|
||||
|
||||
def testColorProfileComboBox(self):
|
||||
cps = gimp.ui.ColorProfileStore("history")
|
||||
cpcb = gimp.ui.ColorProfileComboBox(gtk.Dialog(), cps)
|
||||
cpcb.add("Some/filename", "Some label")
|
||||
cpcb.set_active("Some/filename", "Some label")
|
||||
cpcb.get_active()
|
||||
|
||||
def testColorProfileStore(self):
|
||||
cps = gimp.ui.ColorProfileStore("history")
|
||||
cps.add("Some/filename", "Some label")
|
||||
|
||||
def testColorScale(self):
|
||||
cs = gimp.ui.ColorScale(gtk.ORIENTATION_VERTICAL, gimp.ui.COLOR_SELECTOR_SATURATION)
|
||||
cs.set_channel(gimp.ui.COLOR_SELECTOR_GREEN)
|
||||
cs.set_color(gimp.color.RGB(1,2,3), gimp.color.HSV(3,2,1))
|
||||
|
||||
def testColorSelection(self):
|
||||
cs = gimp.ui.ColorSelection()
|
||||
self._testBoolGetterSetter(cs.set_show_alpha, cs.get_show_alpha)
|
||||
self._testColorGetterSetter(cs.set_color, cs.get_color)
|
||||
self._testColorGetterSetter(cs.set_old_color, cs.get_old_color)
|
||||
cs.reset()
|
||||
cs.color_changed()
|
||||
#cs.set_config(None)
|
||||
|
||||
def testDialog(self):
|
||||
dialog = gimp.ui.Dialog("Some title", "Some role", None, 0,
|
||||
lambda id: True, "Some help id",
|
||||
("foo", 1, "bar", 2))
|
||||
dialog.add_button("batz", 2)
|
||||
# dialog.run()
|
||||
dialog.set_transient()
|
||||
def testDrawableComboBox(self):
|
||||
dcb = gimp.ui.DrawableComboBox(lambda value: True)
|
||||
dcb = gimp.ui.DrawableComboBox(lambda value, data: False, "Some data")
|
||||
|
||||
def testDrawablePreview(self):
|
||||
image = gimp.Image(100, 100)
|
||||
dp = gimp.ui.DrawablePreview(image)
|
||||
|
||||
def testEnumComboBox(self):
|
||||
ecb = gimp.ui.EnumComboBox(gimp.ui.ColorSelectorChannel.__gtype__)
|
||||
ecb.set_stock_prefix("FOOBAR")
|
||||
|
||||
def testEnumLabel(self):
|
||||
el = gimp.ui.EnumLabel(gimp.ui.ColorSelectorChannel.__gtype__, 0)
|
||||
el.set_value(1)
|
||||
|
||||
def testEnumStore(self):
|
||||
es = gimp.ui.EnumStore(gimp.ui.ColorSelectorChannel.__gtype__)
|
||||
es = gimp.ui.EnumStore(gimp.ui.ColorSelectorChannel.__gtype__, 1, 3)
|
||||
es.set_stock_prefix("FOOBAR")
|
||||
|
||||
def testFontSelectButton(self):
|
||||
fsb = gimp.ui.FontSelectButton("Some title", "Some font")
|
||||
fsb.set_font("Arial")
|
||||
font = fsb.get_font()
|
||||
|
||||
def testFrame(self):
|
||||
frame = gimp.ui.Frame("Some title")
|
||||
|
||||
def testGradientSelectButton(self):
|
||||
gsb = gimp.ui.GradientSelectButton("Some title",
|
||||
gimp.context.get_gradient())
|
||||
# FIXME
|
||||
gsb.set_gradient(str(gimp.context.get_gradient()))
|
||||
gradient = gsb.get_gradient()
|
||||
|
||||
def testHintBox(self):
|
||||
hb = gimp.ui.HintBox("Some hint")
|
||||
|
||||
def testImageComboBox(self):
|
||||
icb = gimp.ui.ImageComboBox(lambda value: True)
|
||||
icb = gimp.ui.ImageComboBox(lambda value, data: False, "Some data")
|
||||
|
||||
def testIntComboBox(self):
|
||||
icb = gimp.ui.IntComboBox(("foo", 1))
|
||||
icb.prepend(("bar", 2))
|
||||
icb.append(("batz", 3))
|
||||
icb.set_active(1)
|
||||
active = icb.get_active()
|
||||
icb.set_sensitivity(lambda value: True)
|
||||
icb.set_sensitivity(lambda value, data: False, "Some data")
|
||||
|
||||
def testIntStore(self):
|
||||
intstore = gimp.ui.IntStore()
|
||||
intstore.lookup_by_value(10)
|
||||
|
||||
def testLayerComboBox(self):
|
||||
lcb = gimp.ui.LayerComboBox(lambda value: True)
|
||||
lcb = gimp.ui.LayerComboBox(lambda value, data: False, "Some data")
|
||||
|
||||
def testMemsizeEntry(self):
|
||||
me = gimp.ui.MemsizeEntry(10, 0, 100)
|
||||
me.set_value(20)
|
||||
value = me.get_value()
|
||||
|
||||
def testNumberPairEntry(self):
|
||||
npe = gimp.ui.NumberPairEntry("-", True, 1.5, 2)
|
||||
npe.set_default_values(4.3, 5)
|
||||
default_values = npe.get_default_values()
|
||||
npe.set_values(1, 2.4)
|
||||
values = npe.get_values()
|
||||
npe.set_default_text("MOO")
|
||||
default_text = npe.get_default_text()
|
||||
npe.set_ratio(2)
|
||||
ratio = npe.get_ratio()
|
||||
npe.set_aspect(4)
|
||||
aspect = npe.get_aspect()
|
||||
self._testBoolGetterSetter(npe.set_user_override, npe.get_user_override)
|
||||
|
||||
def testOffsetAreas(self):
|
||||
oa = gimp.ui.OffsetArea(200, 100)
|
||||
oa.set_pixbuf(gtk.gdk.pixbuf_new_from_file("../../data/images/wilber.png"))
|
||||
oa.set_size(10,20)
|
||||
oa.set_offsets(30, 49)
|
||||
|
||||
def testPageSelector(self):
|
||||
ps = gimp.ui.PageSelector()
|
||||
ps.set_n_pages(10)
|
||||
n_pages = ps.get_n_pages()
|
||||
ps.set_target(gimp.ui.gimp.ui.PAGE_SELECTOR_TARGET_IMAGES)
|
||||
target = ps.get_target()
|
||||
# FIXME
|
||||
# ps.set_page_thumbnail()
|
||||
# ps.get_page_thumbnail()
|
||||
ps.set_page_label(1, "Some label")
|
||||
label = ps.get_page_label(0)
|
||||
ps.select_all()
|
||||
ps.unselect_all()
|
||||
ps.select_page(0)
|
||||
ps.unselect_page(1)
|
||||
ps.page_is_selected(0)
|
||||
ps.get_selected_pages()
|
||||
ps.select_range("2,4-6")
|
||||
ps.get_selected_range()
|
||||
|
||||
def testPaletteSelectButton(self):
|
||||
psb = gimp.ui.PaletteSelectButton("Some title",
|
||||
gimp.context.get_palette())
|
||||
# FIXME
|
||||
psb.set_palette(str(gimp.context.get_palette()))
|
||||
psb.get_palette()
|
||||
|
||||
def testPathEditor(self):
|
||||
pe = gimp.ui.PathEditor("Some title", "Some/path")
|
||||
pe.set_path("Some/pther/path")
|
||||
pe.get_path()
|
||||
pe.set_writable_path("foo/bar")
|
||||
pe.get_writable_path()
|
||||
pe.set_dir_writable("foo/bar", True)
|
||||
pe.get_dir_writable("foo/bar")
|
||||
|
||||
def testPatternSelectButton(self):
|
||||
psb = gimp.ui.PatternSelectButton("Some title",
|
||||
gimp.context.get_pattern())
|
||||
# FIXME
|
||||
psb.set_pattern(str(gimp.context.get_pattern()))
|
||||
psb.get_pattern()
|
||||
|
||||
def testPickButton(self):
|
||||
pb = gimp.ui.PickButton()
|
||||
|
||||
def testPreview(self):
|
||||
# FIXME
|
||||
pass
|
||||
|
||||
def testPreviewArea(self):
|
||||
# FIXME
|
||||
pass
|
||||
|
||||
def testProcBrowserDialog(self):
|
||||
pbd = gimp.ui.ProcBrowserDialog("Some title", "Some role")
|
||||
pbd.get_selected()
|
||||
pbd = gimp.ui.ProcBrowserDialog("Some title", "Some role",
|
||||
lambda id: True, "some help id")
|
||||
pbd = gimp.ui.ProcBrowserDialog("Some title", "Some role",
|
||||
lambda id:False, "some help id",
|
||||
("foo", 0, "bar", 1))
|
||||
|
||||
def testProgressBar(self):
|
||||
pb = gimp.ui.ProgressBar()
|
||||
|
||||
def testScrolledPreview(self):
|
||||
# FIXME
|
||||
pass
|
||||
|
||||
def testSelectButton(self):
|
||||
sb = gimp.ui.SelectButton()
|
||||
sb.close_popup()
|
||||
|
||||
def testSizeEntry(self):
|
||||
return
|
||||
# FIXME
|
||||
se = gimp.ui.SizeEntry(3, gimp.enums.UNIT_PIXEL, "%a", True, False, True, 100,
|
||||
gimp.ui.SIZE_ENTRY_UPDATE_NONE)
|
||||
se.add_field(gtk.SpinButton(), gtk.SpinButton())
|
||||
se.attach_label("foo", 0, 0, 0.5)
|
||||
se.set_resolution(0, 3, True)
|
||||
se.set_size(0, 0, 100)
|
||||
se.set_value_boundaries(0, 10, 20)
|
||||
se.get_value(0)
|
||||
se.set_value(0, 4.4)
|
||||
se.set_refval_boundaries(0, 0, 10)
|
||||
se.set_refval_digits(0, 2)
|
||||
se.set_refval(0, 1.3)
|
||||
se.get_refval(0)
|
||||
se.get_unit()
|
||||
se.set_unit(gimp.enums.UNIT_PIXEL)
|
||||
se.show_unit_menu(True)
|
||||
se.set_pixel_digits(2)
|
||||
se.grab_focus()
|
||||
se.set_activates_default(True)
|
||||
# FIXME
|
||||
# se.get_help_widget(0)
|
||||
|
||||
def testStringComboBox(self):
|
||||
|
||||
scb = gimp.ui.StringComboBox(gtk.ListStore(gobject.TYPE_STRING,
|
||||
gobject.TYPE_STRING), 0, 1)
|
||||
scb.set_active("foo")
|
||||
scb.get_active()
|
||||
|
||||
def testUnitMenu(self):
|
||||
um = gimp.ui.UnitMenu("%y%a", gimp.enums.UNIT_PIXEL, True, True, True)
|
||||
um.set_unit(gimp.enums.UNIT_INCH)
|
||||
um.get_unit()
|
||||
um.set_pixel_digits(10)
|
||||
um.get_pixel_digits()
|
||||
|
||||
def testVectorsComboBox(self):
|
||||
vcb = gimp.ui.VectorsComboBox(lambda value: True)
|
||||
vcb = gimp.ui.VectorsComboBox(lambda value, data: False, "Some data")
|
||||
|
||||
def testZoomModel(self):
|
||||
zm = gimp.ui.ZoomModel()
|
||||
zm.set_range(5, 5.5)
|
||||
zm.zoom(gimp.ui.ZOOM_IN, 3)
|
||||
zm.get_factor()
|
||||
zm.get_fraction()
|
||||
|
||||
def testZoomPreview(self):
|
||||
image = gimp.Image(100, 100)
|
||||
zp = gimp.ui.ZoomPreview(image)
|
||||
assert zp.get_drawable() == image
|
||||
zp.get_model()
|
||||
zp.get_factor()
|
||||
|
||||
if __name__ == "__main__":
|
||||
runner = unittest.TextTestRunner()
|
||||
runner.run(TestAllWidgetFunctions.suite())
|
224
plug-ins/pygimp/tools.py
Normal file
224
plug-ins/pygimp/tools.py
Normal file
@@ -0,0 +1,224 @@
|
||||
# *- Mode: Python; py-indent-offset: 4 -*-
|
||||
# Gimp-Python - allows the writing of Gimp plugins in Python.
|
||||
# Copyright (C) 2008 Lars-Peter Clausen <lars@metafoo.de>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||
# 02111-1307, USA.
|
||||
|
||||
"""This module provides functions for painting and selecting regions on an image
|
||||
or drawable."""
|
||||
|
||||
import gimp
|
||||
|
||||
# Helper functions
|
||||
|
||||
def _active_image():
|
||||
"""Returns the active image as gimp.Image or None."""
|
||||
il = gimp.image_list()
|
||||
if(len(il) > 0):
|
||||
return il[0]
|
||||
return None
|
||||
|
||||
def _active_drawable():
|
||||
"""Returns the active drawable of the active image as gimp.Drawable or
|
||||
None."""
|
||||
active_image = _active_image()
|
||||
if active_image:
|
||||
return active_image.active_drawable
|
||||
return None
|
||||
|
||||
# Paint tools
|
||||
|
||||
def brush(drawable, first_point, *args):
|
||||
if drawable == None:
|
||||
drawable = _active_drawable()
|
||||
points = [first_point] + list(args)
|
||||
points = sum(map(list, points), [])
|
||||
gimp.pdb.gimp_brush(drawable, len(points), points)
|
||||
|
||||
def clone(drawable, strokes, src_drawable = None, src_x = 0, src_y = 0,
|
||||
clone_type = gimp.enums.IMAGE_CLONE):
|
||||
if drawable == None:
|
||||
drawable = _active_drawable()
|
||||
strokes = sum(map(list, strokes), [])
|
||||
if not src_drawable:
|
||||
src_drawable = drawable
|
||||
|
||||
gimp.pdb.gimp_clone(drawable, src_drawable, clone_type, src_x, src_y,
|
||||
len(strokes), strokes)
|
||||
|
||||
def convolve(drawable, strokes, pressure = 50,
|
||||
convolve_type = gimp.enums.BLUR_CONVOLE):
|
||||
if drawable == None:
|
||||
drawable = _active_drawable()
|
||||
strokes = sum(map(list, strokes), [])
|
||||
gimp.pdb.gimp_convolve(drawable, pressure, convolve_type, len(strokes), strokes)
|
||||
|
||||
def dodgeburn(drawable, strokes, exposure = 50, type = gimp.enums.DODGE,
|
||||
mode = gimp.enums.SHADOWS):
|
||||
if drawable == None:
|
||||
drawable = _active_drawable()
|
||||
strokes = sum(map(list, strokes), [])
|
||||
gimp.pdb.gimp_dodgeburn(drawable, exposure, type, mode, len(strokes),
|
||||
strokes)
|
||||
|
||||
def eraser(drawable, strokes, soft = False, method = gimp.enums.PAINT_CONSTANT):
|
||||
if drawable == None:
|
||||
drawable = _active_drawable()
|
||||
strokes = sum(map(list, strokes), [])
|
||||
gimp.pdb.gimp_eraser(drawable, len(strokes), strokes, soft, method)
|
||||
|
||||
def paintbrush(drawable, strokes, fade_out = 0,
|
||||
method = gimp.enums.PAINT_CONSTANT, gradient_length = 0):
|
||||
if drawable == None:
|
||||
drawable = _active_drawable()
|
||||
strokes = sum(map(list, strokes), [])
|
||||
gimp.pdb.gimp_paintbrush(drawable, fade_out, len(strokes), strokes, method,
|
||||
gradient_length)
|
||||
|
||||
def pencil(drawable, first_point, *args):
|
||||
if drawable == None:
|
||||
drawable = _active_drawable()
|
||||
points = [first_point] + list(args)
|
||||
points = sum(map(list, points), [])
|
||||
gimp.pdb.gimp_pencil(drawable, len(points), points)
|
||||
|
||||
def smudge(drawable, strokes, pressure = 50):
|
||||
if drawable == None:
|
||||
drawable = _active_drawable()
|
||||
strokes = sum(map(list, strokes), [])
|
||||
gimp.pdb.gimp_smudge(drawable, pressure, len(strokes), strokes)
|
||||
|
||||
# Edit tools
|
||||
|
||||
def blend(drawable, blend_mode = gimp.enums.FG_BG_RGB_MODE,
|
||||
paint_mode = gimp.enums.NORMAL_MODE,
|
||||
gradient_type = gimp.enums.GRADIENT_LINEAR,
|
||||
opacity = 100, offset = 0, repeat_mode = gimp.enums.REPEAT_NONE,
|
||||
reverse = False, supersample = False, max_supersampling_depth = 1,
|
||||
supersampling_threshold = 1, dither = False, x1 = 0, y1 = 0, x2 = 0,
|
||||
y2 = 0):
|
||||
if drawable == None:
|
||||
drawable = _active_drawable()
|
||||
gimp.pdb.gimp_edit_blend(drawable, blend_mode, paint_mode, gradient_type,
|
||||
opacity, offset, repeat_mode, reverse, supersample,
|
||||
max_supersampling_depth, supersampling_threshold,
|
||||
dither, x1, y1, x2, y2)
|
||||
|
||||
def fill(drawable, fill_mode = gimp.enums.FOREGROUND_FILL):
|
||||
if drawable == None:
|
||||
drawable = _active_drawable()
|
||||
gimp.pdb.gimp_edit_fill(drawable, fill_mode)
|
||||
|
||||
def bucket_fill(drawable, fill_mode = gimp.enums.FG_BUCKET_FILL,
|
||||
paint_mode = gimp.enums.NORMAL_MODE, opacity = 100,
|
||||
threshold = 0, sample_merged = False, fill_transparent = False,
|
||||
select_criterion = gimp.enums.SELECT_CRITERION_COMPOSITE,
|
||||
x = 0, y = 0):
|
||||
if drawable == None:
|
||||
drawable = _active_drawable()
|
||||
gimp.pdb.gimp_edit_bucket_fill_full(drawable, fill_mode, paint_mode,
|
||||
opacity, threshold, sample_merged,
|
||||
fill_transparent, select_criterion,
|
||||
x, y)
|
||||
|
||||
def stroke_selection(drawable):
|
||||
if drawable == None:
|
||||
drawable = _active_drawable()
|
||||
gimp.pdb.gimp_edit_stroke(drawable)
|
||||
|
||||
def stroke_vectors(drawable, vectors):
|
||||
if drawable == None:
|
||||
drawable = _active_drawable()
|
||||
gimp.pdb.gimp_edit_stroke_vectors(drawable, vectors)
|
||||
|
||||
# Select tools
|
||||
|
||||
def _feather_helper(feather_radius):
|
||||
if feather_radius == None:
|
||||
return False, 0.0
|
||||
return True, feather_radius
|
||||
|
||||
def _radius_helper(radius):
|
||||
if isinstance(radius, tuple):
|
||||
return radius
|
||||
return radius, radius
|
||||
|
||||
def select_by_color(drawable, color, threshold = 0,
|
||||
operation = gimp.enums.CHANNEL_OP_REPLACE,
|
||||
antialias = False, feather_radius = 0,
|
||||
sample_merged = False, select_transparent = False,
|
||||
select_criterion = gimp.enums.SELECT_CRITERION_COMPOSITE):
|
||||
if drawable == None:
|
||||
drawable = _active_drawable()
|
||||
do_feather, feather_radius = _feather_helper(feater_radius)
|
||||
feather_radius_x, feather_radius_y = _radius_helper(feather_radius)
|
||||
|
||||
gimp.pdb.gimp_by_color_select(drawable, color, threshold, operation,
|
||||
antialias, do_feather, feather_radius_x,
|
||||
feather_radius_y, sample_merged,
|
||||
select_transparent, select_criterion)
|
||||
|
||||
def select_elipse(image, x, y, width, height,
|
||||
operation = gimp.enums.CHANNEL_OP_REPLACE,
|
||||
feather_radius = None):
|
||||
do_feather, feather_radius = _feather_helper(feater_radius)
|
||||
|
||||
gimp.pdb.gimp_elipse_select(image, x, y, width, height, operation,
|
||||
do_feather, feather_radius)
|
||||
|
||||
def select_free(image, points, operation = gimp.enums.CHANNEL_OP_REPLACE,
|
||||
antialias = False, feather_radius = None):
|
||||
do_feather, feather_radius = _feather_helper(feater_radius)
|
||||
points = sum(map(list, points), [])
|
||||
|
||||
gimp.pdb.free_select(image, points, len(points), operation, antialias,
|
||||
do_feather, feather_radius)
|
||||
|
||||
def select_fuzzy(drawable, x, y, threshold = 0,
|
||||
operation = gimp.enums.CHANNEL_OP_REPLACE, antialias = False,
|
||||
feather_radius = None, sample_merged = False,
|
||||
select_transparent = False,
|
||||
select_criterion = gimp.enums.SELECT_CRITERION_COMPOSITE):
|
||||
if drawable == None:
|
||||
drawable = _active_drawable()
|
||||
do_feather, feather_radius = _feather_helper(feater_radius)
|
||||
|
||||
gimp.pdb.fuzzy_select(image, x, y, threshold, antialias, do_feather,
|
||||
feather_radius, sample_merged, select_transparent,
|
||||
select_criterion)
|
||||
|
||||
def select_rect(image, x, y, width, height,
|
||||
operation = gimp.enums.CHANNEL_OP_REPLACE,
|
||||
feather_radius = None):
|
||||
do_feather, feather_radius = _feather_helper(feater_radius)
|
||||
|
||||
gimp.pdb.gimp_rect_select(image, x, y, width, height, operation,
|
||||
do_feather, feather_radius)
|
||||
|
||||
def select_round_rect(image, x, y, width, height, corner_radius,
|
||||
operation = gimp.enums.CHANNEL_OP_REPLACE,
|
||||
antialias = False, feather_radius = None):
|
||||
do_feather, feather_radius = _feather_helper(feather_radius)
|
||||
feather_radius_x, feather_radius_y = _radius_helper(feather_radius)
|
||||
corner_radius_x, corner_radius_y = _radius_helper(corner_radius)
|
||||
|
||||
gimp.pdb.gimp_round_rect_select(image, x, y, width, height, corner_radius_x,
|
||||
corner_radius_y, operation, antialias,
|
||||
do_feather, feather_radius_x,
|
||||
feather_radius_y)
|
||||
|
||||
|
||||
|
228
plug-ins/pygimp/ui.py
Normal file
228
plug-ins/pygimp/ui.py
Normal file
@@ -0,0 +1,228 @@
|
||||
# Gimp-Python - allows the writing of Gimp plugins in Python.
|
||||
# Copyright (C) 1997 James Henstridge <james@daa.com.au>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
|
||||
'''This module implements the UI items found in the libgimpui library.
|
||||
It requires pygtk to work. These functions take use to callbacks -- one
|
||||
is a constraint function, and the other is the callback object. The
|
||||
constraint function takes an image object as its first argument, and
|
||||
a drawable object as its second if appropriate. The callback functions
|
||||
get the selected object as their first argument, and the user data as
|
||||
the second.
|
||||
|
||||
It also implements a number of selector widgets, which can be used to select
|
||||
various gimp data types. Each of these selectors takes default as an argument
|
||||
to the constructor, and has a get_value() method for retrieving the result.
|
||||
'''
|
||||
|
||||
import pygtk
|
||||
pygtk.require('2.0')
|
||||
|
||||
import gtk, gobject, gimp
|
||||
|
||||
from _ui import *
|
||||
|
||||
import gettext
|
||||
t = gettext.translation('gimp20-python', gimp.locale_directory, fallback=True)
|
||||
_ = t.ugettext
|
||||
|
||||
def _callbackWrapper(menu_item, callback, data):
|
||||
callback(menu_item.get_data("Gimp-ID"), data)
|
||||
|
||||
def _createMenu(items, callback, data):
|
||||
menu = gtk.Menu()
|
||||
if not items:
|
||||
items = [("(none)", None)]
|
||||
for label, id in items:
|
||||
menu_item = gtk.MenuItem(label)
|
||||
menu_item.set_data("Gimp-ID", id)
|
||||
menu.add(menu_item)
|
||||
if callback:
|
||||
menu_item.connect("activate", _callbackWrapper,
|
||||
callback, data)
|
||||
menu_item.show()
|
||||
return menu
|
||||
|
||||
|
||||
def ImageMenu(constraint=None, callback=None, data=None):
|
||||
items = []
|
||||
for img in gimp.image_list():
|
||||
if constraint and not constraint(img):
|
||||
continue
|
||||
if not img.filename:
|
||||
filename = img.name
|
||||
else:
|
||||
filename = img.filename
|
||||
items.append((filename, img))
|
||||
items.sort()
|
||||
return _createMenu(items, callback, data)
|
||||
|
||||
def LayerMenu(constraint=None, callback=None, data=None):
|
||||
items = []
|
||||
for img in gimp.image_list():
|
||||
filename = img.filename
|
||||
if not filename:
|
||||
filename = img.name
|
||||
for layer in img.layers:
|
||||
if constraint and not constraint(img, layer):
|
||||
continue
|
||||
name = filename + "/" + layer.name
|
||||
items.append((name, layer))
|
||||
items.sort()
|
||||
return _createMenu(items, callback, data)
|
||||
|
||||
def ChannelMenu(constraint=None, callback=None, data=None):
|
||||
items = []
|
||||
for img in gimp.image_list():
|
||||
filename = img.filename
|
||||
if not filename:
|
||||
filename = img.name
|
||||
for channel in img.channels:
|
||||
if constraint and not constraint(img, channel):
|
||||
continue
|
||||
name = filename + "/" + channel.name
|
||||
items.append((name, channel))
|
||||
items.sort()
|
||||
return _createMenu(items, callback, data)
|
||||
|
||||
def DrawableMenu(constraint=None, callback=None, data=None):
|
||||
items = []
|
||||
for img in gimp.image_list():
|
||||
filename = img.filename
|
||||
if not filename:
|
||||
filename = img.name
|
||||
for drawable in img.layers + img.channels:
|
||||
if constraint and not constraint(img, drawable):
|
||||
continue
|
||||
name = filename + "/" + drawable.name
|
||||
items.append((name, drawable))
|
||||
items.sort()
|
||||
return _createMenu(items, callback, data)
|
||||
|
||||
def VectorsMenu(constraint=None, callback=None, data=None):
|
||||
items = []
|
||||
for img in gimp.image_list():
|
||||
filename = img.filename
|
||||
if not filename:
|
||||
filename = img.name
|
||||
for vectors in img.vectors:
|
||||
if constraint and not constraint(img, vectors):
|
||||
continue
|
||||
name = filename + "/" + vectors.name
|
||||
items.append((name, vectors))
|
||||
items.sort()
|
||||
return _createMenu(items, callback, data)
|
||||
|
||||
class ImageSelector(ImageComboBox):
|
||||
def __init__(self, default=None):
|
||||
ImageComboBox.__init__(self)
|
||||
if default is not None:
|
||||
self.set_active_image(default)
|
||||
def get_value(self):
|
||||
return self.get_active_image()
|
||||
|
||||
class LayerSelector(LayerComboBox):
|
||||
def __init__(self, default=None):
|
||||
LayerComboBox.__init__(self)
|
||||
if default is not None:
|
||||
self.set_active_layer(default)
|
||||
def get_value(self):
|
||||
return self.get_active_layer()
|
||||
|
||||
class ChannelSelector(ChannelComboBox):
|
||||
def __init__(self, default=None):
|
||||
ChannelComboBox.__init__(self)
|
||||
if default is not None:
|
||||
self.set_active_channel(default)
|
||||
def get_value(self):
|
||||
return self.get_active_channel()
|
||||
|
||||
class DrawableSelector(DrawableComboBox):
|
||||
def __init__(self, default=None):
|
||||
DrawableComboBox.__init__(self)
|
||||
if default is not None:
|
||||
self.set_active_drawable(default)
|
||||
def get_value(self):
|
||||
return self.get_active_drawable()
|
||||
|
||||
class VectorsSelector(VectorsComboBox):
|
||||
def __init__(self, default=None):
|
||||
VectorsComboBox.__init__(self)
|
||||
if default is not None:
|
||||
self.set_active_vectors(default)
|
||||
def get_value(self):
|
||||
return self.get_active_vectors()
|
||||
|
||||
class ColorSelector(ColorButton):
|
||||
def __init__(self, default=gimp.color.RGB(1.0, 0, 0)):
|
||||
if isinstance(default, gimp.color.RGB):
|
||||
color = default
|
||||
elif isinstance(default, tuple):
|
||||
color = apply(gimp.color.RGB, default)
|
||||
elif isinstance(default, str):
|
||||
color = gimp.color.rgb_parse_css(default)
|
||||
ColorButton.__init__(self, _("Python-Fu Color Selection"), 100, 20,
|
||||
color, COLOR_AREA_FLAT)
|
||||
def get_value(self):
|
||||
return self.get_color();
|
||||
|
||||
class PatternSelector(PatternSelectButton):
|
||||
def __init__(self, default=""):
|
||||
PatternSelectButton.__init__(self)
|
||||
if default:
|
||||
self.set_pattern(default)
|
||||
def get_value(self):
|
||||
return self.get_pattern()
|
||||
|
||||
class BrushSelector(BrushSelectButton):
|
||||
def __init__(self, default=""):
|
||||
BrushSelectButton.__init__(self)
|
||||
if default:
|
||||
self.set_brush(default, -1.0, -1, -1)
|
||||
def get_value(self):
|
||||
return self.get_brush()[0]
|
||||
|
||||
class GradientSelector(GradientSelectButton):
|
||||
def __init__(self, default=""):
|
||||
GradientSelectButton.__init__(self)
|
||||
if default:
|
||||
self.set_gradient(default)
|
||||
def get_value(self):
|
||||
return self.get_gradient()
|
||||
|
||||
class PaletteSelector(PaletteSelectButton):
|
||||
def __init__(self, default=""):
|
||||
PaletteSelectButton.__init__(self)
|
||||
if default:
|
||||
self.set_palette(default)
|
||||
def get_value(self):
|
||||
return self.get_palette()
|
||||
|
||||
class FontSelector(FontSelectButton):
|
||||
def __init__(self, default="Sans"):
|
||||
FontSelectButton.__init__(self)
|
||||
if default:
|
||||
self.set_font(default)
|
||||
def get_value(self):
|
||||
return self.get_font()
|
||||
|
||||
class FileSelector(gtk.FileChooserButton):
|
||||
def __init__(self, default=""):
|
||||
gtk.FileChooserButton.__init__(self, _("Python-Fu File Selection"))
|
||||
if default:
|
||||
self.set_filename(default)
|
||||
def get_value(self):
|
||||
return self.get_filename()
|
Reference in New Issue
Block a user