Commit Graph

9709 Commits

Author SHA1 Message Date
Jehan 69edf13e2c plug-ins: fix the GimpSaveProcedure plug-ins in Python.
As usual, these got forgotten!

Also colorxhtml is actually deeply broken by commit 89c359ce47 which removed
gimp_drawable_get_pixel() (Niels thought it was not used, whereas it was simply
harder to spot with bindings!).
This will have to be fixed eventually.
2023-10-01 20:52:02 +02:00
Jehan fcc810d7d3 libgimp, plug-ins: rename to gimp_save_procedure_new().
Also the mimetype is already set by gimp_file_procedure_set_mime_types() so
transform the mimetype argument into an export_metadata argument.
2023-10-01 20:52:02 +02:00
Jehan 06bd1f1289 plug-ins: port file-gih to GimpSaveProcedureDialog.
I was hoping to redesign further but the whole logic of animated brush creation
is made so complicated that I think it would require a whole more complex GUI
with visual hints. So anyway I stopped at basic redesign and port to the new
dialog generation code.
It still makes the code much simpler and a bit more powerful (also less bugs
hopefully). I have also reviewed the procedure arguments, removing redundant
ones (display-cols and display-rows are just computed from cell-width and
cell-height) and adding some aux arguments instead to simplify dynamic GUI code.
2023-10-01 20:52:02 +02:00
Jehan 689e3da5b9 plug-ins: port the last GimpSaveProcedure to gimp_save_procedure_new2().
It's the basic stupid port, though this dialog is so bad that I think I'm going
for a second stage with a basic redesign of this GUI while also moving to
GimpSaveProcedureDialog. To be continued.
2023-10-01 20:52:02 +02:00
Jehan 9ed8f00e5b plug-ins: port most plug-ins to gimp_save_procedure_new2(). 2023-10-01 20:52:02 +02:00
Jehan 44e2bab9ad plug-ins: remove "num-images" argument and improve error feedback.
The arg "num-images" is clearly redundant as the "images" array already has this
information. Moreover it is bug-prone, for instance running 'Repeat "Filmstrip"'
would crash the plug-in which was defaulting to NULL "images" and 1 "num-images"
(without any GimpItem serialization ability yet).
Of course, we could just fix this, but better remove the redundant arg and all
possibilities of future similar bugs.

Also I now display a proper error message when running without input images
which says: "\"Filmstrip\" cannot be run without any input images"
2023-10-01 20:52:01 +02:00
Jehan df6ccf390f plug-ins: fix possibly unreffing a NULL pointer. 2023-10-01 20:52:01 +02:00
Jehan 14bcaa717b plug-ins: a bunch of more plug-ins ported to gimp_save_procedure_new2(). 2023-10-01 20:52:01 +02:00
Jehan b23519a401 plug-ins: port to gimp_save_procedure_new2() all export procedures…
… which were using gimp_procedure_config_begin_export().
2023-10-01 20:52:01 +02:00
Alx Sa e79de5db86 plug-ins: port small-tile to gimp_image_procedure_new2()
The dialog itself is ported to GimpProcedureDialog, but the original 
plug-in only had one config parameter (Number of Tiles).
Some of the other options might make sense as config parameters 
such as the horizontal/vertical toggles and opacity.
2023-10-01 20:52:01 +02:00
Jehan 3c1ecd53ff plug-ins: port film to GimpProcedureDialog.
I needed a few more GimpProcedureDialog widgets, which I now have. The only part
still not generated in this plug-in is the image selection. This is hundreds of
lines less!

It now has arguments for every usable setting (except "keep-height" which is an
aux arg because it is simulated with a 0 "film-height" in non-interactive mode).

Also the film-height/keep-height default in interactive mode is now much better.
I override the film-height default and set it to be the image's height. This
makes for a much better default at all time.

The "Reset" button in Advanced section is not useful anymore since we now have
the generic "Reset" (to Initial/Factory) of GimpProcedureDialog, though it
actually doesn't work right for the time being, as it fails serializing
GimpFont.
2023-10-01 20:52:01 +02:00
Jehan 5cc1c898d7 libgimp, plug-ins: enhance gimp_procedure_dialog_get_label() with markup and…
… mnemonic abilities.
2023-10-01 20:52:01 +02:00
Jehan 99d4c504d0 plug-ins: port film to gimp_image_procedure_new2().
The dialog is not ported to GimpProcedureDialog yet. It will be worth doing it
as a second step.
2023-10-01 20:52:01 +02:00
Jehan f5183cbd7b plug-ins: port warp to gimp_image_procedure_new2().
It would be worth porting when GimpDrawableComboBox widgets can be used as
GimpProcedureDialog generated widgets. Or even better, if the GimpPickableButton
were ported to libgimp to be used by plug-ins (since it's actually a lot more
usable).
2023-10-01 20:52:01 +02:00
Jehan 2f91e45b4f plug-ins: port easy plug-ins to gimp_image_procedure_new2().
These were the plug-ins already using gimp_procedure_config_*() API.
2023-10-01 20:52:01 +02:00
Jehan 2a21d45ada plug-ins: port grid to gimp_image_procedure_new2().
I didn't port to GimpProcedureDialog because we'd need first a GimpSizeEntry
generatable widget, which can map to several properties (here for instance 3
width properties).
2023-10-01 20:52:01 +02:00
Jehan 3c658789a6 plug-ins: now port to gimp_image_procedure_new2() all plug-ins without args. 2023-10-01 20:52:01 +02:00
Jehan 4f14f620c4 plug-ins: port to gimp_image_procedure_new2() all plug-ins which were already…
… working with a GimpProcedureConfig.

These are the easiest ones to port as most of the work was already done (mostly
just some now useless calls to remove).
2023-10-01 20:52:01 +02:00
Jehan 96b3302e65 plug-ins: port gradient-flare to gimp_image_procedure_new2() and GimpProcedureDialog.
The port to GimpProcedureDialog is partial as there are still quite a few pieces
which can be improved. But it's a good start.
2023-10-01 20:52:01 +02:00
Jehan 7da0db9e88 plug-ins: port tile to gimp_image_procedure_new2() and GimpProcedureDialog. 2023-10-01 20:52:01 +02:00
Jehan 3806b46fc5 plug-ins: forgotten Python plug-ins had to be ported to new Gimp.Procedure.new().
There was also one case of port to updated GimpResource API to get the name of a
palette.
2023-10-01 20:52:01 +02:00
Jehan 2b38a2df86 libgimp, plug-ins: rename gimp_procedure_new2() as gimp_procedure_new() and…
… remove the latter.

Now all GimpProcedure use this new implementation with use a config object.
2023-10-01 20:52:01 +02:00
Jehan a2acf24ecb libgimp, plug-ins: Script-fu scripts now use gimp_procedure_new2() too.
Also in gimp_procedure_config_begin_run(), make sure we sync the arguments with
the config object first thing, even in interactive and with-last-vals case
(where the args may be further overridden). This was especially important for
Script-fu scripts as the image and drawable were not provided separately, so we
need to make sure that the config file has the right values.
2023-10-01 20:52:01 +02:00
Jehan 5d3112a2f1 plug-ins, libgimp: move GimpBatchProcedure's run function to use config objects.
Also port more script-fu procedures to gimp_procedure_new2(), which were sharing
some code with the script-fu batch procedure.
2023-10-01 20:52:01 +02:00
Jehan af00b66914 plug-ins: port the easy script-fu procedures to gimp_procedure_new2(). 2023-10-01 20:52:01 +02:00
Jehan 38ecbfc762 plug-ins: more plug-ins ported to gimp_procedure_new2(). 2023-10-01 20:52:01 +02:00
Jehan 9b2240f51e plug-ins: port web-page to GimpProcedureDialog and gimp_procedure_new2().
Again a lot less lines for more functionalities (e.g. now it should work fine in
WITH_LAST_VALS mode).
2023-10-01 20:52:01 +02:00
Jehan e92ef9d45a plug-ins: port several of the easy plug-ins to gimp_procedure_new2(). 2023-10-01 20:52:01 +02:00
Jehan f6da799c11 plug-ins: port screenshot to GimpProcedureDialog and gimp_procedure_new2().
A lot less lines for the same functionalities!
This includes improvements too:

* "include-pointer" as new PDB argument;
* settings storage thanks to GimpProcedureDialog;
* it should hopefully work better in non-interactive (though it's untested).

The macOS and Windows screenshots are untested after this change, though they
should still work the same. Please report if there is any problem!
2023-10-01 20:52:01 +02:00
Alx Sa 6ad54ca3a3 plug-ins: Fix DDS vulnerability (ZDI-CAN-22093)
Resolves #10069

Currently, the DDS header information for the width, height, and bytes per scan line
are read in and assumed to be correct. As these values are used for memory allocation
and reading, it would be good to verify they do not exceed the file size.

This patch adds a condition after the header is read in to verify those values. If they exceed
the file size (mins an offset), the file is not read in and an error message is shown.
2023-10-01 17:06:25 +00:00
Alx Sa 865cc56894 plug-ins: Fix vulnerability in file-psd
Resolves #10101.
This patch adds a missing break statement after an error condition
is detected to prevent the code from continuing afterwards.
2023-09-29 20:38:51 +00:00
bootchk 89901c8466 Fix for 2.99 only #6157
Also refactoring: extract two functions

Add test case scripts/test/register-fail

Catches more registration errors.
Any errors not caught at least will not crash.

Remains to be ported to 2.10, but only a few lines,  without the refactoring.
2023-09-28 13:26:23 +00:00
Jehan 3dcc4196fb plug-ins: plugin-defs.pl also is a remnant from autotools! 2023-09-27 15:57:58 +02:00
Jehan d88f6f9733 app, devel-socs, icons, plug-ins, tools: remove various autotools artifacts.
* generate-icon-makefiles.py was a tool to generate the icon-list.mk files.
* mkgen.pl was used to generate plug-ins/common/Makefile.am
2023-09-27 15:39:39 +02:00
Mark 2e9823f8ea coffee fix 2023-09-26 10:32:55 +00:00
Alx Sa cb352ab5b2 plug-ins: Add Esm Software PIX format import support 2023-09-23 21:26:47 +00:00
Alx Sa 96f536a335 plug-ins: Fix PSP vulnerability (ZDI-CAN-22096)
Resolves #10072.

The current PSP palette loading code does not check if
the file's palette entry count value is below the limit
(G_MAXUNIT32 / 4 due to each color being 4 bytes long).
This patch adds this check and stops loading if the count
is larger than GIMP currently supports.
2023-09-23 15:46:13 -04:00
Alx Sa e1bfd87195 plug-ins: Fix PSP vulnerability (ZDI-CAN-22097)
Resolves #10071.

When reading RLE compressed data, a buffer was allocated to 127 bytes.
However, it can potentially be used to read 128 bytes, leading to a
off-by-one vulnerability. This patch allocates 128 bytes to the buffer
to prevent this from occurring.
2023-09-23 02:16:24 +00:00
Jehan 231ca0c505 Issue #9994: do not call g_file_info_get_is_hidden() (and others) directly.
This is not the main reason for the specific output in #9994. These ones are
more probably because of similar usage in GTK (which updated its own calls to
g_file_info_get_is_hidden|backup() in version 3.24.38). But we should likely
also update the various calls we have to use the generic
g_file_info_get_attribute_*() variants.

To be fair, it is unclear to me when we can be sure that an attribute is set.
For instance, when we call g_file_enumerate_children() or g_file_query_info()
with specific attributes, docs say that it is still possible for these
attributes to not be set. So I assume it means we should never use direct
accessor functions.

The only exception is that I didn't remove usage of g_file_info_get_name(),
since its docs says:

> * Gets a display name for a file. This is guaranteed to always be set.

Even though it also says just after:

> * It is an error to call this if the #GFileInfo does not contain
> * %G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME.

Which is very contradictory. But assuming that this error warning was
over-zealous documentation, I kept the direct accessors since they are supposed
to be slightly more optimized (still according to in-code documentation) so
let's priorize them when we know they are set for sure.
2023-09-19 15:34:48 +02:00
bootchk bfaebccf4e ScriptFu: change binding of resource from string to int
Fix #9991

And change test cases

And fix string-prefix? function in testing framework
2023-09-15 11:02:46 +00:00
bootchk fe0fe3e0bb ScriptFu: extract function marshall_pdb_return
This commit and the ones prior are simple refactoring,
with no intended functional changes.

In anticipation of enhancements 9608 and 8404
which make returned values more scheme like.

Also makes code more readable.
2023-09-12 15:02:15 +00:00
bootchk d3706a62e3 ScriptFu: add function marshal_PDB_return_by_arity 2023-09-12 15:02:15 +00:00
bootchk 1a8bdf1acc ScriptFu: extract function marshal_pdb_return_values (plural) 2023-09-12 15:02:15 +00:00
bootchk 3e0f37d00a ScriptFu: Extract function marshal_returned_PDB_value 2023-09-12 15:02:15 +00:00
bootchk 61c1acbead tinyscheme: enhance: rearrange error msg so error kind is stable prefix
Error kind should be first to read, is most important.

Makes testing error message easier when prefix is stable.
2023-09-06 06:37:29 -04:00
bootchk 14c30f6514 ScriptFu tests: Add some tests and remove hardcoded ID's
Buffer, palette, parasite, unit, context

Also test only a prefix of error message.
2023-09-06 09:53:31 +00:00
Alx Sa 531da1560d Issue #30: Add onClick, accesskey, and tabindex tags to Image Map plug-in 2023-09-02 03:30:35 +00:00
bootchk ddbb34f357 Fix #9660 ScriptFu flaws for atoms of type character, UTF-8 encoded
For characters outside ASCII:

1. repr is wrong in REPL

2. sharp constant #\<codepoint> fails to evaluate

3. sharp constant hex #\x<hexdigits> accepts invalid UTF-8 codepoints

4. a call to error with such a character eats the output string

Also, changed the repr of ASCII control characters (was #\x7)
to their unicode repr (now a box glyph with hex)
2023-08-26 18:46:56 +00:00
bootchk 2f360ddb34 ScriptFu: #9755 Add test framework and tests for TS and PDB
Test framework and tests in Scheme, and portable.

Work in progress.  Expect commits for more tests.

Testing framework is stable, more or less.

Add more tests

Add tests layer and layerMask.

test Item methods

More tests, selection

Test memory, vector in TS.

More tests char functions

sharp expr tests
2023-08-25 21:39:29 +00:00
Sabri Ünal 05b808b095 plug-ins: Mark RAW export dialog related strings translatable
These strings are related to RAW export dialog which
some strings seem not marked as translatable.
2023-08-25 19:41:42 +00:00
Sabri Ünal 5725a3593e plug-ins: Mark PDF/PostScript export dialogs related strings translatable
These strings are related to PDF/PostScript export dialogs which
some strings seem not marked as translatable.
2023-08-25 19:41:42 +00:00
Sabri Ünal d4146aba5c plug-ins: Mark TIFF export dialog related strings translatable
These strings are related to TIFF export dialog which
some strings seem not marked as translatable.
2023-08-25 19:41:42 +00:00
Sabri Ünal b7ab467cde plug-ins: Mark JPEG export dialog related strings translatable
These strings are related to JPEG export dialog which
some strings seem not marked as translatable.
2023-08-25 19:41:42 +00:00
Alx Sa 0778b95847 plug-ins: Add support to load PSP ICC Profile data 2023-08-25 02:29:51 +00:00
Alx Sa 7a971ede15 scripts: Add Table of Contents to User Manual submenu
Resolves #1040.
Adds a [Table of Contents] link that directs users to
ID "gimp-main", the table of contents page.
2023-08-21 02:10:45 +00:00
bootchk 161644fdbc Delete obsolete scripts from 2.99
Moved to gimp-data-extras repo

    erase-rows fix #9885
    grid-system fix #8464
    select-to-brush fix #9878
    select-to-image
    select-to-pattern

Just deleted:

    script-fu-copy-visible fix #9868
2023-08-20 20:44:04 +00:00
bootchk 109f43750c Fix #9874 SF plugin script-fu-set-cmap.scm
New API for GByte to gimp-image-set-colormap
2023-08-20 20:44:04 +00:00
bootchk 7f3595285d Fix #9873 fix SF plugin ripply-anim.scm
Fix new multilayer API in call to to plug-in-tile
2023-08-20 20:44:04 +00:00
bootchk d934d6d497 Fix #9866 burn-in-anim.scm SF plugin
Fix API change to gimp-image-set-file.
2023-08-20 20:44:04 +00:00
bootchk 8c3d3a5247 Enhance #9532 elide "Script-Fu" from SF plugin dialog title 2023-08-20 20:44:04 +00:00
Alx Sa 0cfdd0a5df plug-ins: Fix crash in Map Palette
Per https://gitlab.gnome.org/GNOME/gimp/-/issues/9875#note_1817995,
the returned value of gimp_context_get_palette () shouldn't be freed in the
calling function.
2023-08-17 11:23:10 +00:00
Jacob Boerema 40b2412fa4 plug-ins: add synchronization with certain Exif tags.
Exif tags Exif.Image.Artist, Exif.Image.ImageDescription, and
Exif.Image.Copyright were not being synchronized with their Xmp and
Iptc.IIM equivalents in the metadata-editor.

This commit adds synchronization of reading and writing of the metadata.

We adjust the struct for equivalent_metadata_tags by removing unused
fields and adding a field that points to the equivalent Exif tag in
a new struct called exif_tag_info.

On loading of the metadata tags we now also check a limited set of
Exif tags. If no value was set yet, we use the Exif value, or else
we check to make sure both had the same value. If not, print a
warning in the terminal.

On saving of metadata, we now also save to the marked Exif tags, or
if the value is NULL, we remove the tag.

In passing, we also fix two memory leaks by freeing with g_strfreev
temporary string lists.
2023-08-14 17:29:44 -04:00
Jacob Boerema 8495dd6eed plug-ins: improve creation date handling in metadata-editor
Dates in Xmp include a time and timezone, so add a default time when
selecting a date since we can't edit time and timezone yet.

So far, we didn't take into account that IPTC-IIM has separate date
and time+timezone values instead of the combined value in XMP for
DateCreated.

When loading DateCreated check if it has the same value as IPTC
values DateCreated and TimeCreated combined. If not, we show a
terminal error and ignore the IPTC values.
If neither Xmp nor Iptc has a DateCreated, then use Exif.Photo.
DateTimeOriginal combined with OffsetTimeOriginal to set an initial
value.

When saving, synchronize with IPTC-IIM by splitting the DateCreated
value in date and time+timezone and save each to the appropriate tag.
Also make sure that for IPTC-IIM the date separator is a '-'.
2023-08-14 16:50:15 -04:00
Jacob Boerema 83294ba4c7 plug-ins: improve spacing in metadata-editor
Adds a bottom margin to the grids because the horizontal scrollbar
was overlapping the bottom-most row of the grid.
Adds wordwrap and left/right margins to multiline text widgets,
mainly to make the text not start right at the edge of the widget.
2023-08-13 15:15:04 -04:00
Jacob Boerema b97f96249a plug-ins: Xmp.plus.ImageSupplierName can only have one value
as used in metadata-editor:
Change from MODE_MULTI to MODE_SINGLE.
2023-08-13 15:15:04 -04:00
Jacob Boerema c633091d54 plug-ins: in metadata-editor use array size constants...
instead of hard-coded numbers.
Also:
- remove unneeded set_tag_string for n_creatorContactInfoTags
- remove now unneeded structs
2023-08-13 15:15:04 -04:00
Jacob Boerema 4e40a3edd2 plug-ins: make mode in metadata-editor an enum
We were using a string for the metadata mode, meaning we had to compare
string values in a lot of places.

We simplify and probably speed-up comparisons here by replacing the
mode string by an enum value.

The only place still needing the string values sometimes is
metadata-impexp.[ch] where we added a conversion table to convert
the mode to a string.
2023-08-13 15:15:03 -04:00
Alx Sa b459ce95bb plug-ins: Handle single-channel OpenEXR with unknown channel names
OpenEXR allows for arbitrary channel names. Instead of failing once the common ones are checked, this patch 
checks the number of channels in the file.
If there is only one channel, it is treated as 
grayscale (similar to OpenImageIO's behavior).
A debug warning with the channel name is also printed.
2023-08-10 19:37:25 +00:00
Zander Brown e00f2b3bf9 play: use GMenu directly 2023-08-10 12:11:01 +00:00
Zander Brown ddd1a48825 remap: use GMenu directly 2023-08-10 12:11:01 +00:00
Zander Brown efabebd0bb help-browser: move menu to XML 2023-08-10 12:11:01 +00:00
Zander Brown 7d1eac18ca ifs: move menu to XML
See: https://gitlab.gnome.org/GNOME/gimp/-/issues/9776
2023-08-10 12:11:01 +00:00
Alx Sa 8709e91999 plug-ins: Make GFig menus translatable
Based on the IMAP port in !1031, this moves the menu code to a separate file
so that gettext can access it for translation.
2023-08-09 16:17:00 +00:00
Zander Brown 3b6ea6f02e imap: generate sources
The targets were just being left floating, and the pre-generated in-tree
source were always used instead

When bison/flex are found, ensure we actually dep on their output - thus
actually running the targets - and only use the in-tree copies as a
fallback
2023-08-09 13:46:56 +00:00
Zander Brown 637385c7d1 imap: move menu to XML
Having it as an inline string doesn't make much sense, and makes it
untranslatable
2023-08-09 13:46:56 +00:00
Jacob Boerema eee763b1c1 plug-ins: fix #9816 file-raw-data.exe Crash
When changing the width we got a division by zero crash because we
did not consider the case of bpp * bitspp being less than 8.

To fix this we check if bitspp is less than 8 and in that case multiply
the amount of bytes by 8 and then divide by the number of bits per
pixel.
2023-07-31 13:58:26 -04:00
Alx Sa 4b54ceb023 plug-ins: Fix lava filter for non-square selections
Resolves issue #9809, fix by @mareroqpoland.
When "Separate Layer" is selected, the entire drawable is always
filled rather than using the selection. This patch uses the selection
instead (which will be "all" if there is no active selection)
2023-07-30 22:24:49 +00:00
Alx Sa f947109f92 build: Enable IFF format on Windows
Now that libiff and libilbm have been added to the MSYS2 repositories,
the plug-in can be built automatically on Windows.
2023-07-26 17:12:35 -04:00
Anders Jonsson 8b84c5551b plug-ins: add and correct gettext macros in Python 2023-07-25 21:26:57 +00:00
Jacob Boerema 18408ce966 app, libgimp, libgimpwidgets, plug-ins, etc: rename behaviour to behavior
We use US English which uses behavior. So we replace all occurrences of
behaviour.

Most notable is File Open behavior in preferences. Besides that several
mentions in function documentation and a few in comments.
2023-07-21 15:35:23 -04:00
Alx Sa d1864866ee plug-ins: Support Farbfeld image import/export 2023-07-19 00:37:54 +00:00
Anders Jonsson 091893ddf5 menus, plug-ins: more tab menu translatability 2023-07-17 10:27:30 +00:00
Anders Jonsson caff1e61e4 libgimpwidgets, plug-ins: translate dialog buttons
GTK no longer contains stock labels, so the button
labels needed to be marked as translatable.
2023-07-15 14:29:14 +00:00
Alx Sa 9c87aaeebd scripts: Fix warning in Java map tooltip text
Per @ajonsson, gettext does not like < or > used as symbols
and throws a warning. They are replaced with HTML entities
&lt; and &gt; to prevent the problem.
2023-07-15 14:23:01 +00:00
Jehan 3b05315754 plug-ins: fix the Python test dialog.
With recent changes, a GimpResource's ID is not its name anymore.
2023-07-14 16:59:46 +02:00
Jehan a964b80ad7 plug-ins: the Python test plug-in should be installed for unstable branch and…
… non-release builds.
2023-07-14 16:45:39 +02:00
Jehan 4c1ae49fc9 plug-ins: update the Help/GIMP Online links.
- Remove the wiki which is now dead.
- Update the roadmap link and title it in plural.
- Move the "Bug Reports and Feature Requests" inside "GIMP Online/" submenu.
2023-07-13 23:13:19 +02:00
Jehan 9ad5049dec menus, plug-ins: now place various plug-ins in the right menu sections.
This removes a bunch of inconsistencies we had from the before-2.99.16 version
because new items from plug-ins were all added at the bottom of their respective
submenu.
2023-07-13 15:49:05 +02:00
Jacob Boerema b82419305b plug-ins: fix formatting in animation-optimize
A lot of the function calls did not have a space between function name
and opening parenthesis.
2023-07-12 16:45:26 -04:00
Jacob Boerema 5cdfa6e891 plug-ins: fix resource leak in animation-optimize 2023-07-12 16:45:26 -04:00
Jacob Boerema 5f1b0aab87 plug-ins: reduce chance of buffer overflow when copying strings
Sphere-designer: Since some of the strings are translated versions, we
can't know in advance how long they are going to be.
Let's use string copy/cat functions that explicitly check the size and
are guaranteed to add a NULL.
2023-07-12 16:45:26 -04:00
Jacob Boerema 6c8625e5fc plugins: fix #8082 XWD file renders incorrectly 2023-07-11 18:26:05 -04:00
Jacob Boerema ea68d87b66 plug-ins: clean up file-xwd
- Add modern error handling using GError.
- Check return values of fseek and fgetc for errors.
- Remove most occurrences of g(u)long.
- Fixed overflow issue with maxred/green/blue found with coverity.
2023-07-11 18:17:42 -04:00
Jacob Boerema 6484193d8f script-fu: fix out-of-bounds array access
I noticed this in coverity. I couldn't find any actual script using
SF_DISPLAY, so the impact probably isn't very big.
Because the enums start at 0, the size of the array should be at least
one more than the value of the last enum, which was not the case here.

Increase the size of the array by 1, so that accessing SF_DISPLAY,
which is the enum with the highest value, is valid.
2023-07-11 12:04:24 -04:00
Alx Sa 624ae512fc plug-ins: Fix typo in gfig-arc
Resolves #5742.
The check is for a horizontal line (where the Y coordinate
would be the same for all three points), but the X axis was
checked instead due to a copy/paste error.
2023-07-11 15:25:39 +00:00
Jehan d54c511968 plug-ins: use proper gimp_brush_get_by_name().
Note that in the future, we expect this to be possible to create other brushes
with a same name. Maybe we should have a special function allowing to request
core resources (the ones installed by GIMP itself).
2023-07-11 12:00:22 +02:00
Jacob Boerema d43075dca0 plug-ins: incorrect order of parameters in load_image_resource
Even though these parameters are currently not used here, better use
the correct order.
2023-07-10 17:50:08 -04:00
Jacob Boerema 63bb893c06 plug-ins: fix resource leak in psd-load
Adding unsupported messages was overwriting the old message without
first freeing it. In addition, the first message was initialized
as a string constant.
We now start with duplicating the (empty) string, so that it can be
freed. We then add a define to reduce boilerplate to add the string
for each unsupported feature. The code in this define takes care of
adding the new message and freeing the old message.
2023-07-10 17:50:08 -04:00
Jacob Boerema bbbd149ba3 plug-ins: fix possible integer overflow on large images in jigsaw
Make sure we use gsize for intermediate results to not get integer
overflow on large image sizes.
This still is not ideal, but better than a crash, since we may (try to)
allocate a very large block of memory, which we should eventually fix
by looping over smaller size buffers.
2023-07-10 14:19:07 -04:00
Jacob Boerema 5645abc051 plug-ins: fix meson deprecated warning for file-icns 2023-07-10 12:30:24 -04:00
Jehan 2c608168a2 plug-ins: don't use Tabs indentation, only space.
This was introduced in commit 95fa902827. Unfortunately Gitlab web UI is really
not good at showing indentation issues (or any other space coding style issues,
for that matter).
2023-07-07 17:38:23 +02:00
Jordi Mas 95fa902827 Specify no format to prevent the % to be interpreted as formatter by the gettext toolchain 2023-07-04 14:39:11 +02:00
Alx Sa d68c7f612f plug-ins: Clarify JPEG subsampling option labels
Resolves #5525.
"4:4:0" is the more well-known term rather than "4:2:2 vertical" for this subsampling option.
2023-06-30 17:28:52 +00:00
Alx Sa 3cf5a587ce plug-ins: Match RGB FITS orientation to SiriL
Switching to the cfitsio library's fits_read_img () function in 03ea666f 
caused RGB FITS images to be read in upside down per SiriL developers and
NASA standards (odd, since cfitsio is maintained by NASA). This flips them back.
2023-06-30 16:01:39 +00:00
Alx Sa 03ea666fc8 plug-ins: Fix regression on importing RGB FITS
The developers of SiriL sent me some RGB FITS images that rendered incorrectly
after d4f42076. These must be read in as 
planes rather than individual rows.
2023-06-29 15:31:50 +00:00
Jehan f5001a4c8c plug-ins: we must output the dummy file in the same directory. 2023-06-29 00:09:28 +02:00
Jehan 9e9fe1435a build, plug-ins, gitlab: make GIMP runnable from build directory without…
… being installed.

There is already most of the main code logic for this, though now plug-ins need
to be in their own subdirectories, which breaks for plug-ins/common/ and
plug-ins/python/, while I needed plug-ins in both these categories to generate
the Windows installer welcome images (file-png, and python-fu-eval in
particular).

Once again, meson was not very helpful, since all its functions still refuse to
output generated files in subdirectories, so I end up duplicating plug-in files
with a custom Python script.

This should fix the CI. It was working on my machine as GIMP was installed, but
such a build rule should work even without GIMP installed.
This will also be useful in the future when we'll want to run unit tests of
plug-ins through the finale GIMP binary itself.
2023-06-27 17:46:46 +02:00
Daniel Novomeský a4f0239818 plug-ins: support libjxl v0.9 decoding API 2023-06-26 16:41:05 +02:00
Jehan 6a9838c804 plug-ins: fix build warnings.
Fixes several missing declaration warnings because in fact of missing include,
such as:

> warning: no previous declaration for ‘console_editor_new’ [-Wmissing-declarations]

Fixes 2 old-style definitions:

> warning: old-style function definition [-Wold-style-definition]
2023-06-25 23:43:40 +02:00
bootchk 7b9b5db69e SF Console history persist as GStrv setting.
Other driveby format and wording changes to dialog title, welcome text.

Part of issue 9579 SF roadmap
2023-06-25 18:28:03 +00:00
Alx Sa 280cde75f4 plug-ins: Port checkerboard to...
...GimpProcedureDialog
2023-06-23 14:13:29 +00:00
Jehan a580f47e22 plug-ins: fix previous commit (!901).
Config string properties are allocated. We can't use static strings.

Also fixing an unused variable (mesg_body) warning.
2023-06-21 21:38:36 +02:00
Alx Sa 51cf74c036 plug-ins: Port mail to GimpProcedureDialog 2023-06-21 19:36:28 +00:00
Alx Sa e152591e80 plug-ins: Don't run Depth-Merge when cancelled.
When porting depth-merge to GimpPlugin in 5154b271 the return statements
were not fully replicated. As a result, the depth-merge function was 
called even if the dialogue had been cancelled.
This patch adds the missing return statements to prevent this.
2023-06-21 19:01:32 +00:00
Jehan 2541389b0c plug-ins: don't use a hardcoded 256 as max border.
Half of the smaller dimension seem a better value, since once we reach any half,
it means we will compute using all pixels anyway. Any width higher than this is
useless.
2023-06-21 17:33:04 +02:00
Alx Sa 519b627f5d plug-ins: Port border-average to...
...GimpProcedureDialog.
Also provides an example of the new 
gimp_procedure_dialog_get_size_entry () API.
2023-06-21 14:05:19 +00:00
bootchk 57909356ff Implement #9628 enhanced err msg for mismatched parens 2023-06-20 07:39:26 -04:00
bootchk 1bc2ed77a3 Fix #9554 (quit 1) must yield err msg
So that scripts have a way to declare an error.
2023-06-20 11:14:13 +00:00
Jordi Mas a09609bb76 Removes spaces at the end of string and Compuserve company name which is not relevant in 2023 2023-06-19 20:47:51 +00:00
Alx Sa 762088f9de plug-ins: Show dimensions, BPP in ICO layer names 2023-06-18 05:11:44 +00:00
Alx Sa 2065db7fe7 plug-ins: Don't load image for ICO thumbnail
Due to a small typo, GIMP always loaded the entire image as a thumbnail
even if a suitable one was found.
This patch fixes that typo.
2023-06-17 04:42:34 +00:00
Alx Sa e5a4336604 plug-ins: Add width/height label to ICO export
Similar to the ICNS export, file-ico now shows the icon dimensions for 
all types in the export dialogue.
2023-06-16 23:44:36 +00:00
Alx Sa 9efc552069 plug-ins: Keep GIF's full palette on import
Resolves #414.
Currently GIMP only loads the palette colors used in a GIF, discarding 
the rest. This can cause issues when a consistent palette is required
(e.g. a video game sprite or background).
This patch uses either the global or local GIF max palette value to set 
the colormap size, thus retaining the full palette on import.
2023-06-15 21:07:22 +00:00
bootchk 5eac31f07f Refactor ScriptFu Console
Rename fields of ConsoleInterface more desciptive

Add c,h files for object editor and history

Extract object ConsoleEditor

Extract object ConsoleHistory

Extract TotalHistory methods
2023-06-15 13:26:00 +00:00
Øyvind Kolås 21411047ee app,pdb,plug-ins: %s/gegl_node_connect_to/gegl_node_connect/ 2023-06-13 19:58:42 +02:00
Øyvind Kolås 6919d07b6c plugins/file-gegl: use gegl_node_link instad of gegl_node_connect_to 2023-06-13 17:14:03 +02:00
Alx Sa a04f287a4b script-fu: Fixed SF_ONE_OR_MORE_DRAWABLE option
The order of GIMP_PROCEDURE_SENSITIVE_DRAWABLE | 
GIMP_PROCEDURE_SENSITIVE_DRAWABLES was reversed in 
gimp_procedure_set_sensitivity_mask (), which caused scripts using 
SF_ONE_OR_MORE_DRAWABLE to crash.
2023-06-13 02:51:58 +00:00
Alx Sa 73d5dcecae plug-ins: Fix defaults for 1/4/8 bpp ICO export
8bpp and below ICO formats use a 1 bit mask for transparency.
When imported the mask is treated as an additional transparent color.
If the icon used the max palette (e.g. 2 colors for a 1bit icon),
the default export format will become larger than necessary.
This checks if the layer still has 1 bit alpha, and subtracts the
mask color from the count.
2023-06-09 22:12:43 +00:00
Jehan c9b114e6e9 plug-ins: we still depends on librsvg 2.40.x.
In commits a6756b515b and 23da44e3c8, newer API of librsvg were used, over our
current minimum requirement. The reason why we don't bump this requirement is
that librsvg 2.40.x are the latest versions which are full-C. While we have
nothing against Rust, it is not available on all existing platforms, and we
really want to have GIMP buildable everywhere, while also have SVG support
always present (even though it's a vector format, it's an important one in
graphics work nowadays).
See issue #6821.

So in the end, let's keep the old minimum requirement, but test against librsvg
version to compiler either with old API or new one. The changes are limited
enough that it's not too much a bother.
2023-06-08 17:43:16 +02:00
Alx Sa 5070e0e9ec plug-ins: Add additional DigitalSourceType...
types for the metadata editor.
2023-05-31 18:06:39 +00:00
Michael Natterer 5acdaac8e0 libgimp: remove getters and setters from GimpResourceSelectButton subclasses 2023-05-31 17:18:19 +02:00
Michael Natterer 9638102418 Introduce a global ID space for GimpData/GimpResource objects
Much like for images and items. Change the PDB to transmit IDs
instead of names for brush, pattern etc. and refactor a whole
lot of libgimp code to deal with it.

	modified:   libgimp/gimpplugin-private.h
2023-05-31 16:12:04 +02:00
Jacob Boerema 7908ecfbcd plug-ins: synchronize name of nl-filter with manual
The name of the nl-filter plug-in in the manual was recently changed to be
more in line with its description.
Since that is already the name of the plug-in file here, let's also update
the name of PLUG_IN_PROC to be in line with this.
2023-05-27 23:12:11 -04:00
Michael Natterer 26dce72d2c Remove autotools 2023-05-27 00:03:52 +02:00
Niels De Graef 85a77f8a64 plug-ins/grid: Make sure dest_buffer is initialized
Initialize to NULL at the very least
2023-05-26 12:45:50 +02:00
Jacob Boerema 671996e897 plug-ins: fix #8441 distress-selection.scm script failure
distress-selection.scm uses gimp-image-set-active-channel which has been
removed causing script failure when a channel is selected instead of a
layer.

Use the new multi-layer aware gimp-image-set-selected-channels and also
use the gimp-item-id-is-* functions instead of the deprecated
gimp-item-is-* functions.
2023-05-25 18:31:56 -04:00
Niels De Graef 01e960e98e plug-ins/scheme-wrapper: Use GIR for enum values
This allows our script-fu plugins to use the GIMP enum values, just like
all our other plug-ins know them.

In other words:

* Names are consistent with those of other plug-ins
* Introspectable enums are automatically added as they are added to the
  introspection file, without even needing a recompile
* No need to keep track of our enum types anymore, as that is just a
  redundant implementation of introspection in practice. This in turn
  will let us simplify some of the pdb code
2023-05-24 23:19:20 +02:00
Michael Natterer a8d30578cd script-fu: fix double free in script-fu-dialog.c
Spotted by Lloyd Konneker.
2023-05-24 21:35:48 +02:00
Alx Sa 7a1e6bedd5 plug-ins: Increase Script-fu Console size...
and Plug-in/Procedure Browser size.
gtk_widget_set_size_request () is applied to the dialog, as it does not
seem to bubble up from being applied to individual elements.
The existing 2.10 width/height values are used.
2023-05-24 18:56:23 +00:00
Michael Natterer 4fb27afd9e plug-ins: don't leak the comment string in file-psp.c 2023-05-24 14:32:00 +02:00
Simon Budig f540e79172 screenshot: there actually is no need to preprocess the PNG data... 2023-05-24 11:32:05 +02:00
Niels De Graef 89c359ce47 Remove GimpUint8Array in favor of GBytes
GLib has a specific type for byte arrays: `GBytes` (and it's underlying
GType `G_TYPE_BYTES`).

By using this type, we can avoid having a `GimpUint8Array` which is a
bit cumbersome to use for both the C API, as well as bindings. By using
`GBytes`, we allow other languages to pass on byte arrays as they are
used to, while the bindings will make sure to do the right thing.

In the end, it makes the API a little bit simpler for everyone, and
reduces confusion for people who are used to working with byte arrays
in other C/GLib based code (and not having 2 different types to denote
the same thing).

Related: https://gitlab.gnome.org/GNOME/gimp/-/issues/5919
2023-05-23 23:37:50 +02:00
Simon Budig 23da44e3c8 file-svg: remove deprecated librsvg api, added some pixbuf/cairo fuckery. 2023-05-23 00:45:50 +02:00
Simon Budig 3b925cd78e animation-play: remove deprecated gtk-alignmnents 2023-05-22 22:35:30 +02:00
Alx Sa 3cd896c983 plug-ins: Import IBM PC Formatted TIFF layers
TIFFs with PSD layers can be saved in either Macintosh or IBM PC format.
IBM PC section labels are reversed and the integers are Little Endian.
We now check for 'MIB8' sections and reverse the necessary values so
that the PSD plug-in functions can handle them.
2023-05-22 14:45:34 +00:00
Simon Budig a6756b515b file-svg: fix deprecated use of rsvg_handle_get_dimensions() 2023-05-22 09:30:25 +02:00
Alx Sa 6f8f481ee2 plug-ins: Remove screenshot-icon.h in Makefile.am
Since the file itself was removed in 5d7d11a8.
2023-05-22 04:29:56 +00:00
Michael Natterer 7de9c347b6 script-fu: use gimp_value_array_copy(), and free the copy 2023-05-21 18:56:32 +02:00
Alx Sa e020a6b3ca plug-ins: Add support ILBM HAM mode images
"Hold and Modify" ILBM images use control bits to increase the palette
beyond what's stored in the CMAP chunk. This patch checks if
HAM mode is set and then interprets the plane bits accordingly.
2023-05-21 15:31:42 +00:00
Simon Budig 5d7d11a81f screenshot: move deprecated pixdata into png resource 2023-05-21 13:22:57 +02:00