emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/src/xfns.c


From: Richard M. Stallman
Subject: [Emacs-diffs] Changes to emacs/src/xfns.c
Date: Sun, 03 Mar 2002 15:07:42 -0500

Index: emacs/src/xfns.c
diff -c emacs/src/xfns.c:1.539 emacs/src/xfns.c:1.540
*** emacs/src/xfns.c:1.539      Fri Feb 22 08:14:27 2002
--- emacs/src/xfns.c    Sun Mar  3 15:07:42 2002
***************
*** 9034,9057 ****
        || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
      png_set_gray_to_rgb (png_ptr);
  
!   /* The value 2.2 is a guess for PC monitors from PNG example.c.  */
!   gamma_str = getenv ("SCREEN_GAMMA");
!   screen_gamma = gamma_str ? atof (gamma_str) : 2.2;
  
    /* Tell the PNG lib to handle gamma correction for us.  */
  
  #if defined(PNG_READ_sRGB_SUPPORTED) || defined(PNG_WRITE_sRGB_SUPPORTED)
    if (png_get_sRGB (png_ptr, info_ptr, &intent))
!     /* There is a special chunk in the image specifying the gamma.  */
!     png_set_sRGB (png_ptr, info_ptr, intent);
    else
  #endif
    if (png_get_gAMA (png_ptr, info_ptr, &image_gamma))
      /* Image contains gamma information.  */
      png_set_gamma (png_ptr, screen_gamma, image_gamma);
    else
!     /* Use a default of 0.5 for the image gamma.  */
!     png_set_gamma (png_ptr, screen_gamma, 0.5);
  
    /* Handle alpha channel by combining the image with a background
       color.  Do this only if a real alpha channel is supplied.  For
--- 9034,9055 ----
        || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
      png_set_gray_to_rgb (png_ptr);
  
!   screen_gamma = (f->gamma ? 1 / f->gamma / 0.45455 : 2.2);
  
    /* Tell the PNG lib to handle gamma correction for us.  */
  
  #if defined(PNG_READ_sRGB_SUPPORTED) || defined(PNG_WRITE_sRGB_SUPPORTED)
    if (png_get_sRGB (png_ptr, info_ptr, &intent))
!     /* The libpng documentation says this is right in this case.  */
!     png_set_gamma (png_ptr, screen_gamma, 0.45455);
    else
  #endif
    if (png_get_gAMA (png_ptr, info_ptr, &image_gamma))
      /* Image contains gamma information.  */
      png_set_gamma (png_ptr, screen_gamma, image_gamma);
    else
!     /* Use the standard default for the image gamma.  */
!     png_set_gamma (png_ptr, screen_gamma, 0.45455);
  
    /* Handle alpha channel by combining the image with a background
       color.  Do this only if a real alpha channel is supplied.  For



reply via email to

[Prev in Thread] Current Thread [Next in Thread]