Commit Graph

279 Commits

Author SHA1 Message Date
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
Michael Natterer f4f106ad26 libimp*: add private pointers to all instance structs
even if we don't have private members (yet). Also make class padding 8
pointers in all headers. This commit moves nothing to private, it just
makes all headers consistent and adjusts .c files accordigly.
2018-05-20 21:06:33 +02:00
Michael Natterer 1ed586f0f1 libgimpcolor: remove most deprecated cruft, rest to follow 2018-05-20 21:06:29 +02:00
luz.paz 69b2e84924 Source and trivial typos
Found via `codespell` and `grep`
2018-05-12 23:44:47 +02:00
luz.paz 147c09f19e Bug 795161 - Misc. typo fixes in source comments and doxygen
Found via `codespell`
Follow-up to  commit 7fdb963e01
2018-04-18 21:06:57 +02:00
Michael Natterer 64c38edd81 Bug 795300 - ICC profile conversion artifacts and gamma problems
Cache the fish in GimpColorTransform as suggested by Massimo.
2018-04-18 18:49:47 +02:00
Michael Natterer 7ca38c54f6 Bug 794366 - Crash when using Hue-Chroma on a ProPhotoRGB image
Handle "CIE LCH(ab)" in gimp_color_profile_get_lcms_format() as
suggested by Massimo.
2018-03-18 18:48:12 +01:00
Ell 9c663a6574 libgimpcolor: fix gimp_color_profile_get_lcms_format() for premul formats
It doesn't look like LCMS supports premultiplied alpha formats, so
we must convert them to the corresponding non-premultiplied formats
ourselves.
2018-03-16 12:48:51 -04:00
Ell 22a28a23cc libgimpcolor: add shortcut in gimp_color_profile_is_equal()
When the two pointers are equal, return TRUE immediately, instead
of comparing the profile to itself.
2017-11-03 04:24:15 -04:00
Øyvind Kolås d0bb3efff4 libgimpcolor: follow API updates in babl 2017-10-03 16:15:46 +02:00
Øyvind Kolås ce982e12b9 libgimpcolor: pass intent to babl_space from icc creation 2017-09-14 00:14:10 +02:00
Jehan 16d33b034b Bug 787494 - incorrect babl_space_from_icc() call.
Added in commit 415f869f20 to drop a
workaround from commit bac042db39.
This line was not a part of the workaround and looks completely
unrelated. I assume that's just a commit mistake. :-)
2017-09-10 11:31:50 +02:00
Øyvind Kolås 415f869f20 app: drop workaround for bug #785521
We now hard depend on a fresher release of GEGL that already has this fix in
it.
2017-09-09 23:54:53 +02:00
Michael Natterer 582c6edd54 libgimp*: use some g_clear_object() and g_clear_pointer() 2017-09-03 15:14:51 +02:00
Michael Natterer 4cfeb53d09 libgimpcolor: use gimp_color_profile_get_format() in GimpColorTransform
and use babl to convert between profiles if possible. With the default
BABL_TOLERANCE this is about 5 times faster than lcms on my test image.

Using babl can be disabled by setting GIMP_COLOR_TRANSFORM_DISABLE_BABL.
2017-09-02 20:32:50 +02:00
Michael Natterer d092ee9102 libgimpcolor: add a new gimp_color_profile_get_format()
which takes a GimpColorProfile and a Babl format, and returns a new
format which uses the profile's RGB primaries and TRC, and the
original format's pixel layout; or NULL if babl couldn't create a
space from the profile's ICC data.
2017-09-02 20:31:11 +02:00
Michael Natterer c63d812be8 libgimpcolor: rename gimp_color_profile_get_format() to _get_lcms_format() 2017-09-02 18:47:04 +02:00
Michael Natterer f59a635604 libgimpcolor: use the new cmsFLAGS_COPY_ALPHA in GimpColorTransform
and remove all manual alpha copying.
2017-09-02 17:11:45 +02:00
Massimo Valentini f2306abc0a Bug 761170: Warnings building with clang
Fix some of the warnings.
2017-07-15 21:05:56 +02:00
Jehan 85c0373489 libgimpcolor: support CAIRO_FORMAT_A8 in gimp_cairo_surface_get_format() 2017-06-16 16:42:39 +02:00
Michael Natterer 60a50096fa libgimpcolor: some doc fixes and updates 2017-06-03 21:03:25 +02:00
Michael Natterer ff44cb59d3 libgimpcolor: disable gimp_rgb_clamp() in GimpParamSpecRGB
so from now on all GimpRGB object properties will allow unbounded
sRGB, let's see what happens.
2017-05-16 22:39:55 +02:00
Michael Natterer 0edecc8d56 libgimpcolor: support "CIE Lab (alpha)" in gimp_color_profile_get_format()
Return "RGB(A) float", babl will do the needed conversions.
2017-02-24 12:50:57 +01:00
Richard Kreckel dd9b0fc55b Bug 768044 - Fix many typos
This fixes many typos in comments and one in a user-visible string (msgid
"center abscisse" changed to "center abscissa" in affected po files. too).
2016-06-26 00:35:24 +02:00
Michael Natterer 06aa05e422 libgimpcolor: gimp_color_profile_get_format: support premultiplied formats 2016-06-08 00:00:36 +02:00
Michael Natterer b4f34375b7 Bug 767062 - Lags when zooming or dragging zoomed image (cmsFLAGS_NOOPTIMIZE)
Use cmsFLAGS_NOOPTIMIZE only for actual image buffer or single color
transforms, but not for previews or the image display. Makes things a
lot more responsive again.
2016-06-05 16:50:02 +02:00
Michael Natterer 726552b085 libgimpcolor: return a NULL transform if cmsCreate[Proofing]Transform() fails
It doesn't really "fail", we check if an error was logged during
transform creation and get rid of the transform even if lcms returned
a pointer. This totally sucks but is better than crashing on a corrupt
transform.
2016-05-30 12:48:54 +02:00
Michael Natterer d8271ed33f libgimpcolor: return NULL GimpColorTransform if creating cmsHTRANSFORM fails 2016-05-30 10:58:48 +02:00