Commit Graph

9035 Commits

Author SHA1 Message Date
Jacob Boerema 8fdeaddbe7 plug-ins: fix using wrong offset for group layer masks in psd export.
Exporting to psd could result in very large files which often failed to
load in both GIMP and PS when a group layer with a layer mask
was present.

Reported on our IRC channel with a sample xcf which made it
possible to figure out the problem.
2021-05-04 15:48:34 -04:00
Jehan 4f1007edbc Issue #6695: Wrong tab after JPG export because of "Show preview"…
… feature.
Using the new gimp_display_present() function in file-jpeg to make sure
the original display is back to the top.
2021-04-30 03:51:21 +02:00
Jehan aba721ae68 Issue #6280: JPEG preview window doesn't get closed.
The port had a slight error, because in gimp-2-10, the display_ID
actually had 3 states: 0 when gimp_export_image() kept the original
image to which we just add a preview layer, -1 when it created a new
image which we wanted to put in its own display, and the display ID
itself when created.

With the new API where display variable is an object, we can only have 2
cases. So I create an additional variable separate_display to make the
distinction.
2021-04-30 01:35:51 +02:00
Jacob Boerema fe228a6f6f plug-ins: fix #5960 Gimp loads 16 bit DDS images with luminosity as 8 bit.
So far all dds images were loaded as 8 bit per channel which makes
sense for most but not all dds formats.

This commit implements loading in 16 bit for "L16" - a 16 bit
luminance channel.

In addition to that we improve security a bit  by not assuming
that L16 is the only left over case but instead explicitly
checking the correct value of rmask for L16.

For other cases we now set an error with enough details
to identify the type of DDS image that needs extra
handling.
2021-04-26 17:35:04 -04:00
Jehan ef2402bf8e app, libgimp, pdb, plug-ins: allow pasting multiple full layers.
When a selection exists, we are copying then pasting the selection
contents. In particular, with multi-layer selection, it means pasting a
merged result of the selected layers (like a sample merged but limited
to selected layers).

Yet when no selection exists, with a single layer selected, a cut in
particular would remove the layer fully, then a paste would copy it
elsewhere (in the same image or even on a different image). This was
still working, but not with multiple layers. This is now fixed and we
can now copy/cut then paste several layers (without merge), which is
sometimes a very practical way to move layers (sometimes simpler than
drag'n drop, especially between images).

As a consequence, the PDB function gimp_edit_paste() now also returns an
array of layers (not a single layer).
2021-04-24 23:22:58 +02:00
Jacob Boerema 165b50abcc plug-ins:fix #6624 metadata viewer default window size is too small
Let's increase the default size of the metadata viewer a bit.
Ideally we would add some logic to determine the width of
the first column since that one currently depends on the
length of the longest tag. However for now this change
will be enough for most cases.
2021-04-24 12:45:52 -04:00
Jacob Boerema ed35579861 script-fu: fix #6741 Round Corners script fails to work on layer masks
The round corners script was assuming that the drawable always
was a layer, which is incorrect when a layer mask is selected.

We fix this by always requesting the active layer instead of
active drawable.

We also enable this script for RGB and GRAY with alpha
channel. Although it might not always make sense to
use this script when an alpha channel is present, there
can be use cases where it is perfectly fine.

So let the designer decide if this script is suited or not
instead of GIMP making that judgement.
2021-04-24 12:41:41 -04:00
Jehan 69fdcf5d3f plug-ins: use g_mkdir() for generic cross-platform code.
This fixes the following error when building for Windows:

> error: too many arguments to function ‘mkdir’

On Windows, mkdir() is deprecated, it is an alias for _mkdir() which
doesn't have a mode parameter. The GLib version duplicates the POSIX
signature and is cross-platform (mode is simply ignored on Windows).
2021-04-24 17:03:43 +02:00
saul 11906fa82c plug-ins: Add 'dir-make' procedure to Script-fu.
Closes: GNOME/gimp#541

Reviewer note: thanks to Stanislav Grinkov for cleaning up and reworking
a bit the patch, such as renaming the procedure to dir-make, as per
Kevin Cozens' review.
2021-04-24 15:09:24 +02:00
Jacob Boerema cad6273fed plug-ins: fix #6755 DDS RGB10A2 has Red and Blue swapped.
Looking at the documentation it is indeed red that should go
in the lowest bits and blue in the highest bits so just
reverse our code for red and blue.

We also update the version of our GIMP DDS plug-in,
this way we can catch and correct RGB10A2 images
written by older versions of our plug-in and correct
them.
2021-04-23 14:31:50 -04:00
bootchk 877d585271 Partial fix 5426. Lets old scriptfu script call old name gimp-image-is-valid,
mapped to new PDB procedure gimp-image-id-is-valid (same signature), for example.

Edit a few comments in new code.

Style changes, no logic change.
2021-04-22 11:27:22 -04:00
bootchk 34150ddda7 Use g_logging and migrate functions for author's errors to separate source file.
Eliminate conditional compile for debugging.
2021-04-22 11:01:43 -04:00
Jacob Boerema 6ec20e6ed0 plug-ins: adapt file-openraster to API changes.
I only fixed the changes that made it fail.
I have not updated it to the sensitivity API.
2021-04-21 13:04:46 -04:00
Jehan 65e10faf50 plug-ins: change non-existing brush.
Fixes:
> Calling error for procedure 'gimp-brush-get-pixels':
> Brush 'Circle (03)' not found

The data/brushes/Circle-3.vbr brush doesn't exist since commit
7aa12175a4 in 2012 as far as I can see.
2021-04-21 17:50:24 +02:00
Jehan 2a1555b082 plug-ins: fix spyro-plus.
- Now using multi-drawable run() signature, but sensitive only with a
  single drawable.
- width|height() calls are now get_width|height().
- PDB call to 'plug-in-sel2path' now expects a drawable array as well.
2021-04-20 22:17:28 +02:00
bootchk e960f1a296 Fix #5915, Python Console Apply button fail. 2021-04-20 16:03:05 +00:00
Jehan fb84b9eba7 plug-ins: fix a bunch of Scheme scripts after API functions renaming.
Since we renamed a bunch of functions for consistency (the like of
gimp_image_width() to gimp_image_get_width() and others), most Scheme
scripts ended up broken. This is a simple bash fix with `sed` to at
least take care of these simple renaming cases.

Many scripts are still broken for other reasons after our API evolution
(to be continued).
2021-04-20 17:47:11 +02:00
Jehan 077f2d4e25 plug-ins: remove now useless/ugly workaround.
See previous commit.
2021-04-20 17:16:32 +02:00
Jehan f15d16150e plug-ins: update foggify to latest API and add a GUI.
The following changes were made:
- run() signature now moved to multi-drawables.
- sensitivity mask now enables the plug-in when one or several drawables
  are selected. When several, a fog layer will be created over each
  selected layer.
- Mnemonics added to properties.
- Color property finally used now that our API has support for boxed
  parameters with GimpRGB value type.
- Use a config object instead of ordered GimpValueArray and use the
  begin|en_run() API to store values between runs.
- Add a graphical interface generated with the new GimpProcedureDialog
  API.
2021-04-20 16:54:40 +02:00
Jehan 623ce4a9e3 plug-ins: move benchmark-foreground-extract to gimp-data-extras.
We did port it to the new API but we are doubting it is useful at all.
It might have been, historically, when foreground extract algorithm was
first introduced, but probably not anymore, even more as the algorithm
is now implemented mostly on GEGL side anyway. So if any benchmark were
to be done, it should probably be added as GEGL tests.

Also as we are planning to update even more the API lately, it feels
really like a waste of time to also fix this plug-in while we currently
believe it to be useless.

Still we move it to the gimp-data-extras repository for being able to
easily bring it back in case we missed some use.
2021-04-19 18:10:54 +02:00
Lloyd Konneker 5cb51e096a Fix issue #6577 : scriptfu hang on select dialog on Mac
(cherry picked from commit 7b0df6f04a)
2021-04-19 16:31:33 +02:00
Jacob Boerema 48ff5313c3 plug-ins: fix #6723 Unable to open DDS files.
This is the same as what we did for #5357
but in the reverse situation. The reason
for not doing the same at that time was
because I wasn't sure if that was valid
in all cases.

Looking at the documentation it does seem
to be the right solution and is working for
the supplied example image.
2021-04-14 13:37:22 -04:00
Daniel Novomesky 6488a5e480 Disable automatic metadata handling for HEIF plug-in
The plug-in saves metadata together with exported image.
We ensure that GIMP won’t try to save metadata to
already exported file second time.
2021-04-07 16:26:16 +00:00
Jehan 2f46dfb354 plug-ins: use gimp_procedure_dialog_set_sensitive().
In PNG, JPEG and TIFF export plug-ins which use the new API, use our new
function to set widget sensitivity.

Note that part of it is similar to commit 6a2910bd3b on `gimp-2-10`,
making "Save GeoTIFF data" checkbox insensitive when there are no such
data available (this feature was late on the main branch as we rushed
for 2.10.24 release).
2021-04-06 21:52:33 +02:00
Jehan df723aca28 plug-ins: use GimpChannelOps in gfig rather than using a custom…
… SelectionType enum which lists anyway the same.

Fixes various warnings:

> warning: implicit conversion from ‘SelectionType’ to ‘GimpChannelOps’
2021-04-06 17:27:08 +02:00
Jehan ca8bc2bc1d app, libgimp, pdb, plug-ins: more functions moved to get|set().
The gimp_drawable_type() is an issue though as gimp_drawable_get_type()
is already defined as a common GObject API.
Though I'm actually wondering if GimpImageType is well called. Rather
than Type, shouldn't we go with ColorModel?

sed -i 's/\<gimp_drawable_bpp\>/gimp_drawable_get_bpp/g' "$@"
sed -i 's/\<gimp_drawable_width\>/gimp_drawable_get_width/g' "$@"
sed -i 's/\<gimp_drawable_height\>/gimp_drawable_get_height/g' "$@"
sed -i 's/\<gimp_drawable_offsets\>/gimp_drawable_get_offsets/g' "$@"
2021-04-06 14:34:31 +02:00
Jehan fa16152757 app, libgimp, pdb, plug-ins: update some more functions to get|set().
s/gimp_image_base_type/gimp_image_get_base_type/
s/gimp_image_width/gimp_image_get_width/
s/gimp_image_height/gimp_image_get_height/

Sorry plug-in developers, more porting work! But really this seems like
the right thing to do in order not to get stuck with inconsistent naming
for many more years to come.
2021-04-06 00:49:07 +02:00
Jehan d659bb128d plug-ins: store last used values for QBist with new plug-in API.
This allows last used values to survive the GIMP session.

Alternatively this allows to close !424 as this was the last usage of
PATH_MAX.
2021-04-06 00:15:32 +02:00
Jehan cd3333c6d3 meson, configure, plug-ins: image/x-sun-raster is a supported MimeTypes.
Also ".sun" is a possible (and common) file name extension for Sun
Raster images, according to various sources and samples I found (these
samples with .sun extension also opened fine in GIMP, so it's not just a
subvariant which we may not handle or something of the sort). This one
is not so important though as we also register magic bytes for detection
(which is the proper way), but it can still be useful, mostly for
exporting (as we will direct to the SunRaster plug-in if someone tried
to export a file with .sun extension, since no other file format uses
this extension AFAICS).

There is no functional change, I just had a look at this plug-in while
handling !428 and realized this format was not present in the MimeType
list (which is used to generate the desktop file, in order to have
proper mime types, not detection based on extension only, unlike
Windows in !428).
2021-04-04 16:01:58 +02:00
Jehan 931b9fb539 plug-ins: fix all remaining GimpImageProcedure to new run() API. 2021-04-04 01:40:00 +02:00
Jehan 79e608694e plug-ins: fix many GimpImageProcedure to new run() API.
No logics change so far.
2021-04-04 01:40:00 +02:00
Jacob Boerema 5d14c59d2e plug-ins: fix incorrect saving of Iptc.Application2.Caption in metadata-editor.
The saved value for Iptc.Application2.Caption is copied from Xmp.dc.description.
However the last one is multiline but the former should be single line. This
caused only the first line to be saved instead of all lines.

To fix this we set Iptc.Application2.Caption to single and use a different
conversion based on whether the tags from Xmp and Iptc are both
multiline or whether Iptc is single line.
2021-03-24 12:51:59 -04:00
Jehan 708f075f80 plug-ins: make the applied pattern in qbist a bit more prominent.
The qbist plug-in shows a grid of 9 patterns, it was not clear at all
which one will be applied. Also it looked like selecting a pattern would
make it disappear and loading a same file twice would not create the
same patterns (as said in commit 7fb696206e).

Actually the plug-in works fine, but it is simply not clear at all what
is happening until we look at the code. The center pattern is the main
one: the one which will be applied and the only one which will be stored
or loaded in/from a file if we decide to save the pattern. Also when
selecting a pattern, it does not disappear, it is moved to the center
(but you don't necessarily realize it, especially as several will look
the same). And the reason why you get different result when loading a
saved pattern is that it only reimports the center pattern; all others
are indeed randomized from this stable source.

So my fix is attempting to have this center pattern standing out a bit
more by framing it with a "Pattern" title. It's not perfect, and I'm not
very happy with this design, but I don't find a nice widget for better
framing the center pattern, nor do I want to spend too much time on
this. It's better than before at least.
2021-03-24 01:03:44 +01:00
Jehan 8396fc5022 plug-ins: tweak the pattern preview size relatively to the scale ratio.
Avoiding having tiny preview areas on displays with bigger scale ratio.
2021-03-23 23:40:01 +01:00
Jacob Boerema 93f591931b plug-ins: fix incorrect values for ModelReleaseStatus and PropertyReleaseStatus.
While testing the metadata-editor I noticed that certain values for 
ModelReleaseStatus and PropertyReleaseStatus were incorrectly
read back.

Apparently while copy pasting some values were forgotten to be
updated which caused incorrect values to be saved.

There probably are not many users of these metadata tags
since in all these years there hasn't been a bug report about this.
2021-03-23 16:44:02 -04:00
Jacob Boerema 0a902456ac plug-ins: Do not write to Iptc.Application2.DateCreated if no date was set.
The metadata-editor allowed Iptc tags to be set if an empty string was
used contrary to Xmp tags. In the case of DateCreated this cause an
invalid date "0-00-00" to be written.

We added a check to only write text Iptc metadata if the value is
not empty.
2021-03-23 15:24:07 -04:00
Jacob Boerema a229454915 plug-ins: Do not write empty ModelReleaseStatus and DigitalSourceType.
Fixes issue #3656 Empty metadata tags are written to XCF at least.

Xmp.plus.ModelReleaseStatus and Xmp.iptcExt.DigitalSourceType are
defined as combo boxes with a fixed number of possible values.
However there was no option to leave it empty so there always was
a value written when saving metadata in the metadata-editor.

We added a "select value" as default option and only write
metadata if a different value was chosen.

As a bonus we replaced the fixed loop numbers with
the current actual number of defined choices.
2021-03-23 15:24:07 -04:00
Jehan 7fb696206e plug-ins: fix crash of qbist when loading files.
Contents of these arrays are assumed to be limited to a specific range.
While it did work sometimes (because a further processing would randomly
regenerate some of the indexes and correctly limit the range), it often
crashed.

This commit fixes the crash, but I am not sure this plug-in is working
exactly as expected regarding data load/save. It feels like you would
expect to always get the same patterns with a same source data. Yet
there is further randomization going on.

Oppositely when saving data, and re-loading it later, I would expect
once again to get back the exact same patterns I had when saving the
data. So it would be a way to save the result of randomization (as
chances to get back a pattern one liked are slim by definition when it's
created randomly).

Right now, it doesn't behave at all like this. Files are only used as
some kind of random seed, not as a way to save/load patterns. I feel
this was not the purpose of the file handling here.
2021-03-23 19:36:43 +01:00
Jacob Boerema 34463786b1 plug-ins: interpret Exif.Photo.UserComment before showing in metadata-viewer. 2021-03-22 16:07:13 -04:00
Jacob Boerema a95371c2b0 plug-ins: in metadata-editor use /iptcExt instead of /Iptc4xmpExt when saving.
We need to work around an issue in Exiv2 that saving to /Iptc4xmpExt bag
records fails which seems related to it registering /iptcExt. Unregistering
that and registering the first one doesn't work.
See: https://gitlab.gnome.org/GNOME/gexiv2/-/issues/24

So let's use /iptcExt for saving even though it's the less common form
for now. When loading metadata we try to load the most common
form first and if that fails we will load /iptcExt.
2021-03-15 20:49:39 -04:00
Jacob Boerema d00fe2bfe2 plug-ins: set most common CreatorContactInfo last in metadata-editor.
Set Xmp.iptc.CreatorContactInfo/Iptc4xmpCore:* last since the short
form Xmp.iptc.Ci* could have been used to set this information too.

Becausethe first (longer) form is the most common let that override the
shorter form in the (unlikely) case that both are present and also have
different values.

Due to a bug in the metadata-editor previously only the short form
was saved.
2021-03-14 19:19:09 -04:00
Jacob Boerema 184b803811 plug-ins: fix several memory leaks in metadata-editor. 2021-03-14 18:32:09 -04:00
Jacob Boerema f04b84cb39 plug-ins: fix using incorrect structs and fields in metadata-editor. 2021-03-14 18:07:46 -04:00
Jacob Boerema 4609def72f plug-ins: more refactoring of duplicate code in metadata-editor.
Reordered the strings in artworkorobject to be in the same
order as the columns.
Add write_metadata_tag_multiple function that handles most
of the previously duplicated code and check for special
handling of phonetype when necessary by adding
an enum and a get_phonetype function.
2021-03-12 22:05:52 -05:00
Jacob Boerema 9c2451d813 plug-ins: refactor writing single metadata tag in metadata-editor.
Use a separate function that can be reused and also get rid of
the large output_data array and strcat without length
checking. We will use GString instead.
2021-03-12 22:05:52 -05:00
Jacob Boerema 87763cbe27 plug-ins: remove use of strcpy without length checking in metadata-editor. 2021-03-12 22:05:52 -05:00
Jacob Boerema c2fa21ac7d plug-ins: remove use of global tagdata array in metadata-editor.
This removes some flawfinder warnings by not using a fixed
size array and using g_snprintf instead of g_sprintf and
using more safety checks.
2021-03-12 22:05:52 -05:00
Jacob Boerema 0a0eeac1ad plug-ins: more refactoring of metadata-editor.
There was a lot of duplicate code based on
whether or not value was NULL with for
some tags partially unreachable code.

We combine the parts and only test
value for NULL where needed.

Also rename the typos in enum
COL_REGSITRY_* to
COL_REGISTRY_*
2021-03-12 22:05:52 -05:00
Jacob Boerema e24a6dc8d6 plug-ins: refactor metadata-editor adding values to gui.
There's a lot of duplicate code for adding string values
to the gui (liststore). This is another part of trying
to reduce that.
Besides that the copying code uses fixed size arrays
without length checking as pointed out by flawfinder.

We will instead use a function add_to_store to add a
comma or semicolon separated list of values stored in
value to add rows with values to the gui.
2021-03-12 22:05:52 -05:00
Jacob Boerema fd2aa645af plug-ins: be a little more forgiving loading g3 fax images.
Only count a broken line once and only stop after at
least 10 consecutive broken lines since older fax
images are known for having bad lines.

This enables loading the image in issues #475.
2021-03-05 14:13:37 -05:00