Re: [Gimp-developer] Displaying linear gamma images



Hi Jon, Daniel, all,

On 9/10/13, Daniel Sabo <danielsabo gmail com> wrote:
The conversion happens in app/display/gimpdisplayshell-render.c :
gimp_display_shell_render() .
Look for the gegl_buffer_get call that converts to babl_format
("cairo-ARGB32").

On 9/11/13, Jon Nordby <jononor gmail com> wrote:
Quoting Jon's suggestion:
(1)call a "GeglBuffer from the projection (or possibly a copy)" and then
So how does one "call a GeglBuffer from the projection"?

I said "operate on", not "call". :)

Sorry!

The projection has a GeglBuffer associated with it, see
https://git.gnome.org/browse/gimp/tree/app/display/gimpdisplayshell-render.c#n77
That is what the color conversion needs to use as an input, basically*.

I set up a babl/gegl/gimp prefix for working on this issue and wrote a
function that creates a hard-coded ICC profile transform:

static void image_to_monitor ()
{
  cmsHTRANSFORM    image_to_monitor_transform   = NULL;
  cmsHPROFILE image_space;
  cmsHPROFILE monitor_profile;
  image_space =
cmsOpenProfileFromFile("/usr/share/color/icc/V4/AllColors-elleV4-g100.icc","r");
  monitor_profile =
cmsOpenProfileFromFile("/usr/share/color/icc/monitor-as-qh.icc","r");
  image_to_monitor_transform = cmsCreateTransform (image_space,  TYPE_RGBA_FLT,
                                  monitor_profile, TYPE_RGBA_8,
                                  INTENT_RELATIVE_COLORIMETRIC,
                                  cmsFLAGS_NOOPTIMIZE |
                                  cmsFLAGS_BLACKPOINTCOMPENSATION );
  if (image_to_monitor_transform)
  {printf("Image_to_monitor_transform WAS created in
display-filter-lcms.c.\n");}
  else {printf("Image_to_monitor_transform was NOT created in
display-filter-lcms.c.\n");}
}

The purpose of this function is (eventually) to be able to convert the
projection from the image profile to the monitor profile without
bringing in all the overhead that allows Gimp to detect which profile
is which. The overhead can be added later. That's my theory, anyway.

To go along with this hard-coded transform, I made a 32-bit floating
point image with an alpha channel. So in my dedicated prefix version
of Gimp, that's the only image that gets opened.

My first goal was to get the "image_to_monitor" function to work, not
to do anything with it, just to get evidence that the transform was
created.

I put the "image_to_monitor" function in "display-filter-lcms.c" and
added this line - "image_to_monitor ();" - to the function
"cdisplay_lcms_convert_surface". Gimp compiles and runs just fine,
printing out lines that the transform was indeed created.

I also added the exact same "image_to_monitor" function to the file
"gimpdisplayshell-render.c", except modified so that the printf lines
say "WAS/was NOT created in gimpdisplayshell-render.c". Again, Gimp
compiles and runs with no problems, but no lines are printed from this
function because at this point it isn't called by the function
"gimp_display_shell_render".

Unfortunately, as soon as I add the line "image_to_monitor ();" to the
function "gimp_display_shell_render", then Gimp won't compile, but
rather exits with these lines:

make[4]: Leaving directory `/home/elle/code/gimp292/build/gimp/app/gui'
Making all in .
make[4]: Entering directory `/home/elle/code/gimp292/build/gimp/app'
  CCLD   gimp-2.9
display/libappdisplay.a(gimpdisplayshell-render.o): In function
`image_to_monitor':
/home/elle/code/gimp292/build/gimp/app/display/gimpdisplayshell-render.c:79:
undefined reference to `cmsOpenProfileFromFile'
/home/elle/code/gimp292/build/gimp/app/display/gimpdisplayshell-render.c:80:
undefined reference to `cmsOpenProfileFromFile'
/home/elle/code/gimp292/build/gimp/app/display/gimpdisplayshell-render.c:81:
undefined reference to `cmsCreateTransform'

Any ideas as to why Gimp won't compile when I add the line
"image_to_monitor ();" to the function "gimp_display_shell_render"?
It's pretty obvious that it's not finding lcms2.h. But I did add the
following "#include" lines to the top of gimpdisplayshell-render.c:

#include <glib.h>  /* lcms.h uses the "inline" keyword */
#include <string.h>
#include <lcms2.h>

Suggestions regarding other/better ways to approach the problem are
also welcome!

Elle


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]