Updated with upstream update
This commit is contained in:
@ -167,6 +167,7 @@ The color bpp is zero and pixels empty when the brush is parametric versus raste
|
||||
HELP
|
||||
|
||||
&mitch_pdb_misc('2004', '2.2');
|
||||
$lib_private = 1;
|
||||
|
||||
@inargs = (
|
||||
${brush_arg_spec}
|
||||
|
@ -27,19 +27,23 @@ sub brushes_popup {
|
||||
desc => 'The callback PDB proc to call when user chooses a brush' },
|
||||
{ name => 'popup_title', type => 'string',
|
||||
desc => 'Title of the brush selection dialog' },
|
||||
{ name => 'initial_brush_name', type => 'string', null_ok => 1,
|
||||
desc => 'The name of the brush to set as the initial choice' }
|
||||
{ name => 'initial_brush', type => 'brush', null_ok => 1,
|
||||
desc => 'The brush to set as the initial choice' },
|
||||
{ name => 'parent_window', type => 'bytes', null_ok => 1,
|
||||
desc => 'An optional parent window handle for the popup to be set transient to' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
if (pika->no_interface ||
|
||||
PikaContainer *container = pika_data_factory_get_container (pika->brush_factory);
|
||||
|
||||
if (pika->no_interface ||
|
||||
! pika_pdb_lookup_procedure (pika->pdb, brush_callback) ||
|
||||
! pika_pdb_dialog_new (pika, context, progress,
|
||||
pika_data_factory_get_container (pika->brush_factory),
|
||||
popup_title, brush_callback, initial_brush_name,
|
||||
NULL))
|
||||
pika_container_get_children_type (container),
|
||||
parent_window, popup_title, brush_callback,
|
||||
PIKA_OBJECT (initial_brush), NULL))
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
@ -60,9 +64,12 @@ sub brushes_close_popup {
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
PikaContainer *container = pika_data_factory_get_container (pika->brush_factory);
|
||||
|
||||
if (pika->no_interface ||
|
||||
! pika_pdb_lookup_procedure (pika->pdb, brush_callback) ||
|
||||
! pika_pdb_dialog_close (pika, pika_data_factory_get_container (pika->brush_factory),
|
||||
! pika_pdb_dialog_close (pika,
|
||||
pika_container_get_children_type (container),
|
||||
brush_callback))
|
||||
success = FALSE;
|
||||
}
|
||||
@ -79,18 +86,20 @@ sub brushes_set_popup {
|
||||
@inargs = (
|
||||
{ name => 'brush_callback', type => 'string', non_empty => 1,
|
||||
desc => 'The name of the callback registered for this pop-up' },
|
||||
{ name => 'brush_name', type => 'string',
|
||||
desc => 'The name of the brush to set as selected' }
|
||||
{ name => 'brush', type => 'brush',
|
||||
desc => 'The brush to set as selected' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
PikaContainer *container = pika_data_factory_get_container (pika->brush_factory);
|
||||
|
||||
if (pika->no_interface ||
|
||||
! pika_pdb_lookup_procedure (pika->pdb, brush_callback) ||
|
||||
! pika_pdb_dialog_set (pika, pika_data_factory_get_container (pika->brush_factory),
|
||||
brush_callback, brush_name,
|
||||
NULL))
|
||||
! pika_pdb_dialog_set (pika,
|
||||
pika_container_get_children_type (container),
|
||||
brush_callback, PIKA_OBJECT (brush), NULL))
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
@ -99,6 +108,7 @@ CODE
|
||||
|
||||
|
||||
@headers = qw("core/pika.h"
|
||||
"core/pikacontainer.h"
|
||||
"core/pikadatafactory.h");
|
||||
|
||||
@procs = qw(brushes_popup
|
||||
|
@ -145,9 +145,13 @@ sub display_get_window_handle {
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure returns a handle to the native window for a given image
|
||||
display. For example in the X backend of GDK, a native window handle is
|
||||
an Xlib XID. A value of 0 is returned for an invalid display or if this
|
||||
function is unimplemented for the windowing system that is being used.
|
||||
display.
|
||||
|
||||
It can be different types of data depending on the platform you are running on.
|
||||
For example in the X backend of GDK, a native window handle is an Xlib
|
||||
XID whereas on Wayland, it is a string handle. A value of NULL is
|
||||
returned for an invalid display or if this function is unimplemented for
|
||||
the windowing system that is being used.
|
||||
HELP
|
||||
|
||||
&neo_pdb_misc('2005', '2.4');
|
||||
@ -158,14 +162,14 @@ HELP
|
||||
);
|
||||
|
||||
@outargs = (
|
||||
{ name => 'window', type => 'int32',
|
||||
desc => 'The native window handle or 0' }
|
||||
{ name => 'handle', type => 'bytes',
|
||||
desc => 'The native window handle or NULL' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
window = (gint32) pika_get_display_window_id (pika, display);
|
||||
handle = pika_get_display_window_id (pika, display);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
|
@ -19,9 +19,61 @@
|
||||
# The invoke code is compiled on the app side.
|
||||
# The invoke code must assign to each result var
|
||||
|
||||
sub fonts_get_by_name {
|
||||
$blurb = "Returns the fonts with the given name.";
|
||||
$help = "Returns the fonts with the given name. There may be more than one.";
|
||||
|
||||
&jehan_pdb_misc('2023', '3.0');
|
||||
|
||||
@inargs = (
|
||||
{ name => 'name', type => 'string', non_empty => 1,
|
||||
desc => 'The name of the font' }
|
||||
);
|
||||
|
||||
@outargs = (
|
||||
{ name => 'fonts', type => 'fontarray', non_empty => 0,
|
||||
desc => 'The fonts with the given name',
|
||||
array => { name => 'num_fonts',
|
||||
desc => 'The number of fonts with the given name' } }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
GList *list;
|
||||
|
||||
list = pika_pdb_get_resources (pika, PIKA_TYPE_FONT, name, PIKA_PDB_DATA_ACCESS_READ, error);
|
||||
|
||||
if (list == NULL)
|
||||
success = FALSE;
|
||||
|
||||
num_fonts = g_list_length (list);
|
||||
|
||||
if (num_fonts > 0)
|
||||
{
|
||||
gint i = 0;
|
||||
|
||||
fonts = g_new (PikaFont *, num_fonts);
|
||||
|
||||
for (GList *iter = list; i < num_fonts; i++, iter = g_list_next (iter))
|
||||
fonts[i] = g_object_ref (iter->data);
|
||||
}
|
||||
g_list_free (list);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub font_get_by_name {
|
||||
$blurb = "Returns the font with the given name.";
|
||||
$help = "Returns the font with the given name.";
|
||||
$blurb = "Returns a font with the given name.";
|
||||
$help = <<HELP;
|
||||
If several fonts are named identically, the one which is returned by this
|
||||
function should be considered random. This can be used when you know you won't
|
||||
have multiple fonts of this name or that you don't want to choose
|
||||
(non-interactive scripts, etc.).
|
||||
|
||||
If you need more control, you should use pika_fonts_get_by_name() instead.
|
||||
HELP
|
||||
|
||||
&mitch_pdb_misc('2023', '3.0');
|
||||
|
||||
@ -50,7 +102,7 @@ CODE
|
||||
@headers = qw("core/pika.h"
|
||||
"pikapdb-utils.h");
|
||||
|
||||
@procs = qw(font_get_by_name);
|
||||
@procs = qw(font_get_by_name fonts_get_by_name);
|
||||
|
||||
%exports = (app => [@procs], lib => [@procs]);
|
||||
|
||||
|
@ -28,20 +28,24 @@ sub fonts_popup {
|
||||
desc => 'The callback PDB proc to call when user chooses a font' },
|
||||
{ name => 'popup_title', type => 'string',
|
||||
desc => 'Title of the font selection dialog' },
|
||||
{ name => 'initial_font_name', type => 'string', null_ok => 1,
|
||||
desc => 'The name of the initial font choice.' }
|
||||
{ name => 'initial_font', type => 'font', null_ok => 1,
|
||||
desc => 'The name of the initial font choice.' },
|
||||
{ name => 'parent_window', type => 'bytes', null_ok => 1,
|
||||
desc => 'An optional parent window handle for the popup to be set transient to' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
PikaContainer *container = pika_data_factory_get_container (pika->font_factory);
|
||||
|
||||
if (pika->no_interface ||
|
||||
! pika_pdb_lookup_procedure (pika->pdb, font_callback) ||
|
||||
! pika_data_factory_data_wait (pika->font_factory) ||
|
||||
! pika_pdb_dialog_new (pika, context, progress,
|
||||
pika_data_factory_get_container (pika->font_factory),
|
||||
popup_title, font_callback, initial_font_name,
|
||||
NULL))
|
||||
pika_container_get_children_type (container),
|
||||
parent_window, popup_title, font_callback,
|
||||
PIKA_OBJECT (initial_font), NULL))
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
@ -62,10 +66,12 @@ sub fonts_close_popup {
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
PikaContainer *container = pika_data_factory_get_container (pika->font_factory);
|
||||
|
||||
if (pika->no_interface ||
|
||||
! pika_pdb_lookup_procedure (pika->pdb, font_callback) ||
|
||||
! pika_pdb_dialog_close (pika,
|
||||
pika_data_factory_get_container (pika->font_factory),
|
||||
pika_container_get_children_type (container),
|
||||
font_callback))
|
||||
success = FALSE;
|
||||
}
|
||||
@ -82,20 +88,21 @@ sub fonts_set_popup {
|
||||
@inargs = (
|
||||
{ name => 'font_callback', type => 'string', non_empty => 1,
|
||||
desc => 'The name of the callback registered in the PDB for the dialog.' },
|
||||
{ name => 'font_name', type => 'string',
|
||||
desc => 'The name of the font to set as selected' }
|
||||
{ name => 'font', type => 'font',
|
||||
desc => 'The font to set as selected' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
PikaContainer *container = pika_data_factory_get_container (pika->font_factory);
|
||||
|
||||
if (pika->no_interface ||
|
||||
! pika_pdb_lookup_procedure (pika->pdb, font_callback) ||
|
||||
! pika_data_factory_data_wait (pika->font_factory) ||
|
||||
! pika_pdb_dialog_set (pika,
|
||||
pika_data_factory_get_container (pika->font_factory),
|
||||
font_callback, font_name,
|
||||
NULL))
|
||||
pika_container_get_children_type (container),
|
||||
font_callback, PIKA_OBJECT (font), NULL))
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
@ -104,6 +111,7 @@ CODE
|
||||
|
||||
|
||||
@headers = qw("core/pika.h"
|
||||
"core/pikacontainer.h"
|
||||
"core/pikadatafactory.h");
|
||||
|
||||
@procs = qw(fonts_popup
|
||||
|
@ -28,13 +28,17 @@ sub gradients_popup {
|
||||
desc => 'The callback PDB proc to call when user chooses a gradient' },
|
||||
{ name => 'popup_title', type => 'string',
|
||||
desc => 'Title of the gradient selection dialog' },
|
||||
{ name => 'initial_gradient_name', type => 'string', null_ok => 1,
|
||||
desc => 'The name of the initial gradient choice' }
|
||||
{ name => 'initial_gradient', type => 'gradient', null_ok => 1,
|
||||
desc => 'The initial gradient choice' },
|
||||
{ name => 'parent_window', type => 'bytes', null_ok => 1,
|
||||
desc => 'An optional parent window handle for the popup to be set transient to' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
PikaContainer *container = pika_data_factory_get_container (pika->gradient_factory);
|
||||
|
||||
/* Formerly, this procedure had another parameter:
|
||||
* the sample size of the gradient's data passed in the changed callback.
|
||||
* Now the sample size is determined by core, and in the future,
|
||||
@ -44,9 +48,9 @@ sub gradients_popup {
|
||||
if (pika->no_interface ||
|
||||
! pika_pdb_lookup_procedure (pika->pdb, gradient_callback) ||
|
||||
! pika_pdb_dialog_new (pika, context, progress,
|
||||
pika_data_factory_get_container (pika->gradient_factory),
|
||||
popup_title, gradient_callback, initial_gradient_name,
|
||||
NULL))
|
||||
pika_container_get_children_type (container),
|
||||
parent_window, popup_title, gradient_callback,
|
||||
PIKA_OBJECT (initial_gradient), NULL))
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
@ -67,9 +71,12 @@ sub gradients_close_popup {
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
PikaContainer *container = pika_data_factory_get_container (pika->gradient_factory);
|
||||
|
||||
if (pika->no_interface ||
|
||||
! pika_pdb_lookup_procedure (pika->pdb, gradient_callback) ||
|
||||
! pika_pdb_dialog_close (pika, pika_data_factory_get_container (pika->gradient_factory),
|
||||
! pika_pdb_dialog_close (pika,
|
||||
pika_container_get_children_type (container),
|
||||
gradient_callback))
|
||||
success = FALSE;
|
||||
}
|
||||
@ -86,18 +93,20 @@ sub gradients_set_popup {
|
||||
@inargs = (
|
||||
{ name => 'gradient_callback', type => 'string', non_empty => 1,
|
||||
desc => 'The name of the callback registered for this pop-up' },
|
||||
{ name => 'gradient_name', type => 'string',
|
||||
desc => 'The name of the gradient to set as selected' }
|
||||
{ name => 'gradient', type => 'gradient',
|
||||
desc => 'The gradient to set as selected' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
PikaContainer *container = pika_data_factory_get_container (pika->gradient_factory);
|
||||
|
||||
if (pika->no_interface ||
|
||||
! pika_pdb_lookup_procedure (pika->pdb, gradient_callback) ||
|
||||
! pika_pdb_dialog_set (pika, pika_data_factory_get_container (pika->gradient_factory),
|
||||
gradient_callback, gradient_name,
|
||||
NULL))
|
||||
! pika_pdb_dialog_set (pika,
|
||||
pika_container_get_children_type (container),
|
||||
gradient_callback, PIKA_OBJECT (gradient), NULL))
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
@ -106,6 +115,7 @@ CODE
|
||||
|
||||
|
||||
@headers = qw("core/pika.h"
|
||||
"core/pikacontainer.h"
|
||||
"core/pikadatafactory.h"
|
||||
"core/pikagradient.h");
|
||||
|
||||
|
@ -1563,6 +1563,36 @@ CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub image_get_palette {
|
||||
$blurb = "Returns the image's colormap";
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure returns the image's colormap as a PikaPalette.
|
||||
If the image is not in Indexed color mode, %NULL is returned.
|
||||
HELP
|
||||
|
||||
&jehan_pdb_misc('2023', '3.0');
|
||||
|
||||
@inargs = (
|
||||
{ name => 'image', type => 'image',
|
||||
desc => 'The image' }
|
||||
);
|
||||
|
||||
@outargs = (
|
||||
{ name => 'colormap', type => 'palette',
|
||||
desc => "The image's colormap." }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
headers => [ qw("core/pikaimage-colormap.h") ],
|
||||
code => <<'CODE'
|
||||
{
|
||||
colormap = pika_image_get_colormap_palette (image);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub image_get_metadata {
|
||||
$blurb = "Returns the image's metadata.";
|
||||
$help = 'Returns exif/iptc/xmp metadata from the image.';
|
||||
@ -3207,6 +3237,7 @@ CODE
|
||||
image_flatten image_merge_visible_layers image_merge_down
|
||||
image_merge_layer_group
|
||||
image_get_colormap image_set_colormap
|
||||
image_get_palette
|
||||
image_get_metadata image_set_metadata
|
||||
image_clean_all image_is_dirty
|
||||
image_thumbnail
|
||||
|
@ -251,9 +251,11 @@ sub palette_delete_entry {
|
||||
$blurb = 'Deletes an entry from the palette.';
|
||||
|
||||
$help = <<'HELP';
|
||||
Deletes an entry from the palette.
|
||||
Returns an error if the index is out or range.
|
||||
Returns an error if the palette is not editable.
|
||||
This function will fail and return %FALSE if the index is out or range or if the
|
||||
palette is not editable.
|
||||
|
||||
Additionally if the palette belongs to an indexed image, it will only be possible
|
||||
to delete palette colors not in use in the image.
|
||||
HELP
|
||||
|
||||
&mitch_pdb_misc('2004', '2.2');
|
||||
@ -272,9 +274,18 @@ HELP
|
||||
PikaPaletteEntry *entry = pika_palette_get_entry (palette, entry_num);
|
||||
|
||||
if (entry)
|
||||
pika_palette_delete_entry (palette, entry);
|
||||
{
|
||||
PikaImage *image = pika_data_get_image (PIKA_DATA (palette));
|
||||
|
||||
if (image != NULL)
|
||||
success = pika_image_delete_colormap_entry (image, entry_num, TRUE);
|
||||
else
|
||||
pika_palette_delete_entry (palette, entry);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
{
|
||||
success = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
@ -341,7 +352,7 @@ HELP
|
||||
code => <<'CODE'
|
||||
{
|
||||
if (pika_data_is_writable (PIKA_DATA (palette)))
|
||||
success = pika_palette_set_entry_color (palette, entry_num, &color);
|
||||
success = pika_palette_set_entry_color (palette, entry_num, &color, TRUE);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
@ -420,6 +431,7 @@ CODE
|
||||
"core/pika.h"
|
||||
"core/pikacontext.h"
|
||||
"core/pikadatafactory.h"
|
||||
"core/pikaimage-colormap.h"
|
||||
"core/pikapalette.h"
|
||||
"pikapdb-utils.h");
|
||||
|
||||
|
@ -27,19 +27,23 @@ sub palettes_popup {
|
||||
desc => 'The callback PDB proc to call when user chooses a palette' },
|
||||
{ name => 'popup_title', type => 'string',
|
||||
desc => 'Title of the palette selection dialog' },
|
||||
{ name => 'initial_palette_name', type => 'string', null_ok => 1,
|
||||
desc => 'The name of the palette to set as the initial choice.' }
|
||||
{ name => 'initial_palette', type => 'palette', null_ok => 1,
|
||||
desc => 'The palette to set as the initial choice.' },
|
||||
{ name => 'parent_window', type => 'bytes', null_ok => 1,
|
||||
desc => 'An optional parent window handle for the popup to be set transient to' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
PikaContainer *container = pika_data_factory_get_container (pika->palette_factory);
|
||||
|
||||
if (pika->no_interface ||
|
||||
! pika_pdb_lookup_procedure (pika->pdb, palette_callback) ||
|
||||
! pika_pdb_dialog_new (pika, context, progress,
|
||||
pika_data_factory_get_container (pika->palette_factory),
|
||||
popup_title, palette_callback, initial_palette_name,
|
||||
NULL))
|
||||
pika_container_get_children_type (container),
|
||||
parent_window, popup_title, palette_callback,
|
||||
PIKA_OBJECT (initial_palette), NULL))
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
@ -60,9 +64,12 @@ sub palettes_close_popup {
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
PikaContainer *container = pika_data_factory_get_container (pika->palette_factory);
|
||||
|
||||
if (pika->no_interface ||
|
||||
! pika_pdb_lookup_procedure (pika->pdb, palette_callback) ||
|
||||
! pika_pdb_dialog_close (pika, pika_data_factory_get_container (pika->palette_factory),
|
||||
! pika_pdb_dialog_close (pika,
|
||||
pika_container_get_children_type (container),
|
||||
palette_callback))
|
||||
success = FALSE;
|
||||
}
|
||||
@ -79,18 +86,20 @@ sub palettes_set_popup {
|
||||
@inargs = (
|
||||
{ name => 'palette_callback', type => 'string', non_empty => 1,
|
||||
desc => 'The name of the callback registered for this pop-up' },
|
||||
{ name => 'palette_name', type => 'string',
|
||||
desc => 'The name of the palette to set as selected' },
|
||||
{ name => 'palette', type => 'palette',
|
||||
desc => 'The palette to set as selected' },
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
PikaContainer *container = pika_data_factory_get_container (pika->palette_factory);
|
||||
|
||||
if (pika->no_interface ||
|
||||
! pika_pdb_lookup_procedure (pika->pdb, palette_callback) ||
|
||||
! pika_pdb_dialog_set (pika, pika_data_factory_get_container (pika->palette_factory),
|
||||
palette_callback, palette_name,
|
||||
NULL))
|
||||
! pika_pdb_dialog_set (pika,
|
||||
pika_container_get_children_type (container),
|
||||
palette_callback, PIKA_OBJECT (palette), NULL))
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
@ -99,6 +108,7 @@ CODE
|
||||
|
||||
|
||||
@headers = qw("core/pika.h"
|
||||
"core/pikacontainer.h"
|
||||
"core/pikadatafactory.h");
|
||||
|
||||
@procs = qw(palettes_popup
|
||||
|
@ -99,10 +99,10 @@ BLURB
|
||||
$help = <<'HELP';
|
||||
Gets information about the pattern:
|
||||
the pattern extents (width and height), its bpp, and its pixel data.
|
||||
The pixel data is an array in C or a list in some languages.
|
||||
HELP
|
||||
|
||||
&mitch_pdb_misc('2004', '2.2');
|
||||
$lib_private = 1;
|
||||
|
||||
@inargs = (
|
||||
${pattern_arg_spec}
|
||||
|
@ -27,19 +27,23 @@ sub patterns_popup {
|
||||
desc => 'The callback PDB proc to call when the user chooses a pattern' },
|
||||
{ name => 'popup_title', type => 'string',
|
||||
desc => 'Title of the pattern selection dialog' },
|
||||
{ name => 'initial_pattern_name', type => 'string', null_ok => 1,
|
||||
desc => 'The name of the pattern to set as the initial choice' }
|
||||
{ name => 'initial_pattern', type => 'pattern', null_ok => 1,
|
||||
desc => 'The pattern to set as the initial choice' },
|
||||
{ name => 'parent_window', type => 'bytes', null_ok => 1,
|
||||
desc => 'An optional parent window handle for the popup to be set transient to' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
PikaContainer *container = pika_data_factory_get_container (pika->pattern_factory);
|
||||
|
||||
if (pika->no_interface ||
|
||||
! pika_pdb_lookup_procedure (pika->pdb, pattern_callback) ||
|
||||
! pika_pdb_dialog_new (pika, context, progress,
|
||||
pika_data_factory_get_container (pika->pattern_factory),
|
||||
popup_title, pattern_callback, initial_pattern_name,
|
||||
NULL))
|
||||
pika_container_get_children_type (container),
|
||||
parent_window, popup_title, pattern_callback,
|
||||
PIKA_OBJECT (initial_pattern), NULL))
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
@ -60,9 +64,12 @@ sub patterns_close_popup {
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
PikaContainer *container = pika_data_factory_get_container (pika->pattern_factory);
|
||||
|
||||
if (pika->no_interface ||
|
||||
! pika_pdb_lookup_procedure (pika->pdb, pattern_callback) ||
|
||||
! pika_pdb_dialog_close (pika, pika_data_factory_get_container (pika->pattern_factory),
|
||||
! pika_pdb_dialog_close (pika,
|
||||
pika_container_get_children_type (container),
|
||||
pattern_callback))
|
||||
success = FALSE;
|
||||
}
|
||||
@ -79,18 +86,20 @@ sub patterns_set_popup {
|
||||
@inargs = (
|
||||
{ name => 'pattern_callback', type => 'string', non_empty => 1,
|
||||
desc => 'The name of the callback registered for this pop-up' },
|
||||
{ name => 'pattern_name', type => 'string',
|
||||
desc => 'The name of the pattern to set as selected' }
|
||||
{ name => 'pattern', type => 'pattern',
|
||||
desc => 'The pattern to set as selected' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
PikaContainer *container = pika_data_factory_get_container (pika->pattern_factory);
|
||||
|
||||
if (pika->no_interface ||
|
||||
! pika_pdb_lookup_procedure (pika->pdb, pattern_callback) ||
|
||||
! pika_pdb_dialog_set (pika, pika_data_factory_get_container (pika->pattern_factory),
|
||||
pattern_callback, pattern_name,
|
||||
NULL))
|
||||
! pika_pdb_dialog_set (pika,
|
||||
pika_container_get_children_type (container),
|
||||
pattern_callback, PIKA_OBJECT (pattern), NULL))
|
||||
success = FALSE;
|
||||
}
|
||||
CODE
|
||||
@ -99,6 +108,7 @@ CODE
|
||||
|
||||
|
||||
@headers = qw("core/pika.h"
|
||||
"core/pikacontainer.h"
|
||||
"core/pikadatafactory.h");
|
||||
|
||||
@procs = qw(patterns_popup
|
||||
|
@ -1246,50 +1246,6 @@ CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub pdb_get_data_size {
|
||||
$blurb = 'Returns size of data associated with the specified identifier.';
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure returns the size of any data which may have been associated with
|
||||
the specified identifier. If no data has been associated with the identifier,
|
||||
an error is returned.
|
||||
HELP
|
||||
|
||||
&nick_pdb_misc('1998');
|
||||
|
||||
$lib_private = 1;
|
||||
|
||||
@inargs = (
|
||||
{ name => 'identifier', type => 'string', non_empty => 1,
|
||||
desc => 'The identifier associated with data' }
|
||||
);
|
||||
|
||||
@outargs = (
|
||||
{ name => 'bytes', type => '1 <= int32',
|
||||
desc => 'The number of bytes in the data' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
if (pika_is_canonical_identifier (identifier))
|
||||
{
|
||||
if (! pika_plug_in_manager_get_data (pika->plug_in_manager,
|
||||
identifier, &bytes))
|
||||
success = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
g_set_error (error, PIKA_PDB_ERROR, PIKA_PDB_ERROR_INVALID_ARGUMENT,
|
||||
_("Data label '%s' is not a canonical identifier"),
|
||||
identifier);
|
||||
success = FALSE;
|
||||
}
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub pdb_set_data {
|
||||
$blurb = 'Associates the specified identifier with the supplied data.';
|
||||
|
||||
@ -1398,7 +1354,6 @@ CODE
|
||||
pdb_set_file_proc_thumbnail_loader
|
||||
pdb_set_batch_interpreter
|
||||
pdb_get_data
|
||||
pdb_get_data_size
|
||||
pdb_set_data);
|
||||
|
||||
%exports = (app => [@procs], lib => [@procs]);
|
||||
|
@ -180,17 +180,20 @@ CODE
|
||||
}
|
||||
|
||||
sub progress_get_window_handle {
|
||||
$blurb = 'Returns the native window ID of the toplevel window this plug-in\'s progress is displayed in.';
|
||||
$blurb = 'Returns the native handle of the toplevel window this plug-in\'s progress is displayed in.';
|
||||
|
||||
$help = <<'HELP';
|
||||
This function returns the native window ID of the toplevel window this plug-in\'s progress is displayed in.
|
||||
This function returns the native handle allowing to identify the toplevel window this plug-in's progress is displayed in.
|
||||
|
||||
This handle can be of various types (integer, string, etc.) depending on the platform you are running on which is why it
|
||||
returns a GBytes. There are usually no reasons to call this directly.
|
||||
HELP
|
||||
|
||||
&mitch_pdb_misc('2004', '2.2');
|
||||
|
||||
@outargs = (
|
||||
{ name => 'window', type => 'int32',
|
||||
desc => 'The progress bar\'s toplevel window' }
|
||||
{ name => 'handle', type => 'bytes',
|
||||
desc => 'The progress bar\'s toplevel window\'s handle' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
@ -201,7 +204,7 @@ HELP
|
||||
if (plug_in && plug_in->open)
|
||||
{
|
||||
if (! pika->no_interface)
|
||||
window = pika_plug_in_progress_get_window_id (plug_in);
|
||||
handle = pika_plug_in_progress_get_window_id (plug_in);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -38,8 +38,8 @@ HELP
|
||||
desc => 'The image' },
|
||||
{ name => 'text', type => 'string',
|
||||
desc => 'The text to generate (in UTF-8 encoding)' },
|
||||
{ name => 'fontname', type => 'string',
|
||||
desc => 'The name of the font' },
|
||||
{ name => 'font', type => 'font',
|
||||
desc => 'The font to write the text with' },
|
||||
{ name => 'size', type => '0.0 <= float <= 8192.0',
|
||||
desc => 'The size of text in either pixels or points' },
|
||||
{ name => 'unit', type => 'unit',
|
||||
@ -61,7 +61,7 @@ HELP
|
||||
|
||||
pika_text = g_object_new (PIKA_TYPE_TEXT,
|
||||
"text", text,
|
||||
"font", fontname,
|
||||
"font", font,
|
||||
"font-size", size,
|
||||
"font-size-unit", unit,
|
||||
"color", &color,
|
||||
@ -231,7 +231,7 @@ sub text_layer_get_font {
|
||||
$blurb = 'Get the font from a text layer as string.';
|
||||
|
||||
$help = <<'HELP';
|
||||
This procedure returns the name of the font from a text layer.
|
||||
This procedure returns the font from a text layer.
|
||||
HELP
|
||||
|
||||
&marcus_pdb_misc('2008', '2.6');
|
||||
@ -242,20 +242,20 @@ HELP
|
||||
);
|
||||
|
||||
@outargs = (
|
||||
{ name => 'font', type => 'string',
|
||||
{ name => 'font', type => 'font',
|
||||
desc => 'The font which is used in the specified text layer.' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
PikaFont *font_obj;
|
||||
|
||||
g_object_get (pika_text_layer_get_text (layer),
|
||||
"font", &font_obj,
|
||||
"font", &font,
|
||||
NULL);
|
||||
font = g_strdup (pika_font_get_lookup_name (font_obj));
|
||||
g_object_unref (font_obj);
|
||||
/* The PikaText keeps a reference. Therefore unref before returning the
|
||||
* pointer so that we don't leak a reference.
|
||||
*/
|
||||
g_object_unref (font);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
@ -273,7 +273,7 @@ HELP
|
||||
@inargs = (
|
||||
{ name => 'layer', type => 'text_layer',
|
||||
desc => 'The text layer' },
|
||||
{ name => 'font', type => 'string',
|
||||
{ name => 'font', type => 'font',
|
||||
desc => 'The new font to use' }
|
||||
);
|
||||
|
||||
|
@ -16,24 +16,21 @@
|
||||
|
||||
# "Perlized" from C source by Manish Singh <yosh@gimp.org>
|
||||
|
||||
sub text_fontname {
|
||||
sub text_font {
|
||||
$blurb = <<'BLURB';
|
||||
Add text at the specified location as a floating selection or a new layer.
|
||||
BLURB
|
||||
|
||||
$help = <<'HELP';
|
||||
This tool requires a fontname matching an installed PangoFT2 font.
|
||||
You can specify the fontsize in units of pixels
|
||||
or points, and the appropriate metric is specified using the size_type
|
||||
argument. The x and y parameters together control the placement of the new
|
||||
text by specifying the upper left corner of the text bounding box. If the
|
||||
specified drawable parameter is valid, the text will be created as a floating
|
||||
selection attached to the drawable. If the drawable parameter is not valid
|
||||
(%NULL), the text will appear as a new layer. Finally, a border can be specified
|
||||
around the final rendered text. The border is measured in pixels. Parameter
|
||||
size-type is not used and is currently ignored. If you need to display a font
|
||||
in points, divide the size in points by 72.0 and multiply it by the image's
|
||||
vertical resolution.
|
||||
The x and y parameters together control the placement of the new text by
|
||||
specifying the upper left corner of the text bounding box. If the specified
|
||||
drawable parameter is valid, the text will be created as a floating selection
|
||||
attached to the drawable. If the drawable parameter is not valid (%NULL), the
|
||||
text will appear as a new layer. Finally, a border can be specified around the
|
||||
final rendered text. The border is measured in pixels.
|
||||
|
||||
The size is always in pixels. If you need to display a font in points, divide
|
||||
the size in points by 72.0 and multiply it by the image's vertical resolution.
|
||||
HELP
|
||||
|
||||
&std_pdb_misc;
|
||||
@ -57,11 +54,9 @@ HELP
|
||||
{ name => 'antialias', type => 'boolean',
|
||||
desc => 'Antialiasing' },
|
||||
{ name => 'size', type => '0 < float',
|
||||
desc => 'The size of text in either pixels or points' },
|
||||
{ name => 'size_type', type => 'enum PikaSizeType', dead => 1,
|
||||
desc => 'The units of specified size' },
|
||||
{ name => 'fontname', type => 'string',
|
||||
desc => 'The name of the font' }
|
||||
desc => 'The size of text in pixels' },
|
||||
{ name => 'font', type => 'font',
|
||||
desc => 'The font' }
|
||||
);
|
||||
|
||||
@outargs = (
|
||||
@ -79,30 +74,30 @@ HELP
|
||||
success = FALSE;
|
||||
|
||||
if (success)
|
||||
{
|
||||
gchar *real_fontname = g_strdup_printf ("%s %d", fontname, (gint) size);
|
||||
|
||||
text_layer = text_render (image, drawable, context,
|
||||
x, y, real_fontname, text,
|
||||
border, antialias);
|
||||
|
||||
g_free (real_fontname);
|
||||
}
|
||||
text_layer = text_render (image, drawable, context,
|
||||
x, y, font, size, text,
|
||||
border, antialias);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
}
|
||||
|
||||
sub text_get_extents_fontname {
|
||||
sub text_get_extents_font {
|
||||
$blurb = 'Get extents of the bounding box for the specified text.';
|
||||
|
||||
$help = <<'HELP';
|
||||
This tool returns the width and height of a bounding box for the specified text
|
||||
string with the specified font information. Ascent and descent for the
|
||||
specified font are returned as well. Parameter size-type is not used and is
|
||||
currently ignored. If you need to display a font in points, divide the
|
||||
size in points by 72.0 and multiply it by the vertical resolution of the
|
||||
image you are taking into account.
|
||||
rendered with the specified font information. Ascent and descent of the glyph
|
||||
extents are returned as well.
|
||||
|
||||
The ascent is the distance from the baseline to the highest point of the
|
||||
character. This is positive if the glyph ascends above the baseline.
|
||||
The descent is the distance from the baseline to the lowest point of the
|
||||
character. This is positive if the glyph descends below the baseline.
|
||||
|
||||
The size is always in pixels. If you need to set a font in points, divide the
|
||||
size in points by 72.0 and multiply it by the vertical resolution of the image
|
||||
you are taking into account.
|
||||
HELP
|
||||
|
||||
&std_pdb_misc;
|
||||
@ -114,34 +109,28 @@ HELP
|
||||
desc => 'The text to generate (in UTF-8 encoding)' },
|
||||
{ name => 'size', type => '0 < float',
|
||||
desc => 'The size of text in either pixels or points' },
|
||||
{ name => 'size_type', type => 'enum PikaSizeType', dead => 1,
|
||||
desc => 'The units of specified size' },
|
||||
{ name => 'fontname', type => 'string',
|
||||
{ name => 'font', type => 'font',
|
||||
desc => 'The name of the font' }
|
||||
);
|
||||
|
||||
@outargs = (
|
||||
{ name => 'width', type => 'int32', void_ret => 1,
|
||||
desc => 'The width of the specified font' },
|
||||
desc => 'The width of the glyph extents' },
|
||||
{ name => 'height', type => 'int32',
|
||||
desc => 'The height of the specified font' },
|
||||
desc => 'The height of the glyph extents' },
|
||||
{ name => 'ascent', type => 'int32',
|
||||
desc => 'The ascent of the specified font' },
|
||||
desc => 'The ascent of the glyph extents' },
|
||||
{ name => 'descent', type => 'int32',
|
||||
desc => 'The descent of the specified font' }
|
||||
desc => 'The descent of the glyph extents' }
|
||||
);
|
||||
|
||||
%invoke = (
|
||||
code => <<'CODE'
|
||||
{
|
||||
gchar *real_fontname = g_strdup_printf ("%s %d", fontname, (gint) size);
|
||||
|
||||
success = text_get_extents (pika,
|
||||
real_fontname, text,
|
||||
font, size, text,
|
||||
&width, &height,
|
||||
&ascent, &descent);
|
||||
|
||||
g_free (real_fontname);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
@ -152,8 +141,8 @@ CODE
|
||||
"text/pikatext-compat.h"
|
||||
"pikapdb-utils.h");
|
||||
|
||||
@procs = qw(text_fontname
|
||||
text_get_extents_fontname);
|
||||
@procs = qw(text_font
|
||||
text_get_extents_font);
|
||||
|
||||
%exports = (app => [@procs], lib => [@procs]);
|
||||
|
||||
|
Reference in New Issue
Block a user