Commit graph

4269 commits

Author SHA1 Message Date
Jehan
2ea5dec56e libgimpwidgets: improved gimp_prop_scale_entry_new(), new function…
… gimp_label_spin_set_digits() and deleted gimp_prop_opacity_entry_new()

- The "digits" argument for the number of decimal places in
  gimp_prop_scale_entry_new() is now mostly useless since GimpLabelSpin
  (hence GimpScaleEntry too) got a nice estimation algorithm of sensible
  values.
- Add gimp_label_spin_set_digits() function to manually set the digits
  property when we don't like the estimated value.
- Also add a new "factor" argument to gimp_prop_scale_entry_new(). Its
  role is to allow a GimpScaleEntry showing a factored range, typically
  a [0, 100] range for some types of [0, 1] properties.
- Remove gimp_prop_opacity_entry_new() which was basically a
  special-case of gimp_prop_scale_entry_new() and which can now be
  easily reproduced by simply set factor=100.0.
- Update all usage of gimp_prop_scale_entry_new() in app/ and plug-ins/
  with updated arguments. It is interesting to note that all existing
  usage were either integers (digits=1) or when double, the estimated
  decimal places are the same as the ones which were manually set (hence
  showing the generic estimation is not too bad). So the new function
  gimp_label_spin_set_digits() was not even needed once in current code.
2020-11-25 02:32:22 +01:00
Jehan
56bfda3dd3 plug-ins: update file-png to new metadata handling.
The plug-in GUI code keeps slimming down. :-)
2020-11-23 02:15:13 +01:00
Jehan
501675b8a3 plug-ins: file-png now uses generated dialog.
Basically the same design as before (but a bit prettier, by using a
2 columns flowbox rather than a grid), yet 80 lines smaller according to
git stats. Also still the exact same code logics as before. No feature
loss (and actually a feature gain as there was the "Save comment"
checkbox but no text field to edit the comment as we get in other
plug-ins).

Basically better and prettier dialog in just a few lines. Moreover it's
still work-in-progress. We can even do better, but this is things to
come.
2020-11-20 00:22:21 +01:00
luz paz
bb322d94d7 Fix typos
Found via:
```
codespell -q 3 -S ./ChangeLog*,*.po,./.git,./NEWS* -L als,ang,ba,chello,daa,doubleclick,foto,hist,iff,inport,klass,mut,nd,ower,paeth,params,pard,pevent,sinc,thru,tim,uint
```
2020-11-19 21:56:25 +01:00
Jehan
d95f417719 app, libgimpwidgets, modules, plug-ins: code changes after GimpScaleEntry…
… reclassing as GimpLabelSpin subclass.
2020-11-05 18:06:52 +01:00
Jehan
b3c0ba061b app, libgimpwidgets, modules, plug-ins: finishing GimpScaleEntry port.
Renaming the temporary function gimp_scale_entry_new2() into
gimp_scale_entry_new() now that the original code is entirely gone. This
is now a fully-fledged widget with a nice and proper introspectable API.
2020-11-01 02:46:20 +01:00
Jehan
77d2a93a52 libgimpwidgets, plug-ins: remove legacy gimp_color_scale_entry_new().
Former gimp_color_scale_entry_new() is finally replaced by the
GimpColorScaleEntry implementation.
Both places which used it (GimpColorScales and compose plug-in) now use
the new widget.

Also making "upper" and "lower" properties of GimpScaleEntry into
construction properties, and create the main GtkAjustment at init, so
that we are sure that lower and upper bounds are properly set before we
set the value (when setting all properties at once, we cannot ensure
that these limit properties are set before the "value" one).
2020-11-01 02:23:03 +01:00
Jehan
f27d172750 libgimpwidgets: new GimpColorScaleEntry class.
Similarly to GimpScaleEntry, this is meant to replace usage of
gimp_color_scale_entry_new() by having a proper widget. This is a child
class of GimpScaleEntry which simply replaces the GtkScale by a
GimpColorScale by adding a GimpScaleEntry class method to create the
scale widget (only restriction: it must be a GtkRange subtype).

This also triggers me to rename gimp_scale_entry_get_scale() into
gimp_scale_entry_get_range() (as well as the 2 plug-ins already using
this function).
2020-11-01 00:08:20 +01:00
Jehan
e0854b62b6 plug-ins: port remaining plug-ins using old gimp_scale_entry_new(). 2020-11-01 00:08:20 +01:00
Jehan
7ebd19636c plug-ins, modules: more port to GimpScaleEntry. 2020-10-31 02:07:35 +01:00
Jehan
f342b566c8 plug-ins: various plug-ins ported to new GimpScaleEntry. 2020-10-30 23:28:57 +01:00
Jehan
0f05825a29 app, libgimpwidgets, plug-ins: default increments for GimpScaleEntry.
Instead of setting always manually the step and page increments when
creating a GimpScaleEntry, let's just generate some common cases
automatically. Indeed the increments are rarely something you want to
care about. The algorithm used is:
- For a range under 1.0, use a hundredth and a tenth (typically a [0,
  1.0] range will step-increment of 0.01 and page-increment of 0.1).
- For small ranges (under 40), step-increment by 1, page-increment by 2.
- For bigger ranges, step-increment by 1, page-increment by 10.

For use cases when you absolutely want specific increment values, I add
the gimp_scale_entry_set_increments() function. It is much better to
have a small and understandable constructor call followed by
configuration calls (only when needed) rather than a constructor with a
crazy amount of parameters. Hence gimp_scale_entry_new() went from 17
arguments (absolutely unreadable calls) to now 5.
2020-10-30 12:33:46 +01:00
Jehan
d81b151e79 app, plug-ins: use the updated gimp_prop_scale_entry_new() API. 2020-10-30 11:02:20 +01:00
Jehan
d48dae7181 plug-ins: implement file-heif proc list in init_procedures() instead…
… of query_procedures().
Since our procedure list is now fully dynamic with runtime check, it's
much better to run it at every startup. Basically if some has updated
libheif with new encoders/decoders, we want GIMP to be aware at it at
next startup even if the plug-in has not been updated.
2020-10-26 17:53:00 +01:00
Daniel Novomesky
35c0d7dca6 HEIF plug-in: runtime detection of supported formats 2020-10-22 16:46:51 +00:00
Jehan
05bb84ebed Issue #5788: 10/12 bpc in HEIF export does not mean HDR. 2020-10-19 20:47:07 +02:00
Jehan
cb2268ab21 meson: separate line for HEIC and AVIF support.
libheif pc files provides variables which are actually older than our
minimum libheif requirement (so it's usable generically) to determinate
if libheif was built for HEIC/AVIF support. This is quite useful as we
had our share of annoyance with missing support of some encoder/decoder
even when libheif requirement was alright.

Also adding image/avif (if relevant decoder is present) to list of
supported mimetypes.
2020-10-19 18:56:13 +02:00
Daniel Novomesky
64bfa57eec Improved HEIF plug-in
User can select color subsampling/pixel format
(YUV444, YUV420, RGB)
User can select encoder speed (Slow, Balanced, Fast)
Lossless option delivers visually lossless output
2020-10-15 17:38:24 +02:00
Jacob Boerema
02bad34a41 Issue #5735: incorrect condition because of missing parenthesis.
Also taking the opportunity to change the minimum size since I
apparently counted it wrong. The size always seems to be 46
starting from psp file-version 4 up to and including the current
version 13.
2020-10-08 13:54:24 -04:00
Jehan
66dae000f9 Issue #5734: fix typos in if() test. 2020-10-08 01:36:34 +02:00
Jehan
5ec3293fee plug-ins: change export dialog title when exporting as AVIF.
Even though "Export Image as HEIF" is not technically wrong (AVIF is AV1
encoding inside HEIF container), it is better to be more accurate.

Moreover as Daniel Novomesky was explaining in a MR, nowadays when we
say "HEIF", we usually mean "HEIC", whereas you'd use the explicit
"AVIF" naming for HEIF/AV1 images. This seems confirmed by Wikipedia
which says that HEIC is the "implied default codec for HEIF".

So let's just make the AVIF vs HEIF distinction here (I could have used
AVIF vs. HEIC which is even more explicit but I decided to keep the
less-specific yet more used HEIF naming).
2020-10-04 17:41:58 +02:00
Jehan
67e2e1b5bb app, libgimp, plug-ins: move Orientation metadata handling into core.
Orientation is now handled by core code, just next to profile conversion
handling.

One of the first consequence is that we don't need to have a non-GUI
version gimp_image_metadata_load_finish_batch() in libgimp, next to a
GUI version of the gimp_image_metadata_load_finish() function in
libgimpui. This makes for simpler API.
Also a plug-in which wishes to get access to the rotation dialog
provided by GIMP without loading ligimpui/GTK+ (for whatever reason)
will still have the feature.

The main advantage is that the "Don't ask me again" feature is now
handled by a settings in `Preferences > Image Import & Export` as the
"Metadata rotation policy". Until now it was saved as a global parasite,
which made it virtually non-editable once you checked it once (no easy
way to edit parasites except by scripts). So say you refused the
rotation once while checking "Don't ask again", and GIMP will forever
discard the rotation metadata without giving you a sane way to change
your mind. Of course, I could have passed the settings to plug-ins
through the PDB, but I find it a lot better to simply handle such
settings core-side.

The dialog code is basically the same as an app/dialogs/ as it was in
libgimp, with the minor improvement that it now takes the scale ratio
into account (basically the maximum thumbnail size will be bigger on
higher density displays).

Only downside of the move to the core is that this rotation dialog is
raised only when you open an image from the core, not as a PDB call. So
a plug-in which makes say a "file-jpeg-load" PDB call, even in
INTERACTIVE run mode, won't have rotation processed. Note that this was
already the same for embedded color profile conversion. This can be
wanted or not. Anyway some additional libgimp calls might be of interest
to explicitly call the core dialogs.
2020-09-24 12:43:41 +02:00
space pudim
22bedfc376 Fix #4560 - file-xpm saving unused transparency
The XPM export plugin was saving the color `None` (transparency) to the
exported image palette for all images with an alpha channel, even if the
color was not used on any pixel.

Since it's nice to have `None` as the first color on the palette, mapped
to character ' ', and it could be too wasteful to scan all pixels twice,
the approach taken was to just undo it's premature insertion.

(cherry picked from commit 0a9bb2839e)
2020-09-20 02:18:50 +02:00
Jehan
0fc8821932 plug-ins: fix missing "plug-in-colormap-swap" procedure.
Existing code was returning only 1 out of 2 expected procedure names.

See !241 for the originally proposed patch by Rafał Mikrut (@qarmin).
Unfortunately the proposed patch also had another bug and was always
returning an empty list instead, and the contributor is unresponsive. So
let's just redo the patch and be done with it.

Also using g_list_prepend() instead of g_list_append() as it's usually
more efficient (to be fair here, for a size-2 list, it doesn't matter
much but it's good practice anyway) and order doesn't matter.

Thanks Rafał Mikrut for noticing the original bug!
2020-09-19 19:27:26 +02:00
Jehan
b3bed72d84 plug-ins: default export bit depth for 16 or 32 bpc images should be 12.
The proposed defaults for export should be the less destructive
possible. So for any 16 or 32 bpc GIMP images, since our HEIF plug-in
only supports up to 12 bpc, this should be what we export to.
2020-09-18 15:32:55 +02:00
Daniel Novomesky
76db57e738 Metadata (Exif, XMP) export in HEIF plug-in
Exif metadata export is built only with GExiv2 0.12.2+ because gexiv2_metadata_get_exif_data is used.
2020-09-17 13:48:03 +02:00
Daniel Novomesky
7f95abc4ef Make strings translateable in HEIF/AVIF export dialog 2020-09-12 22:28:03 +02:00
Jacob Boerema
bf66a07d20 plug-ins: add support for indexed images in psp reader. 2020-09-11 23:44:57 -04:00
Jacob Boerema
2054f9f163 plug-ins: add support for grayscale images in psp reader. 2020-09-11 23:44:57 -04:00
Jacob Boerema
7863d668e0 plug-ins: add support for 16 bit integer images in psp reader. 2020-09-11 23:44:57 -04:00
Jacob Boerema
84f06e976a plug-ins: show descriptive layer type name for psp layers we can't convert. 2020-09-11 23:44:57 -04:00
Jacob Boerema
d7abb774a9 plug-ins: add defines for psp reader to include new things up to psp file version 8.
This also fixes the incorrect existing define for a mask layer.
2020-09-11 23:44:56 -04:00
Jacob Boerema
0a8f5b99f5 plug-ins: replace a few occurrences of g_message with g_set_error in psp reader. 2020-09-11 23:44:56 -04:00
Daniel Novomesky
0fce1b042b Fix compilation with old libheif 1.3.2
High bit depth import and export enabled only for >= libheif 1.8.0
2020-09-08 10:25:16 +00:00
Jacob Boerema
19b261f3c6 plug-ins: add most likely blend modes for certain psp blend modes.
This adds a blend mode for all known psp blend modes that were not
converted yet except for adjust.
I couldn't find any information about adjust and it's value of
255 suggests that it is not a normal blend mode.
2020-08-31 12:28:12 +00:00
Jacob Boerema
b968a93ab2 plug-ins: fix reading of psp tubes when psp file version >= 4. 2020-08-31 11:10:15 +00:00
Jehan
97dc1bf9c6 plug-ins: fix wrong return type warning.
save_image() returns a boolean not a pointer.
2020-08-31 12:52:23 +02:00
Jacob Boerema
fa40bc7778 plug-ins: add support for reading raster layers of newer psp versions. 2020-08-27 09:16:45 +00:00
Jacob Boerema
85241a205b plug-ins: enable reading of psp images with file versions > 6. 2020-08-27 09:16:45 +00:00
Jacob Boerema
0666f7a4f9 plug-ins: refactor reading of raster layer extension info for psp images. 2020-08-27 09:16:45 +00:00
Daniel Novomesky
01e1587ec1 Updated HEIF plug-in
AVIF import and export (need libheif >= 1.8.0)
High bit (10/12) import and export
Auto pre-select suggested output bit depth in save_dialog
NCLX color profile import (link with lcms)
Metadata import (link with gexiv2)
Plugin will not return GIMP_PDB_SUCCESS in case of failure to import file.
2020-08-26 10:39:58 +00:00
Jacob Boerema
d7089c93b2 plug-ins: Take zero length layer names into account in psp reader. 2020-08-23 18:34:22 -04:00
Jacob Boerema
4ac373e84f plug-ins: fix reading layer names with high bit ASCII characters in psp files.
This also adds a few missing g_free when returning because of an error.
2020-08-22 21:11:01 +00:00
Jacob Boerema
dc80c78a26 plug-ins: fix wrong layer offset of psp layers. 2020-08-22 10:54:39 -04:00
Jacob Boerema
15ad952288 plug-ins: improve psp image reader stability by always using the block/chunk length.
Starting from psp file version 4 the specification recommends to always use the
block/chunk length to determine the next part of the image. This way it is
possible to skip parts you don't know or don't care about or additions in
newer versions.
This change makes sure to always do this which fixes reading several images
which crashed the plug-in before.

Also only try to read layer data if it is a raster layer.
2020-08-18 16:00:50 -04:00
Jacob Boerema
f4088adefa plug-ins: fix incorrect loading of PSP images with uncompressed channel data.
According to the PSP specifications "Each scanline in the image data is stored on a 4 byte boundary.	"
Based on all actual images I've seen this is incorrect. Possibly it is a leftover from an older specification.
2020-08-08 08:47:45 +00:00
Jacob Boerema
fcb9de07f6 plug-ins: fix reading of creator block data of PSP images.
Since string data in PSP images is not zero terminated
reading creator block data always failed.
2020-08-08 07:53:44 +00:00
Jehan
1a7a53dc09 plug-ins: fix argument description. 2020-07-20 17:38:16 +02:00
Yuri Chornoivan
4510e75864 Fix minor typo: entred -> entered 2020-06-18 09:09:55 +00:00
Michael Natterer
45ce68fe15 plug-ins: change the "compose-type" default values to upper case
just for consistency.
2020-06-17 21:56:31 +02:00