unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David.Kastrup@t-online.de (David Kastrup)
Cc: emacs-devel@gnu.org
Subject: Re: PNG pictures have gamma correction twice applied
Date: Thu, 5 Dec 2002 16:34:31 +0100	[thread overview]
Message-ID: <200212051534.gB5FYVip008794@localhost.localdomain> (raw)
In-Reply-To: E18JxcX-0007Vm-00@fencepost.gnu.org

Richard Stallman <rms@gnu.org> writes:

>     It would appear that you have lost track of the discussion a bit.
> 
> This discussion is about the problem of double gamma correction that
> you reported.  By all means raise other issues if you wish, but they
> were not raised in a clear way before your latest message.
> 
>       The double gamma correction issue
>     is only a side aspect, "fixed" easily enough.
> 
> In that case, how about if we fix that now?  At least we will get
> correct display.  The other present problems seem (from all I can tell
> from your message) to cause only slowness.

With several orders of magnitude.  That is entirely unnecessary on
direct color displays.  On paletted displays, Emacs will cause color
hogging: it allocates colors and never frees any of them.

I am thinking about how to arrive at a usable solution.  Since Emacs
uses a toolbar by default, one can't really claim that image display
is a special case.

The standard manner in X to avoid color hogging is to allocate a
standard palette read-only that other applications would also be
using.  The color resolution of such a palette is coarse, so Stefan
objected that such a solution would, in contrast to the current
approach, not permit accurate representation of text colors.

One problem with the current approach is that there is no tracking
about what colors get used where: even if a color is no longer in use
on the display, its palette entry will remain permanently allocated.
While one could also imagine a mixed model, where a basic color set
was allocated in standard color maps, and text colors in addition
allocated color entries of their own, this would still imply that the
use of colors in on-screen objects should be tracked in order to be
able to free unused color slots again.  From what I have seen from the
current code base, I would consider this very hard to do.  For that
reason, it would have been my proposal to implement this using a fixed
colormap in general, also for text colors, with the resulting loss of
exact color representation on 8bit displays taken as a tribute to a
faster and more sane implementation in general.  The current
degenerate solution may be kept as a backup measure if not even a
standard palette is allocatable when Emacs gets started, but the
display will be pretty defective in colors in that case, anyway.

A further complication in the treatment of gamma correction is that
it is a frame-local variable.  This means that the same image may
need different Ximages to render on different frames, and that
changing the screen-gamma of a frame implies reevaluating all
objects' colors in the frame.  Probably a general redraw would be
appropriate in that case.  Color hashing and structures currently, as
far as I can make out, do not take into account that on different
frames the same text may have to render in different colors due to
gamma correction, but I have only glanced over this up to now.

In short, getting Emacs to handle colors in anything even approaching
sanity and consistence requires some work yet.

> 
>     That would be trivially solved by ripping out the gamma correction
>     the PNG library does.
> 
> We don't want to change the PNG library.  We want to use it
> unmodified.  Can you find a solution to this one problem
> that invoves changing Emacs and not the PNG library?

That's what I meant.  Emacs currently tells the PNG explicitly what
gamma factor it is assuming for its screen, and the PNGs get then
rendered for that gamma factor, which Emacs later corrects again.

Keeping the screen gamma secret from the PNG library will make only
Emacs do this correction.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

  reply	other threads:[~2002-12-05 15:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200211061556.gA6FuCU6005082@localhost.localdomain>
2002-11-07 15:08 ` PNG pictures have gamma correction twice applied Richard Stallman
2002-11-09 22:40   ` David Kastrup
2002-11-11 10:20     ` Richard Stallman
2002-11-30 13:36       ` David Kastrup
2002-12-03 14:59         ` Richard Stallman
2002-12-03 15:21           ` David Kastrup
2002-12-05 15:08             ` Richard Stallman
2002-12-05 15:34               ` David Kastrup [this message]
2002-12-05 17:31               ` David Kastrup
2002-12-06 15:52                 ` Richard Stallman
2002-12-06 16:01                   ` David Kastrup
2002-11-11 16:58     ` Stefan Monnier
2002-11-11 17:30       ` David Kastrup
2002-11-11 17:43         ` Stefan Monnier
2002-11-18 11:31           ` David Kastrup

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200212051534.gB5FYVip008794@localhost.localdomain \
    --to=david.kastrup@t-online.de \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).