Commit Graph

44 Commits

Author SHA1 Message Date
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 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
Massimo Valentini f2306abc0a Bug 761170: Warnings building with clang
Fix some of the warnings.
2017-07-15 21:05:56 +02:00
Michael Natterer 60a50096fa libgimpcolor: some doc fixes and updates 2017-06-03 21:03:25 +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
Michael Natterer 06aa05e422 libgimpcolor: gimp_color_profile_get_format: support premultiplied formats 2016-06-08 00:00:36 +02:00
Michael Natterer ff3e9d76ac libgimpcolor: add CMYK formats to gimp_color_profile_get_format()
Makes the CMYK color selector not crash.
2016-05-27 00:33:56 +02:00
Michael Natterer 7326f346c3 libgimpcolor: optimize gimp_color_profile_get_format() for cairo-RGB24
Trick lcms into converting cairo-RGB24 pixels directly, by using
TYPE_BGRA_8 on little endian and TYPE_ARGB_8 on big endian. They have
the same byte order, and the alpha channel (ignored by lcms anyway)
takes the place of the unused byte of cairo-RGB24.

This saves two babl conversions around cmsDoTransform().
2016-05-25 12:33:38 +02:00
Michael Natterer 46096a17e3 libgimpcolor: add gimp_color_profile_save_to_file() 2016-05-04 20:40:04 +02:00
Michael Natterer 086dc60505 libgimpcolor: don't leak the path in gimp_color_profile_new_from_file() 2016-05-04 18:58:37 +02:00
Michael Natterer 52af9145d7 libgimpcolor: handle palette formats in gimp_color_profile_get_format()
Return "R'G'B'[A] u8" and "TYPE_RGB[A]_8" and babl and lcms formats.

I'm not sure which code triggered the warning about an unhandled
format, but now it handles indexed images too.
2016-04-27 00:48:23 +02:00
Elle Stone db400d558a Make grayscale profile with LAB companding curve TRC 2016-04-21 05:05:00 -04:00
Michael Natterer f34aa5fa6b Bug 756389 - Color-managing grayscale images
Rename profile constructors to say "d65_gray" instead of just "gray",
"srgb_trc" instead of "srgb_gamma", and drop the "srgb" from
"srgb_linear" because we now say "d65". This should be a naming scheme
that doesn't conflict with whatever future functions we might add.
2016-04-09 18:47:51 +02:00
Elle Stone 6ba19a5d46 Bug 756389 - Color-managing grayscale images
Change grayscale profiles to show white point
2016-04-09 18:33:11 +02:00
Elle Stone f819db6c80 Bug 764772 - Change GIMP-generated profile names to be more accurate 2016-04-08 12:44:39 +02:00
Michael Natterer c40dd417a2 libgimpcolor: update docs of gimp_color_profile_get_format() 2016-04-07 22:12:22 +02:00
Michael Natterer a33daf99fe libgimpcolor: rename RGB and GRAY gimp_color_profile_new_*() functions
to be more consistent, as discussed in bug #756389.
2015-12-15 20:42:21 +01:00
Michael Natterer fc743bd426 libgimpcolor: add support for GRAY profiles in gimp_color_profile_get_format()
surprisinly seems to work just fine. Thanks to Roman Lebedev for
hinting that this is possible, and for constructing the #defines.
2015-12-14 23:16:38 +01:00
Michael Natterer 822bfabe21 Revert "libgimpcolor: use D50 for the gray profiles"
This reverts commit 169f436e75.

Turns out we should use the same whitepoint for RGB and GRAY.
2015-12-14 18:43:26 +01:00
Michael Natterer 169f436e75 libgimpcolor: use D50 for the gray profiles 2015-12-14 01:32:35 +01:00
Michael Natterer 11e8cacf7e Bug 756389 - Color-managing grayscale images
Support creating linear/sRGB-gamma variants of gray profiles and
rename gimp_color_profile_new_linear_rgb_from_color_profile() to
gimp_color_profile_new_linear_gamma_from_color_profile() because it's
not RGB-specific any longer.
2015-12-13 23:36:31 +01:00
Michael Natterer b54a8d1939 Bug 756389 - Color-managing grayscale images
Add gimp_color_profile_new_srgb_gray() and
gimp_color_profile_new_linear_gray().

I know "srgb_gray" sounds odd but it's better than
"gray_with_srgb_trc"...

Please review, I have no clue if that code is right.
2015-12-13 19:43:02 +01:00
Michael Natterer 4780471c5f libgimpcolor: add gimp_color_profile_is_gray()
and improve gimp_color_profile_is_linear() to return TRUE for linear
gray matrix profiles.
2015-12-13 14:33:51 +01:00
Michael Natterer 0cf597d042 libgimpcolor: clean up gimp_color_profile_is_linear(), add it to gimpcolor.def 2015-11-23 01:29:17 +01:00
Øyvind Kolås d8f19f31ce libgimpcolor: add a function to check if a profile is linear RGB 2015-11-23 00:03:35 +01:00
Michael Natterer e2f3a05d44 Bug 751553 - Linear precision doesn't display the image correctly
Fix copy/paste bug in gimp_color_profile_get_rgb_matrix_colorants()
which returned a broken XYZ triple for the blue component. Spotted by
Massimo.
2015-10-21 20:25:06 +02:00
Michael Natterer 6eb9f9d4aa libgimpcolor: add API to create profile variants with linear/sRGB gamma
and the original profile's RGB chromacities and whitepoint.
2015-10-20 20:13:40 +02:00
Michael Natterer 13c2721cde libgimpcolor: clean up profile creation in GimpColorProfile
Use shorter and consistent local variable names, improve the unused
function that creates a linear/sRGB-gamma profile from another RGB
profile.
2015-10-19 01:14:35 +02:00
Elle Stone b8902a7d95 Bug 728610 - Code for retrieving the XYZ values of a matrix RGB profile
Add two private functions which are currently unused but will
become public once it's clear where exactly we need them:

gimp_color_profile_get_rgb_matrix_colorants(): returns a GimpMatrix2
with the RGB colorants.

gimp_color_profile_new_foobar(): takes an existing profile and creates
a new one with the same RGB colorants but a linear gamma TRC. To be
renamed and made more general.
2015-09-06 20:35:05 +02:00
Michael Natterer f9da5cc6cc Bug 478528 - Layer and Image previews are not color managed
Fix gimp_color_profile_get_format() to return the right format for
"cairo-RGB24": simply check for the more special cairo formats first,
then check for the general RGB models. Found by Massimo.
2015-09-06 14:14:32 +02:00
Michael Natterer 608f254b33 libgimpwidgets: support cairo formats in gimp_color_profile_get_format()
so color profile transforms can write directly to cairo-RGB24 and
cairo-ARGB32 surfaces.
2015-09-02 20:31:31 +02:00
Michael Natterer f6f91bcc99 libgimpcolor: don't return a profile's model as fallback for it's description
in gimp_color_profile_get_label(). Also, make
gimp_color_profile_get_summary() more verbose.
2015-08-22 21:59:30 +02:00
Michael Natterer 9fc64e3664 Bug 492048 - Detect color space in Exif 2.21/DCF 2.0 option files
Add gimp_color_profile_new_adobe_rgb(), will need this later to fix
this bug.
2015-08-19 23:10:56 +02:00
Michael Natterer 0693298d63 libgimpcolor, *: change all GimpColorConfig getters to return const gchar*
instead of a gchar* which has to be freed. Cache all the strings in
the GimpColorConfig instance.
2015-07-12 14:10:18 +02:00
Massimo Valentini 688861cd34 Bug 751553: Linear precision doesn't display the image correctly
gimp_color_profile_is_equal(): byte-by-byte compare the entire profile
*except* the header, instead of only the header, which was wrong.
2015-07-10 23:06:53 +02:00
Michael Natterer c102dde92b libgimpcolor, *: change GimpColorProfile to be a GObject
it used to be a typedef to gpointer and actually was a cmsHPROFILE.

Change its API to be more "standard", remove the public close()
function. The object caches both the cmsHPROFILE and the data/length
ICC blob, so conversions between the two become obsolete (simply call
get_lcms_profile() or get_icc_profile()).

Adapt everything to the new API, but port it in a naive way for now,
the code doesn't take advantage of the new possibilities yet (like
refcounting).
2015-07-10 22:53:59 +02:00
Michael Natterer 86e88b9b40 libgimpcolor: fix error message in gimp_color_profile_get_format() 2015-06-12 20:43:17 +02:00
Michael Natterer 4910c28957 libgimpcolor: rename the gimp_lcms_*() functions to gimp_color_profile_*()
because it doesn't make sense to call the typedef GimpColorProfile
but the function namespace gimp_lcms_*().
2015-06-03 09:41:23 +02:00