Commit Graph

306 Commits

Author SHA1 Message Date
Jehan 1a840b8e18 libgimpcolor: fix call to cmsCreateProofingTransform().
Wrong argument order! See Little-CMS API.
2022-04-20 20:54:20 +02:00
Jehan 3294586438 libgimpcolor: use the proper GimpColorRenderingIntent type.
GimpColorRenderingIntent and BablIccIntent are actually 1-on-1
equivalent (for the common base values), but it's better anyway to call
with the right type. Also fixes this warning:

> libgimpcolor/gimpcolortransform.c:215:53: warning: implicit conversion
> from 'enum <anonymous>' to 'GimpColorRenderingIntent'
> [-Wenum-conversion]
2022-01-20 12:08:00 +01:00
Niels De Graef 6fc26cfbc4 libgimpcolor: Fix annotation in GimpRenderFunc 2021-12-28 21:23:42 +01:00
Niels De Graef dcd1dd29a8 libgimpcolor: Fix gimp_rgb_list_names() for introspection
This functions has 2 `(out) (array)` arguments, where the array length
is defined by the return value. This can't be expressed in GIR
annotations unfortunately, so just add it as another `(out)` argument.

Also, by default `(out)` args are assumed to be `(transfer full)`, while
these were actually `(transfer container)`.
2021-12-02 12:43:57 +01:00
Jacob Boerema dd67dd3287 libgimpcolor: use g_debug for informational "using babl ..." messages
We sometimes can get a lot of informational messages like:
gimp_color_transform_new: using babl for 'sRGB IEC61966-2.1' ->
'GIMP built-in sRGB'.
After discussion on IRC there is agreement to use g_debug for these instead
of g_printerr.
This way they can still be seen with GIMP_DEBUG=LibGimpColor, but won't
clutter the console when looking at something else.

Note that this only changes the informational message. All the error
messages are left alone as g_printerr.
2021-10-16 18:46:20 -04:00
Jehan 49e534247a app, libgimp*, pdb, plug-ins: use g_memdup2() instead of g_memdup()
Since it appeared with GLib 2.68.0, we could not change this until we
bumped the dependency which has only become possible a few days ago
(since Debian testing is our baseline for dependency bumps). Cf.
previous commit.

As this is a drop-in replacement (just a guint parameter changed to
gsize to avoid integer overflow), search-and-replace with:

> sed -i 's/g_memdup\>/g_memdup2/g' `grep -rIl 'g_memdup\>' *`

… followed by a few manual alignment tweaks when necessary.

This gets rid of the many deprecation warnings which we had lately when
building with a recent GLib version.
2021-08-26 17:32:09 +02:00
Niels De Graef c2d4e7d265 gir: Fix some missing (out) annotations 2020-05-18 13:26:23 +02:00
Niels De Graef 82e945d945 Add GIR annotations to bilinear utils 2020-05-05 19:37:44 +02:00
Niels De Graef 83d6764e0e gir: Add (closure) tags 2020-05-04 21:31:30 +02:00
Niels De Graef 7f58f2d6e5 gir: Add more missing (array) and (out) annotations 2020-05-04 21:29:42 +02:00
Niels De Graef 9c9e310a67 gir: Add missing annotations
Otherwise we won't be able to generate proper API for our bindings
2020-05-04 02:11:57 +02:00
Niels De Graef 99a7d5f7dd gir: Found some more missing (out) annotations 2020-05-03 18:12:37 +02:00
Niels De Graef 52a146604b gir: Add some missing (array length) annotations
This will make sure that bindings can generate a more "native" API so
they don't have to pass the length explicitly.
2020-05-03 18:11:29 +02:00
Niels De Graef 878804fb01 Cleanup GObject signal marshallers
* Don't generate our own marshallers if they are available in GLib
  already
* Don't set the c_marshaller parameter in `g_signal_new()` if it's a
  default marshaller provided by GLib. See commit message of commit
  39e4aa3c57 on why this is the case.
2020-04-01 21:20:01 +00:00
Niels De Graef 89f692cd73 libgimpcolor: Use G_DEFINE_BOXED_TYPE()
This isn't any functional change, but allows us to get rid of some of
the GObject boilerplate.
2019-11-05 10:14:29 +00:00
Félix Piédallu 65eff6f150 Meson port. 2019-09-11 16:42:04 +02:00
Michael Natterer e6d662e352 libgimp*: various doc fixes 2019-08-10 12:32:25 +02:00
Niels De Graef a0ba37649d libgimpcolor: colormanaged: Use G_DECLARE_INTERFACE()
This cuts aways a little of the GObject boilerplate.
2019-08-09 19:48:20 +00:00
Michael Natterer b45c2a6f78 libgimpcolor: rudimentary docs for gimp_adaptive_supersample_area()
and proper callback annotations. Also move the three callback typedefs
from gimpcolortypes.h to gimpadaptivesupersample.h because they are
needed nowhere else.
2019-08-09 15:24:49 +02:00
Jehan 2dde79b3e7 libgimp*: move GObject Introspection into libgimp/.
libgimp is anyway processed at the very end after all other libgimp*
were built. This way, it also fixes #3746, by removing the $(top_srcdir)
everywhere from introspected files, hence making the build work again
with older automake.
2019-08-08 15:59:44 +02:00
Michael Natterer cc8fc0f90f libgimp*: add GI's .dirstamp to .gitigore 2019-08-03 19:50:17 +02:00
Niels De Graef 5f92ced1f3 Add (nullable) if applicable
Basically this commit makes sure that all return values that are marked
as "Returns:" also have a `(nullable)` annotation if it is mentioned on
the same line that NULL can also be returned.

This will prevent a few problems in GObject-introspection.
2019-08-03 07:53:47 +00:00
Niels De Graef 1dda60154c Use "Returns:" to annotate return values
To be able to annotate return values through GObject-introspection, you
need to make sure it is tagged with `Returns:` and not something else.
2019-08-03 07:53:47 +00:00
Michael Natterer c12c031f2d pdb, libgimp*: add (out caller-allocates) to all GimpRGB* return values 2019-08-01 15:39:13 +02:00
Michael Natterer bbf4270437 libgimpcolor: fix "Since:" on gimp_param_spec_rgb_get_default() 2019-08-01 12:49:56 +02:00
Jehan 6fe2508301 libgimp*: fix various missing (transfer) annotations. 2019-08-01 01:52:07 +02:00
Jehan 8c978f4301 libgimpcolor: some more (transfer) annotations. 2019-07-31 23:55:07 +02:00
Jehan fb4c86a660 libgimp*: make more libgimp* libraries introspected.
Only libgimpwidgets is not introspected yet as it didn't work from
scratch and I don't have the time right now to look into it. Anyway with
all the others, we already have so many warnings during the GObject
Introspection step now that we have a lot of work to do already!
2019-07-27 20:25:20 +02:00
Michael Natterer 3597e92a20 libgimpcolor: add gimp_param_spec_rgb_get_default() 2019-07-27 16:10:24 +02:00
Michael Natterer aca5f806c4 libgimp*: lots of doc fixes and new docs for structs and enums 2019-07-24 01:18:30 +02:00
Michael Natterer 3cad4aa4c2 Issue #3057 - Retain last user-chosen ICC profile information...
...when generating "TRC variants"

When creating a new profile with different TRC from an existing
profile, keep all the original profile's description, model,
manufacturer and copyright strings around, but prefix them with "GIMP
from " or similar to indicate that they are different. Also make sure
we don't prefix strings with GIMP stuff multiple times when profiles
are generated repeatedly.
2019-05-31 15:44:07 +02:00
Michael Natterer 890b554230 libgimpcolor: better error messages in GimpColorProfile and GimpColorTransform 2019-05-28 17:37:08 +02:00
Michael Natterer 4ac4820a54 libgimpcolor: space invade gimp_color_profile_get_lcms_format()
The function was still returning formats without space, and was
lacking support for perceptual '~' models.
2019-05-28 00:35:03 +02:00
Ell 33d5eb2090 libgimpcolor: in gimp_adaptive_supersample_area(), use scratch allocator
In gimp_adaptive_supersample_area(), use the scratch allocator for
temporary buffers, instead of the regular allocator.
2019-01-24 04:15:21 -05:00
Michael Natterer 78f5d39e1a app, libgimpcolor: handle palette formats across babl_format_with_space()
Don't just pass the input format's encoding because that loses the
palette. Instead, pass the input format directly so
babl_format_with_space() can do its job of preserving the palette.
2019-01-01 16:34:57 +01:00
Ell 053e5edc93 libgimpcolor, app, modules, plug-ins: remove GEGL_ITERATOR2 define
... it's no longer needed, since GEGL commit
gegl@9dcd2cde63f95a080bf16a58c10e9ffbdd99aace.

Partially reverts commits:

6fca9959c7
cc10af72cc
49c53568d7
8edbc0d491
29f63616d2
3a2014984d
ee48ec6877
4165a315d5
764085278f
b7633c722e
6ab12061b7
754a3c5b18
22b4b647bd
55b3438328
c6d23add65
f03a84d607
822f9f0d2b
95358ca1fa
cdda37f4ee
41e8035635
6761da42b2
fb5d7832a8
97ed7817d8
46e9036578
ea9c5e6a49
24fbdfb591
beb4ecb238
4b77831e03
fcf113a39c
567ffe94ff
2018-12-02 11:15:37 -05:00
Michael Natterer f8ce6b7440 libgimpcolor: remove deprecated integer RGB <-> HSL conversion functions 2018-10-22 13:29:11 +02:00
Michael Natterer 40df58011f libgimpcolor: remove gimp_rgb_to_hsv_int() and gimp_hsv_to_rgb_int() cruft 2018-10-22 13:06:43 +02:00
Ell 3b0040c043 app, libgimp*, modules: don't use g_type_class_add_private() ...
... and G_TYPE_INSTANCE_GET_PRIVATE()

g_type_class_add_private() and G_TYPE_INSTANCE_GET_PRIVATE() were
deprecated in GLib 2.58.  Instead, use
G_DEFINE_[ABSTRACT_]TYPE_WITH_PRIVATE(), and
G_ADD_PRIVATE[_DYNAMIC](), and the implictly-defined
foo_get_instance_private() functions, all of which are available in
the GLib versions we depend on.

This commit only covers types registered using one of the
G_DEFINE_FOO() macros (i.e., most types), but not types with a
custom registration function, of which we still have a few -- GLib
currently only provides a (non-deprecated) public API for adding a
private struct using the G_DEFINE_FOO() macros.

Note that this commit was 99% auto-generated (because I'm not
*that* crazy :), so if there are any style mismatches... we'll have
to live with them for now.
2018-09-18 14:39:56 -04:00
Øyvind Kolås cdda37f4ee libgimpcolor: migrate to new iterator api 2018-09-11 01:37:42 +02:00
Michael Natterer 3889a59197 libgimpcolor: make gimp_color_transform_process_buffer() thread-safer
Avoid gegl_buffer_set_format() and simply construct the formats
differently to make sure reading/writing doesn't do any color space
transform. This makes it possible again to run it on different areas
of the same buffer from different threads.
2018-08-02 19:25:52 +02:00
Michael Natterer d7345a6a1f Issue 1917 - GIMP-2.99 uses sRGB instead of the user-selected monitor profile
Since the space invasion commit, colors entering and leaving a
GimpColorTransform were often implicitly converted up to three times,
the code was simply not properly ported to babl formats with spaces.

Fix GimpColorTransform to only ever transform colors between the
specified src and dest profiles, ignoring the space of any babl
formats involved.

Also, always return a non-NULL transform, even if the transform could
be done by a simply gegl_buffer_copy(), this way we can make sure in
one central place that transforms are done correctly, no matter if
babl or lcms is used.

Added quite some docs and comments to make clear what happens.
2018-07-31 20:07:21 +02:00
Michael Natterer e09e563a70 Initial space invasion commit in GIMP
All babl formats now have a space equivalent to a color profile,
determining the format's primaries and TRCs. This commit makes GIMP
aware of this.

libgimp:

- enum GimpPrecision: rename GAMMA values to NON_LINEAR and keep GAMMA
  as deprecated aliases, add PERCEPTUAL values so we now have LINEAR,
  NON_LINEAR and PERCPTUAL for each encoding, matching the babl
  encoding variants RGB, R'G'B' and R~G~B~.

- gimp_color_transform_can_gegl_copy() now returns TRUE if both
  profiles can return a babl space, increasing the amount of fast babl
  color conversions significantly.

- TODO: no solution yet for getting libgimp drawable proxy buffers in
  the right format with space.

plug-ins:

- follow the GimpPrecision change.

- TODO: everything else unchanged and partly broken or sub-optimal,
  like setting a new image's color profile too late.

app:

- add enum GimpTRCType { LINEAR, NON_LINEAR, PERCEPTUAL } as
  replacement for all "linear" booleans.

- change gimp-babl functions to take babl spaces and GimpTRCType
  parameters and support all sorts of new perceptual ~ formats.

- a lot of places changed in the early days of goat invasion didn't
  take advantage of gimp-babl utility functions and constructed
  formats manually. They all needed revisiting and many now use much
  simpler code calling gimp-babl API.

- change gimp_babl_format_get_color_profile() to really extract a
  newly allocated color profile from the format, and add
  gimp_babl_get_builtin_color_profile() which does the same as
  gimp_babl_format_get_color_profile() did before. Visited all callers
  to decide whether they are looking for the format's actual profile,
  or for one of the builtin profiles, simplifying code that only needs
  builtin profiles.

- drawables have a new get_space_api(), get_linear() is now get_trc().

- images now have a "layer space" and an API to get it,
  gimp_image_get_layer_format() returns formats in that space.

- an image's layer space is created from the image's color profile,
  change gimpimage-color-profile to deal with that correctly

- change many babl_format() calls to babl_format_with_space() and take
  the space from passed formats or drawables

- add function gimp_layer_fix_format_space() which replaces the
  layer's buffer with one that has the image's layer format, but
  doesn't change pixel values

- use gimp_layer_fix_format_space() to make sure layers loaded from
  XCF and created by plug-ins have the right space when added to the
  image, because it's impossible to always assign the right space upon
  layer creation

- "assign color profile" and "discard color profile" now require use
  of gimp_layer_fix_format_space() too because the profile is now
  embedded in all formats via the space.  Add
  gimp_image_assign_color_profile() which does all that and call it
  instead of a simple gimp_image_set_color_profile(), also from the
  PDB set-color-profile functions, which are essentially "assign" and
  "discard" calls.

- generally, make sure a new image's color profile is set before
  adding layers to it, gimp_image_set_color_profile() is more than
  before considered know-what-you-are-doing API.

- take special precaution in all places that call
  gimp_drawable_convert_type(), we now must pass a new_profile from
  all callers that convert layers within the same image (such as
  image_convert_type, image_convert_precision), because the layer's
  new space can't be determined from the image's layer format during
  the call.

- change all "linear" properties to "trc", in all config objects like
  for levels and curves, in the histogram, in the widgets. This results
  in some GUI that now has three choices instead of two.
  TODO: we might want to reduce that back to two later.

- keep "linear" boolean properties around as compat if needed for file
  pasring, but always convert the parsed parsed boolean to
  GimpTRCType.

- TODO: the image's "enable color management" switch is currently
  broken, will fix that in another commit.
2018-07-21 16:42:57 +02:00
Øyvind Kolås e707e55f82 app: update babl API usage
The space constructor from icc profile is now name spaced in the same
prefix as all the other space constructors in babl.
2018-07-16 19:04:17 +02:00
Michael Natterer ac57af58a2 libgimpcolor: add gimp_color_profile_get_space()
which returns the Babl space matching the profile.
2018-07-16 14:06:32 +02:00
Michael Natterer bab75b7365 Change a bazillion URLs to https://
Including all user-visible link and links called from code, like
the help pages.
2018-07-14 14:19:27 +02:00
Michael Natterer 5f700549e7 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
Ell 10f33b080b libgimpcolor, app: gracefully reject empty ICC profiles
In gimp_color_profile_new_from_icc_profile() and
gimp_image_validate_icc_profile(), don't raise a critical when
encountering an empty profile, but rather reject it gracefully with
an error.
2018-07-05 20:38:11 -04:00
Ell e47ffefab2 libgimpcolor, libgimpconfig: remove deprecated interface functions
Remove the deprectaed foo_interface_get_type() functions, as per
the last two commits.
2018-05-27 05:59:39 -04:00
Ell 6b40c7f37a libgimpcolor: port all interfaces to G_DEFINE_INTERFACE()
... instead of calling g_type_register_static() ourselves.

Keep the old foo_interface_get_type() (replaced with
foo_get_type()) around as deprecated functions, to maintain ABI
compatibility.  They will be removed in a separate commit in
master, so that this commit can be easily cherry-picked to
gimp-2-10.
2018-05-27 05:56:34 -04:00