Re: [Gimp-developer] Displaying linear gamma images



You should bug mitch or me IRC for faster responses :).

Issues with this code:
Don't modify the buffer you got from gimp_pickable_get_buffer
(GIMP_PICKABLE (projection)), it's a live part of the projection.

Adding the buffer to the iterator twice probably doesn't do what you want
it to do. Depending on the format pointers may be to the same buffer, so
writing may immediately modify your read buffer, or it may not. Use
READWRITE if interacting with the same buffer twice.

For best results you should be writing to the cairo image in xfer. The call
of gegl_buffer_get wirting to xfer *is* the gamma conversion, you want to
replace it completely. Alternativly you could create a temp gegl buffer
here and then use buffer_get from that to write to xfer.

Finally, you need to detect weather the projection's format is linear or
gamma and read in that, rather than always using "R'G'B'A float". Using
gimp_drawable_get_linear is probably sufficient for now.



On Thu, Sep 12, 2013 at 9:12 AM, Jon Nordby <jononor gmail com> wrote:

On 12 September 2013 16:08, Elle Stone <l elle stone gmail com> wrote:
I've made progress getting a linear gamma image to display without
posterization in the shadows. I put up a temporary web page with the
modified code and a picture:
http://ninedegreesbelow.com/temp/convert-buffer-before-cairo.html

The problem at this point is that the image won't display properly
until something like doing a very small levels correction forces a
screen redraw. After forcing a screen redraw, the image is displayed
without any posterization, but with magenta lines (outlining the
tiles?). The screen redraw lasts until the level dialog is closed.

I think the problem is that I'm not properly merging and updating
"buffer" after the hard-coded transform. The corresponding code from
the lcms.c file uses layer buffers, which seems not applicable to a
projection:
gimp_drawable_merge_shadow (layer_id, TRUE);
gimp_drawable_update (layer_id, 0, 0, layer_width, layer_height);

I do not know the GimpDisplayShell code well, but try to just read out
data from the projection GeglBuffer instead of modifying it. And
instead of the the "gegl_buffer_get (buffer, ... "cairo-ARGB32", ...
data ...)" that you have marked, do the lcms transform such that the
8bit ready-for-display ends up in the "data" buffer.

Also, can you please post your changes as a (git formatted) diff?
It is much easier to read and apply for another contributor trying to
help you out.

--
Jon Nordby - www.jonnor.com



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