Commit Graph

276 Commits

Author SHA1 Message Date
Michael Natterer ca349f88cd libgimpcolor: add gimp_color_transform_can_gegl_copy()
Which takes two profiles and returns TRUE if converting between
them works correctly without a GimpColorTransform. Use it in
gimp_color_transform_new() to return a NULL transform if none
is needed. Took the code from gimp-gegl-loops.c.
2016-05-26 23:14:57 +02:00
Michael Natterer 0bfa402c1a Argh, this was meant to be squashed into the previous commit... 2016-05-26 22:18:50 +02:00
Michael Natterer cc92887908 libgimpcolor: add new object GimpColorTransform
which encapsulates a cmsHTRANSFORM and does all the pixel format
conversion magic. It has API to create transforms and proofing
transforms, and to convert pixels arrays and GeglBuffers.

Before, each place which has a transform had to keep around the
transform and its input and output Babl formats, and had to implement
lots of stuff itself. Now all that lives in GimpColorTransform,
removing lots of logic from many places, and pretty much removing lcms
from the public API entirely.

This removes including <lcms2.h>, LCMS_LIBS and LCMS_CFLAGS from
almost all directories and potentially allows to replace lcms by
something else.
2016-05-26 22:15:54 +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 5e805c8b8b libgimpcolor: update gimpcolor.def 2015-12-15 20:49:46 +01: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 b45d31072b app, libgimpcolor: refactor GimpColorManaged::get_color_profile()
to not return a reference that has to be dropped. Also allow NULL to
be returned if the managed cannot have a profile. If it can have one,
get_color_profile() still always returns a profile (either the
assigned one, or a generated built-in one).
2015-09-03 01:36:02 +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 46465b0c0a libgimpcolor: add gimp_color_profile_get_type to gimpcolor.def 2015-07-12 14:22:17 +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 9e76b64f13 Bug 723392 - Pasting an image replaces color profile with default one
gimp_pixbuf_get_icc_profile(): use gdk_pixbuf_get_option() not
g_object_get() to get the pixbuf's profile.
2015-06-30 12:01:06 +02:00
Michael Natterer 4422128ecc libgimpcolor: add gimp_pixbuf_get_icc_profile()
which decodes and returns the pixbuf's base64-encoded "icc-profile"
property.
2015-06-16 23:43:40 +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
Michael Natterer 8005eea835 Remove the "GIMP" from all "Since: GIMP 2.x" API doc comments
because it confuses gtk-doc and breaks some links. Also change the
"Index of new symbols in GIMP 2.x" sections to be what seems to be the
modern standard (looked at the GLib and GTK+ docs), and update some
other stuff.
2015-05-31 21:18:09 +02:00
Michael Natterer 6b40652d07 libgimpcolor: add some missing API docs 2015-05-31 02:47:24 +02:00
Michael Natterer f1c46b3656 libgimpcolor: fix API docs of gimp_rgb[a]_get,set_pixel() 2015-05-31 02:33:38 +02:00
Michael Natterer 2e07e938f4 app, libgimpcolor: never return NULL in GimpColorManaged::get_color_profile() 2015-05-30 22:23:25 +02:00
Michael Natterer cdb3b0aabb libgimpcolor: add GimpColorManaged::get_color_profile()
which returns a GimpColorProfile instead of just an ICC blob like
get_icc_profile(). Also, it will always return a profile, as in
fall back to the built-in profiles automatically.
2015-05-13 00:43:16 +02:00
Michael Natterer ff337409c1 libgimpcolor: add gimp_lcms_add_linear_rgb_profile()
taken from gegl:lcms-from-profile.
2015-05-12 22:47:12 +02:00
Michael Natterer 5255eee0d8 libgimpcolor: add typedef gpointer GimpColorTransform
for publically passing around cmsHTRANSFORM without having to include
lcms.
2015-05-09 00:50:20 +02:00
Michael Natterer e663c947a0 libgimpcolor: add gimp_lcms_get_format()
Which returns an lcms format given a Babl format. It also returns a
Babl format to be used instead of the passed format, but only if lcms
doesn't support the passed format.
2015-05-08 12:52:22 +02:00
Michael Natterer e01f067332 libgimpcolor: add API docs to gimplcms.c 2015-05-07 02:00:33 +02:00
Michael Natterer dcf21efcc2 libgimpcolor: add gimp_lcms_profile_close()
So code that only needs a profile's metadata doesn't need to depend on
lcms2 any longer.
2015-05-06 16:28:45 +02:00
Elle Stone 3925466db5 libgimpcolor: change LUMINANCE Y values to match sRGB built-in profile 2015-02-14 17:40:54 +01:00
Jehan 8c1cd7caac Makefile: fix VPATH builds for win32. 2014-09-14 18:28:26 +02:00
Michael Natterer b7863269f0 libgimpcolor: change gimp_lcms_profile_open_from_file() from filename to GFile
and change most of the lcms plug-in to using GFile too.
2014-07-04 23:57:27 +02:00
Michael Natterer c726ea309a libgimpcolor: deprecate gimp_bilinear_pixels_8() 2014-06-30 18:28:43 +02:00
Michael Natterer 8bb0fa8372 libgimpcolor: deprecate most of gimpcolorspace.[ch]
Only leave the functions undeprecated that work on structs of doubles.
2014-06-30 17:39:15 +02:00
Michael Natterer 614c61a3dd Don't #include <glib.h> before <lcms.h>
The include claimed to be because of "inline" in the lcms header, but
that was probably lcms1, since there is no trace of inline in the
lcms2 header.
2014-04-10 20:48:22 +02:00
Michael Natterer f1223a741a libgimpcolor: move GIMP_LCMS_MD5_DIGEST_LENGTH to the .c file 2014-04-10 20:41:32 +02:00
Michael Natterer ba85bb78ba Bug 727185 - Converting to GIMP built-in sRGB produces the wrong RGB values
Profiles from disk have a lower precision than those created from
scratch via lcms API. Ensure identical profiles by returning a
"loaded" profile from gimp_lcms_create_srgb_profile() (simply do a
save/load roundtrip in memory).
2014-04-10 16:30:04 +02:00
Michael Natterer d7037650df libgimpcolor: add gimp_lcms_profile_get_label()
which returns a string meant to label the profile in the GUI, it's
either the profile's description, its model, or "(unnamed profile)" as
a fallback. Use the function instead of duplicating that logic
inconsistently and imcompletely all over the place.
2014-03-30 03:12:42 +02:00
Michael Natterer 32e47cf70d libgimpcolor: add gimp_lcms_profile_is_equal()
and remove all of our own MD5 digest code and API. is_equal() uses
lcms' own MD5 API which I missed before. Thanks Elle for pointing that
out :)
2014-03-29 10:40:47 +01:00
Michael Natterer b3395d989e libgimpcolor: return an optional MD5 digest from gimp_lcms_create_srgb_profile()
pass NULL in most places, use the feature in the lcms.c plu-gin.
2014-03-23 23:34:47 +01:00
Michael Natterer ddc9c864be libgimpcolor: move the GimpColorProfile typedef to gimpcolortypes.h 2014-03-16 18:36:12 +01:00
Michael Natterer f322be2fac libgimpcolor: add gimp_lcms_profile_open_from_file() and _from_data()
which work just like their lcms counterparts but return an optional
md5 digest of the ICC data and a GError in case opening fails.
2014-03-16 15:57:14 +01:00
Daniel Sabo b54b59c9e8 Use EXTRA_foo_DEPENDENCIES for adding .def files
The foo_DEPENDENCIES rule replaces the default dependencies, where
EXTRA_foo_DEPENDENCIES just appends to it. This was causing libgimp
and libgimpui to build out of order.
2014-03-15 14:23:38 -07:00
Michael Natterer ebc53672cb libgimpcolor: add gimp_lcms_profile_is_rgb() and _is_cmyk()
And change all lcms code to use it.
2014-03-15 21:47:13 +01:00
Michael Natterer 2cdf1985e6 libgimpcolor: add a bunch or information strings to the sRGB profile
so it can be treated like any other profile and needs no special
casing.
2014-03-15 00:09:35 +01:00
Michael Natterer 13ee151a1e libgimp*: use LIBADD and DEPENDENCIES consistently in all Makefiles 2014-03-14 22:39:51 +01:00
Michael Natterer 6f62d6b11b libgimpcolor: add gimp_lcms_profile_get_summary()
Which returns an "executive summary" of the profile, much like lcms1's
"profile info" API. Refactor common code out of the other string
getters.
2014-03-14 20:26:15 +01:00
Michael Natterer cf05b69e1e libgimpcolor: link test-color-parser against libgimpbase 2014-03-14 02:52:59 +01:00
Michael Natterer eee6fa1e4b libgimpcolor: start adding profile utility functions to gimplcms.[ch]
Add functions to get a profile's description, manufacturer, model and
copyright, and use them instead of implementing the same 10 times.

Also add a GimpColorProfile typedef which avoids both having to
include lcms globally or using a gpointer instead (which looks bad and
non-descriptive in an API).
2014-03-14 01:48:39 +01:00
Michael Natterer 76beb20b18 libgimpcolor: rename our sRGB profile to "GIMP built-in sRGB" 2014-03-03 21:45:43 +01:00
Massimo Valentini 9498cc615d Bug 722676: Pasting image from clipboard sometimes does not work.
Change gimp_pixbuf_create_buffer() to copy the pixels if a linear
buffer cannot be created. Add functions that convert between
GimpTempBuf and GdkPixbuf. Fix users of gimp_pixbuf_create_buffer()
to make the least possible copies. Patch modified by Mitch.
2014-02-23 00:49:56 +01:00
Elle Stone 78e2c4808d libgimpcolor: comment out line that makes V2 profile and add more docs 2014-02-16 22:09:46 +01:00
Michael Natterer d4fd13e440 libgimpcolor: add gimp_lcms_create_srgb_profile() to gimpcolor.def 2014-02-09 23:26:19 +01:00
Elle Stone 05c5ca3216 Bug 723787 - Neutral sRGB profile matching Argyllcms sRGB.icm
Add gimp_lcms_create_srgb_profile() to libgimpcolor and use it where
we used to call cmsCreate_sRGBProfile().
2014-02-09 23:10:56 +01:00
Daniel Sabo afc40ffda0 Add automake 1.13+ test outputs to .gitignore 2014-01-10 15:31:34 -08:00
Michael Natterer 697572ccc0 app,libgimp*: fix includes to follow our include policy
- don't include <gdk-pixbuf/gdk-pixbuf.h> in headers in app/
- instead, include it in many .c files instead of <glib-object.h>,
  finally acknowledging the fact that app/ depends on gdk-pixbuf almost
  globally
- fix up includes as if libgimpbase depended in GIO, which it soon will
2013-10-15 01:58:39 +02:00
Mikael Magnusson 6afc29543e app: add gimp_hsl_set_alpha to gimpcolor.def 2013-06-16 20:55:03 +02:00
Mikael Magnusson 1947d8def8 app: avoid reading uninitialized memory
gimp_rgb_to_hsl and hsl_to_rgb reads the a member, so set it before
calling them. Add gimp_hsl_set_alpha() for this purpose.

Found by coverity
2013-06-15 22:40:49 +02:00
Michael Natterer ec786816bb */Makefile.am: merge INCLUDES into AM_CPPFLAGS
automake-1.13 finally warns about this anachronism.
2013-06-05 20:48:37 +02:00
Michael Natterer fe19ad9706 Bug 683694 - Spelling errors
Reworded all places that used to say "allows to".
2012-11-11 15:50:25 +01:00
Michael Natterer 486e76bdab libgimp*: use GIMP_API_VERSION in Makefile.am instead of hardcoding 2.0 2012-05-04 15:38:45 +02:00
Michael Muré b694141eb7 fix compilation of a test 2012-05-03 20:36:28 +09:00
Michael Natterer b3e785e5e5 libgimpcolor: return the right format from gimp_cairo_surface_get_format() 2012-05-03 04:19:41 +02:00
Michael Natterer 00b3a9c745 libgimpcolor: add Cairo <-> GEGL utility functions from app/ 2012-05-03 04:07:16 +02:00
Michael Natterer d766ec6ae9 libgimpcolor: rename gimpcairocolor.[ch] to gimpcairo.[ch] 2012-05-03 03:56:10 +02:00
Michael Natterer 3ad73b3658 libgimpcolor: add GdkPixbuf <-> GeglBuffer utility functions
and update tons of includes in libgimp and app.
2012-05-03 03:37:20 +02:00
Michael Natterer 0d481702c7 libgimp*: add GIMP_DEPRECATED macros using G_DEPRECATED
and start using them instead of GIMP_DISABLE_DEPRECATED where possible.
2012-05-03 00:54:21 +02:00
Martin Nordholts 563d3c10d6 Make 'make check' compile 2012-05-02 21:53:38 +02:00
Michael Natterer 3e119c5af7 libgimpcolor: add gimp_rgb[a]_set,get_pixel()
which converts from/to any pixel format using Babl. Added tons of
includes and CFLAGS now that libgimpcolor publically uses Babl.
2012-05-02 17:50:43 +02:00
Michael Natterer 056e09a6cb Remove the makefile.msc build system, it is unmaintained since 2008 2011-12-16 15:53:56 +01:00
Mukund Sivaraman 5b7cd667f2 libgimpcolor: Add an assert at start of gimp_render_sub_pixel()
This is to replace the old checks which were removed in
commit ff6727ae66.
2011-10-13 10:22:39 +05:30
Mukund Sivaraman ff6727ae66 libgimpcolor: Remove function pointer checks as they're checked by caller
Keeping the checks raises red flags in static analysis as render_func
can then be NULL.
2011-10-12 20:47:23 +05:30
Mukund Sivaraman 4a686eba0f libgimpcolor: Delete unnecessary h initializer
The -Wall warning is taken care of by
commit 890b9abf94.
2011-10-04 14:40:24 +05:30
Mukund Sivaraman 890b9abf94 libgimpcolor: Remove conditions which are always true 2011-10-01 13:15:18 +05:30
Michael Natterer 2b1807054f libgimp*: update .def files after cairo functions moved between libs 2011-05-01 11:24:26 +02:00
Mukund Sivaraman c579ec9754 libgimpcolor: Include cairo.h in test program 2011-04-29 15:00:28 +05:30
Michael Natterer cc47b2a600 libgimpwidgets/color: move the cairo color utility functions to libgimpcolor
Add CAIRO_CFLAGS to a lot of Makefiles to make this possible, and
because they pull in cairo via the libgimp headers.
2011-04-28 15:50:39 +02:00
Michael Natterer 844df2b4df libgimp*: add guards that #error out if individual files are included
This only helps to maintain proper includes in app/ and shouldn't
affect plug-ins at all, because these are supposed to only include the
main headers from libgimp/ since the beginning of time.

The gimpfootypes.h files do not have these guards, so we can continue
to maintain app/'s include policy that is very likely to error out if
wrong things are included.
2011-04-28 14:30:41 +02:00
Martin Nordholts 0dc4b5de72 Fix a bunch of warnings 2010-08-31 22:46:36 +02:00
Michael Natterer 7b335188b6 libgimpcolor: fix most gtk-doc warnings 2010-06-29 20:08:39 +02:00