emacs-diffs
[Top][All Lists]
Advanced

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

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


From: Juanma Barranquero
Subject: [Emacs-diffs] Changes to emacs/src/w32fns.c
Date: Fri, 31 Jan 2003 05:59:14 -0500

Index: emacs/src/w32fns.c
diff -c emacs/src/w32fns.c:1.205 emacs/src/w32fns.c:1.206
*** emacs/src/w32fns.c:1.205    Fri Jan 31 02:20:13 2003
--- emacs/src/w32fns.c  Fri Jan 31 05:59:13 2003
***************
*** 12621,12626 ****
--- 12621,12648 ----
    NULL
  };
  
+ /* TIFF library details.  */
+ DEF_IMGLIB_FN (TIFFSetErrorHandler);
+ DEF_IMGLIB_FN (TIFFSetWarningHandler);
+ DEF_IMGLIB_FN (TIFFOpen);
+ DEF_IMGLIB_FN (TIFFClientOpen);
+ DEF_IMGLIB_FN (TIFFGetField);
+ DEF_IMGLIB_FN (TIFFReadRGBAImage);
+ DEF_IMGLIB_FN (TIFFClose);
+ 
+ static int
+ init_tiff_functions (library)
+      HMODULE library;
+ {
+   LOAD_IMGLIB_FN (library, TIFFSetErrorHandler);
+   LOAD_IMGLIB_FN (library, TIFFSetWarningHandler);
+   LOAD_IMGLIB_FN (library, TIFFOpen);
+   LOAD_IMGLIB_FN (library, TIFFClientOpen);
+   LOAD_IMGLIB_FN (library, TIFFGetField);
+   LOAD_IMGLIB_FN (library, TIFFReadRGBAImage);
+   LOAD_IMGLIB_FN (library, TIFFClose);
+   return 1;
+ }
  
  /* Return non-zero if OBJECT is a valid TIFF image specification.  */
  
***************
*** 12800,12807 ****
    file = Qnil;
    GCPRO1 (file);
  
!   TIFFSetErrorHandler (tiff_error_handler);
!   TIFFSetWarningHandler (tiff_warning_handler);
  
    if (NILP (specified_data))
      {
--- 12822,12829 ----
    file = Qnil;
    GCPRO1 (file);
  
!   fn_TIFFSetErrorHandler (tiff_error_handler);
!   fn_TIFFSetWarningHandler (tiff_warning_handler);
  
    if (NILP (specified_data))
      {
***************
*** 12815,12821 ****
        }
  
        /* Try to open the image file.  */
!       tiff = TIFFOpen (SDATA (file), "r");
        if (tiff == NULL)
        {
          image_error ("Cannot open `%s'", file, Qnil);
--- 12837,12843 ----
        }
  
        /* Try to open the image file.  */
!       tiff = fn_TIFFOpen (SDATA (file), "r");
        if (tiff == NULL)
        {
          image_error ("Cannot open `%s'", file, Qnil);
***************
*** 12830,12843 ****
        memsrc.len = SBYTES (specified_data);
        memsrc.index = 0;
  
!       tiff = TIFFClientOpen ("memory_source", "r", &memsrc,
!                            (TIFFReadWriteProc) tiff_read_from_memory,
!                            (TIFFReadWriteProc) tiff_write_from_memory,
!                            tiff_seek_in_memory,
!                            tiff_close_memory,
!                            tiff_size_of_memory,
!                            tiff_mmap_memory,
!                            tiff_unmap_memory);
  
        if (!tiff)
        {
--- 12852,12865 ----
        memsrc.len = SBYTES (specified_data);
        memsrc.index = 0;
  
!       tiff = fn_TIFFClientOpen ("memory_source", "r", &memsrc,
!                                 (TIFFReadWriteProc) tiff_read_from_memory,
!                                 (TIFFReadWriteProc) tiff_write_from_memory,
!                                 tiff_seek_in_memory,
!                                 tiff_close_memory,
!                                 tiff_size_of_memory,
!                                 tiff_mmap_memory,
!                                 tiff_unmap_memory);
  
        if (!tiff)
        {
***************
*** 12849,12860 ****
  
    /* Get width and height of the image, and allocate a raster buffer
       of width x height 32-bit values.  */
!   TIFFGetField (tiff, TIFFTAG_IMAGEWIDTH, &width);
!   TIFFGetField (tiff, TIFFTAG_IMAGELENGTH, &height);
    buf = (uint32 *) xmalloc (width * height * sizeof *buf);
  
!   rc = TIFFReadRGBAImage (tiff, width, height, buf, 0);
!   TIFFClose (tiff);
    if (!rc)
      {
        image_error ("Error reading TIFF image `%s'", img->spec, Qnil);
--- 12871,12882 ----
  
    /* Get width and height of the image, and allocate a raster buffer
       of width x height 32-bit values.  */
!   fn_TIFFGetField (tiff, TIFFTAG_IMAGEWIDTH, &width);
!   fn_TIFFGetField (tiff, TIFFTAG_IMAGELENGTH, &height);
    buf = (uint32 *) xmalloc (width * height * sizeof *buf);
  
!   rc = fn_TIFFReadRGBAImage (tiff, width, height, buf, 0);
!   fn_TIFFClose (tiff);
    if (!rc)
      {
        image_error ("Error reading TIFF image `%s'", img->spec, Qnil);
***************
*** 12871,12878 ****
--- 12893,12902 ----
        return 0;
      }
  
+ #if 0 /* TODO: Color tables.  */
    /* Initialize the color table.  */
    init_color_table ();
+ #endif
  
    /* Process the pixel raster.  Origin is in the lower-left corner.  */
    for (y = 0; y < height; ++y)
***************
*** 12882,12897 ****
        for (x = 0; x < width; ++x)
        {
          uint32 abgr = row[x];
!         int r = TIFFGetR (abgr) << 8;
!         int g = TIFFGetG (abgr) << 8;
!         int b = TIFFGetB (abgr) << 8;
          XPutPixel (ximg, x, height - 1 - y, lookup_rgb_color (f, r, g, b));
        }
      }
  
    /* Remember the colors allocated for the image.  Free the color table.  */
    img->colors = colors_in_color_table (&img->ncolors);
    free_color_table ();
  
    img->width = width;
    img->height = height;
--- 12906,12927 ----
        for (x = 0; x < width; ++x)
        {
          uint32 abgr = row[x];
!         int r = TIFFGetR (abgr);
!         int g = TIFFGetG (abgr);
!         int b = TIFFGetB (abgr);
! #if 0 /* TODO: Color tables.  */
          XPutPixel (ximg, x, height - 1 - y, lookup_rgb_color (f, r, g, b));
+ #else
+           XPutPixel (ximg, x, height - 1 - y, PALETTERGB (r, g, b));
+ #endif
        }
      }
  
+ #if 0 /* TODO: Color tables.  */
    /* Remember the colors allocated for the image.  Free the color table.  */
    img->colors = colors_in_color_table (&img->ncolors);
    free_color_table ();
+ #endif
  
    img->width = width;
    img->height = height;
***************
*** 15719,15725 ****
  #endif
  
  #if HAVE_TIFF
!   define_image_type (&tiff_type);
  #endif
  
  #if HAVE_GIF
--- 15749,15759 ----
  #endif
  
  #if HAVE_TIFF
!   if (library = LoadLibrary ("libtiff.dll"))
!     {
!       if (init_tiff_functions (library))
!         define_image_type (&tiff_type);
!     }
  #endif
  
  #if HAVE_GIF




reply via email to

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