(image-type): New variable.
(image-mode): Set default major mode name to "Image[text]".
(image-minor-mode): Change LIGHTER to display image-type in the
mode line.
(image-minor-mode): Set default image-type to "text".
(image-toggle-display): After switching to text mode, set
image-type to "text" and major mode name to "Image[text]".
After switching to image mode, set image-type to actual image
type, and add image type to major mode name. Let-bind the same
variable names as arguments of `image-type' and `create-image'.
Bind `type' to the result of `image-type' and use it as arg
of `create-image' to not determine the image type twice.
line source
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Functions for image support on window system.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Free Software Foundation, Inc.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 This file is part of GNU Emacs.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GNU Emacs is free software; you can redistribute it and/or modify
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 it under the terms of the GNU General Public License as published by
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 the Free Software Foundation; either version 3, or (at your option)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 any later version.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GNU Emacs is distributed in the hope that it will be useful,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 but WITHOUT ANY WARRANTY; without even the implied warranty of
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GNU General Public License for more details.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 You should have received a copy of the GNU General Public License
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 along with GNU Emacs; see the file COPYING. If not, write to
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Boston, MA 02110-1301, USA. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include <config.h>
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include <stdio.h>
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include <math.h>
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include <ctype.h>
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_UNISTD_H
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include <unistd.h>
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* This makes the fields of a Display accessible, in Xlib header files. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define XLIB_ILLEGAL_ACCESS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include "lisp.h"
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include "frame.h"
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include "window.h"
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include "dispextern.h"
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include "blockinput.h"
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include "systime.h"
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include <epaths.h>
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include "charset.h"
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include "coding.h"
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_X_WINDOWS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include "xterm.h"
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include <sys/types.h>
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include <sys/stat.h>
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define COLOR_TABLE_SUPPORT 1
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 typedef struct x_bitmap_record Bitmap_Record;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define GET_PIXEL(ximg, x, y) XGetPixel(ximg, x, y)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define NO_PIXMAP None
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define RGB_PIXEL_COLOR unsigned long
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define PIX_MASK_RETAIN 0
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define PIX_MASK_DRAW 1
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_X_WINDOWS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include "w32term.h"
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* W32_TODO : Color tables on W32. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #undef COLOR_TABLE_SUPPORT
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 typedef struct w32_bitmap_record Bitmap_Record;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define GET_PIXEL(ximg, x, y) GetPixel(ximg, x, y)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define NO_PIXMAP 0
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define RGB_PIXEL_COLOR COLORREF
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define PIX_MASK_RETAIN 0
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define PIX_MASK_DRAW 1
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define FRAME_X_VISUAL(f) FRAME_X_DISPLAY_INFO (f)->visual
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define x_defined_color w32_defined_color
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define DefaultDepthOfScreen(screen) (one_w32_display_info.n_cbits)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef MAC_OS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include "macterm.h"
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include <sys/stat.h>
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifndef MAC_OSX
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include <alloca.h>
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include <sys/param.h>
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if TARGET_API_MAC_CARBON
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef MAC_OSX
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include <QuickTime/QuickTime.h>
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else /* not MAC_OSX */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include <QuickTime.h>
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* not MAC_OSX */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else /* not TARGET_API_MAC_CARBON */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include <Windows.h>
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include <Gestalt.h>
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include <TextUtils.h>
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include <ImageCompression.h>
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include <QuickTimeComponents.h>
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* not TARGET_API_MAC_CARBON */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* MAC_TODO : Color tables on Mac. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #undef COLOR_TABLE_SUPPORT
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define ZPixmap 0 /* arbitrary */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 typedef struct mac_bitmap_record Bitmap_Record;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define GET_PIXEL(ximg, x, y) XGetPixel(ximg, x, y)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define NO_PIXMAP 0
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define RGB_PIXEL_COLOR unsigned long
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* A black pixel in a mask bitmap/pixmap means ``draw a source
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pixel''. A white pixel means ``retain the current pixel''. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define PIX_MASK_DRAW RGB_TO_ULONG(0,0,0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define PIX_MASK_RETAIN RGB_TO_ULONG(255,255,255)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define FRAME_X_VISUAL(f) FRAME_X_DISPLAY_INFO (f)->visual
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define x_defined_color mac_defined_color
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define DefaultDepthOfScreen(screen) (one_mac_display_info.n_planes)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* MAC_OS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Search path for bitmap files. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object Vx_bitmap_file_path;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void x_disable_image P_ ((struct frame *, struct image *));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void x_edge_detection P_ ((struct frame *, struct image *, Lisp_Object,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void init_color_table P_ ((void));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static unsigned long lookup_rgb_color P_ ((struct frame *f, int r, int g, int b));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef COLOR_TABLE_SUPPORT
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void free_color_table P_ ((void));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static unsigned long *colors_in_color_table P_ ((int *n));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static unsigned long lookup_pixel_color P_ ((struct frame *f, unsigned long p));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Code to deal with bitmaps. Bitmaps are referenced by their bitmap
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 id, which is just an int that this section returns. Bitmaps are
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 reference counted so they can be shared among frames.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Bitmap indices are guaranteed to be > 0, so a negative number can
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 be used to indicate no bitmap.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 If you use x_create_bitmap_from_data, then you must keep track of
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 the bitmaps yourself. That is, creating a bitmap from the same
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 data more than once will not be caught. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef MAC_OS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static XImagePtr
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XGetImage (display, pixmap, x, y, width, height, plane_mask, format)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Display *display; /* not used */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Pixmap pixmap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int x, y; /* not used */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned int width, height; /* not used */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long plane_mask; /* not used */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int format; /* not used */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if GLYPH_DEBUG
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xassert (x == 0 && y == 0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Rect ri, rp;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SetRect (&ri, 0, 0, width, height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xassert (EqualRect (&ri, GetPixBounds (GetGWorldPixMap (pixmap), &rp)));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xassert (! (pixelsLocked & GetPixelsState (GetGWorldPixMap (pixmap))));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LockPixels (GetGWorldPixMap (pixmap));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return pixmap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPutPixel (ximage, x, y, pixel)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImagePtr ximage;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int x, y;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long pixel;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PixMapHandle pixmap = GetGWorldPixMap (ximage);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 short depth = GetPixDepth (pixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (WORDS_BIG_ENDIAN) || !USE_CG_DRAWING
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (depth == 32)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char *base_addr = GetPixBaseAddr (pixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 short row_bytes = GetPixRowBytes (pixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ((unsigned long *) (base_addr + y * row_bytes))[x] = 0xff000000 | pixel;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (depth == 1)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char *base_addr = GetPixBaseAddr (pixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 short row_bytes = GetPixRowBytes (pixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (pixel == PIX_MASK_DRAW)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 base_addr[y * row_bytes + x / 8] |= (1 << 7) >> (x & 7);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 base_addr[y * row_bytes + x / 8] &= ~((1 << 7) >> (x & 7));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CGrafPtr old_port;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GDHandle old_gdh;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 RGBColor color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GetGWorld (&old_port, &old_gdh);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SetGWorld (ximage, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color.red = RED16_FROM_ULONG (pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color.green = GREEN16_FROM_ULONG (pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color.blue = BLUE16_FROM_ULONG (pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SetCPixel (x, y, &color);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SetGWorld (old_port, old_gdh);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static unsigned long
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XGetPixel (ximage, x, y)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImagePtr ximage;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int x, y;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PixMapHandle pixmap = GetGWorldPixMap (ximage);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 short depth = GetPixDepth (pixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (WORDS_BIG_ENDIAN) || !USE_CG_DRAWING
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (depth == 32)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char *base_addr = GetPixBaseAddr (pixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 short row_bytes = GetPixRowBytes (pixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return ((unsigned long *) (base_addr + y * row_bytes))[x] & 0x00ffffff;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (depth == 1)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char *base_addr = GetPixBaseAddr (pixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 short row_bytes = GetPixRowBytes (pixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (base_addr[y * row_bytes + x / 8] & (1 << (~x & 7)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return PIX_MASK_DRAW;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return PIX_MASK_RETAIN;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CGrafPtr old_port;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GDHandle old_gdh;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 RGBColor color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GetGWorld (&old_port, &old_gdh);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SetGWorld (ximage, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GetCPixel (x, y, &color);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SetGWorld (old_port, old_gdh);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return RGB_TO_ULONG (color.red >> 8, color.green >> 8, color.blue >> 8);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XDestroyImage (ximg)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImagePtr ximg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UnlockPixels (GetGWorldPixMap (ximg));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if USE_CG_DRAWING
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static CGImageRef
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 mac_create_cg_image_from_image (f, img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Pixmap mask;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CGImageRef result = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 BLOCK_INPUT;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (img->mask)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 mask = img->mask;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 mask = XCreatePixmap (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->width, img->height, 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (mask)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CGrafPtr old_port;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GDHandle old_gdh;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Rect r;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GetGWorld (&old_port, &old_gdh);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SetGWorld (mask, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 BackColor (blackColor); /* Don't mask. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SetRect (&r, 0, 0, img->width, img->height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 EraseRect (&r);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SetGWorld (old_port, old_gdh);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (mask)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CreateCGImageFromPixMaps (GetGWorldPixMap (img->pixmap),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GetGWorldPixMap (mask), &result);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (mask != img->mask)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XFreePixmap (FRAME_X_DISPLAY (f), mask);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNBLOCK_INPUT;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return result;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* USE_CG_DRAWING */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* MAC_OS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Functions to access the contents of a bitmap, given an id. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_bitmap_height (f, id)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FRAME_PTR f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int id;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_bitmap_width (f, id)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FRAME_PTR f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int id;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].width;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_bitmap_pixmap (f, id)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FRAME_PTR f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int id;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return (int) FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_X_WINDOWS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_bitmap_mask (f, id)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FRAME_PTR f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int id;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].mask;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Allocate a new bitmap record. Returns index of new record. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_allocate_bitmap_record (f)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FRAME_PTR f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (dpyinfo->bitmaps == NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps_size = 10;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 = (Bitmap_Record *) xmalloc (dpyinfo->bitmaps_size * sizeof (Bitmap_Record));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps_last = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (dpyinfo->bitmaps_last < dpyinfo->bitmaps_size)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return ++dpyinfo->bitmaps_last;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = 0; i < dpyinfo->bitmaps_size; ++i)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (dpyinfo->bitmaps[i].refcount == 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return i + 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps_size *= 2;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 = (Bitmap_Record *) xrealloc (dpyinfo->bitmaps,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps_size * sizeof (Bitmap_Record));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return ++dpyinfo->bitmaps_last;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Add one reference to the reference count of the bitmap with id ID. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_reference_bitmap (f, id)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FRAME_PTR f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int id;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ++FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].refcount;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Create a bitmap for frame F from a HEIGHT x WIDTH array of bits at BITS. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_create_bitmap_from_data (f, bits, width, height)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char *bits;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned int width, height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int id;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_X_WINDOWS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Pixmap bitmap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bitmap = XCreateBitmapFromData (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bits, width, height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (! bitmap)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return -1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_X_WINDOWS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Pixmap bitmap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bitmap = CreateBitmap (width, height,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FRAME_X_DISPLAY_INFO (XFRAME (frame))->n_planes,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FRAME_X_DISPLAY_INFO (XFRAME (frame))->n_cbits,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bits);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (! bitmap)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return -1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef MAC_OS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* MAC_TODO: for now fail if width is not mod 16 (toolbox requires it) */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (width % 16 != 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return -1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 id = x_allocate_bitmap_record (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef MAC_OS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].bitmap_data = (char *) xmalloc (height * width);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bcopy (bits, dpyinfo->bitmaps[id - 1].bitmap_data, height * width);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* MAC_OS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].file = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].height = height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].width = width;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].refcount = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_X_WINDOWS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].pixmap = bitmap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].have_mask = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].depth = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_X_WINDOWS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].pixmap = bitmap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].hinst = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].depth = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return id;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Create bitmap from file FILE for frame F. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_create_bitmap_from_file (f, file)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object file;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef MAC_OS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return -1; /* MAC_TODO : bitmap support */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* MAC_OS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return -1; /* W32_TODO : bitmap support */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_X_WINDOWS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned int width, height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Pixmap bitmap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int xhot, yhot, result, id;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object found;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int fd;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char *filename;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Look for an existing bitmap with the same name. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (id = 0; id < dpyinfo->bitmaps_last; ++id)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (dpyinfo->bitmaps[id].refcount
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && dpyinfo->bitmaps[id].file
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && !strcmp (dpyinfo->bitmaps[id].file, (char *) SDATA (file)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ++dpyinfo->bitmaps[id].refcount;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return id + 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Search bitmap-file-path for the file, if appropriate. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fd = openp (Vx_bitmap_file_path, file, Qnil, &found, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (fd < 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return -1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 emacs_close (fd);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 filename = (char *) SDATA (found);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 result = XReadBitmapFile (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 filename, &width, &height, &bitmap, &xhot, &yhot);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (result != BitmapSuccess)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return -1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 id = x_allocate_bitmap_record (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].pixmap = bitmap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].have_mask = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].refcount = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (SBYTES (file) + 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].depth = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].height = height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].width = width;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 strcpy (dpyinfo->bitmaps[id - 1].file, SDATA (file));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return id;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_X_WINDOWS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Free bitmap B. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Free_Bitmap_Record (dpyinfo, bm)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Display_Info *dpyinfo;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Bitmap_Record *bm;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_X_WINDOWS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XFreePixmap (dpyinfo->display, bm->pixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (bm->have_mask)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XFreePixmap (dpyinfo->display, bm->mask);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_X_WINDOWS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DeleteObject (bm->pixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef MAC_OS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (bm->bitmap_data); /* Added ++kfs */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bm->bitmap_data = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* MAC_OS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (bm->file)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (bm->file);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bm->file = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Remove reference to bitmap with id number ID. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_bitmap (f, id)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FRAME_PTR f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int id;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (id > 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Bitmap_Record *bm = &dpyinfo->bitmaps[id - 1];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (--bm->refcount == 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 BLOCK_INPUT;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Free_Bitmap_Record (dpyinfo, bm);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNBLOCK_INPUT;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Free all the bitmaps for the display specified by DPYINFO. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_all_bitmaps (dpyinfo)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Display_Info *dpyinfo;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Bitmap_Record *bm = dpyinfo->bitmaps;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = 0; i < dpyinfo->bitmaps_last; i++, bm++)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (bm->refcount > 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Free_Bitmap_Record (dpyinfo, bm);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps_last = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_X_WINDOWS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Useful functions defined in the section
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 `Image type independent image structures' below. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static unsigned long four_corners_best P_ ((XImagePtr ximg,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int *corners,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long width,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long height));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int x_create_x_image_and_pixmap P_ ((struct frame *f, int width, int height,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int depth, XImagePtr *ximg,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Pixmap *pixmap));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void x_destroy_x_image P_ ((XImagePtr ximg));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Create a mask of a bitmap. Note is this not a perfect mask.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 It's nicer with some borders in this context */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_create_bitmap_mask (f, id)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int id;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Pixmap pixmap, mask;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImagePtr ximg, mask_img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long width, height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int result;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long bg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long x, y, xp, xm, yp, ym;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GC gc;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!(id > 0))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return -1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pixmap = x_bitmap_pixmap (f, id);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 width = x_bitmap_width (f, id);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 height = x_bitmap_height (f, id);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 BLOCK_INPUT;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ximg = XGetImage (FRAME_X_DISPLAY (f), pixmap, 0, 0, width, height,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ~0, ZPixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!ximg)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNBLOCK_INPUT;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return -1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 result = x_create_x_image_and_pixmap (f, width, height, 1, &mask_img, &mask);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNBLOCK_INPUT;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!result)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XDestroyImage (ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return -1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bg = four_corners_best (ximg, NULL, width, height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (y = 0; y < ximg->height; ++y)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (x = 0; x < ximg->width; ++x)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xp = x != ximg->width - 1 ? x + 1 : 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xm = x != 0 ? x - 1 : ximg->width - 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 yp = y != ximg->height - 1 ? y + 1 : 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ym = y != 0 ? y - 1 : ximg->height - 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (XGetPixel (ximg, x, y) == bg
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && XGetPixel (ximg, x, yp) == bg
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && XGetPixel (ximg, x, ym) == bg
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && XGetPixel (ximg, xp, y) == bg
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && XGetPixel (ximg, xp, yp) == bg
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && XGetPixel (ximg, xp, ym) == bg
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && XGetPixel (ximg, xm, y) == bg
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && XGetPixel (ximg, xm, yp) == bg
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && XGetPixel (ximg, xm, ym) == bg)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPutPixel (mask_img, x, y, 0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPutPixel (mask_img, x, y, 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xassert (interrupt_input_blocked);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gc = XCreateGC (FRAME_X_DISPLAY (f), mask, 0, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPutImage (FRAME_X_DISPLAY (f), mask, gc, mask_img, 0, 0, 0, 0,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 width, height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XFreeGC (FRAME_X_DISPLAY (f), gc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].have_mask = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].mask = mask;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XDestroyImage (ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_x_image (mask_img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_X_WINDOWS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /***********************************************************************
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Image types
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ***********************************************************************/
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Value is the number of elements of vector VECTOR. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define DIM(VECTOR) (sizeof (VECTOR) / sizeof *(VECTOR))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* List of supported image types. Use define_image_type to add new
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 types. Use lookup_image_type to find a type for a given symbol. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static struct image_type *image_types;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* A list of symbols, one for each supported image type. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object Vimage_types;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* An alist of image types and libraries that implement the type. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object Vimage_library_alist;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Cache for delayed-loading image types. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static Lisp_Object Vimage_type_cache;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* The symbol `xbm' which is used as the type symbol for XBM images. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object Qxbm;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Keywords. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 extern Lisp_Object QCwidth, QCheight, QCforeground, QCbackground, QCfile;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 extern Lisp_Object QCdata, QCtype, Qcount;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 extern Lisp_Object Qcenter;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object QCascent, QCmargin, QCrelief;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object QCconversion, QCcolor_symbols, QCheuristic_mask;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object QCindex, QCmatrix, QCcolor_adjustment, QCmask;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Other symbols. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object Qlaplace, Qemboss, Qedge_detection, Qheuristic;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Time in seconds after which images should be removed from the cache
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if not displayed. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object Vimage_cache_eviction_delay;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Function prototypes. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static Lisp_Object define_image_type P_ ((struct image_type *type, int loaded));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static struct image_type *lookup_image_type P_ ((Lisp_Object symbol));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void image_error P_ ((char *format, Lisp_Object, Lisp_Object));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void x_laplace P_ ((struct frame *, struct image *));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void x_emboss P_ ((struct frame *, struct image *));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int x_build_heuristic_mask P_ ((struct frame *, struct image *,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define CACHE_IMAGE_TYPE(type, status) \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 do { Vimage_type_cache = Fcons (Fcons (type, status), Vimage_type_cache); } while (0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define ADD_IMAGE_TYPE(type) \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 do { Vimage_types = Fcons (type, Vimage_types); } while (0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Define a new image type from TYPE. This adds a copy of TYPE to
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_types and caches the loading status of TYPE. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static Lisp_Object
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 define_image_type (type, loaded)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image_type *type;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int loaded;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object success;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!loaded)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 success = Qnil;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Make a copy of TYPE to avoid a bus error in a dumped Emacs.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 The initialized data segment is read-only. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image_type *p = (struct image_type *) xmalloc (sizeof *p);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bcopy (type, p, sizeof *p);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->next = image_types;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_types = p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 success = Qt;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CACHE_IMAGE_TYPE (*type->type, success);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return success;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Look up image type SYMBOL, and return a pointer to its image_type
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 structure. Value is null if SYMBOL is not a known image type. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static INLINE struct image_type *
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 lookup_image_type (symbol)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object symbol;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image_type *type;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* We must initialize the image-type if it hasn't been already. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (NILP (Finit_image_library (symbol, Vimage_library_alist)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0; /* unimplemented */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (type = image_types; type; type = type->next)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (EQ (symbol, *type->type))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return type;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Value is non-zero if OBJECT is a valid Lisp image specification. A
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 valid image specification is a list whose car is the symbol
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 `image', and whose rest is a property list. The property list must
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 contain a value for key `:type'. That value must be the name of a
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 supported image type. The rest of the property list depends on the
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image type. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 valid_image_p (object)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object object;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int valid_p = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (IMAGEP (object))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object tem;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (tem = XCDR (object); CONSP (tem); tem = XCDR (tem))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (EQ (XCAR (tem), QCtype))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tem = XCDR (tem);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (CONSP (tem) && SYMBOLP (XCAR (tem)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image_type *type;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 type = lookup_image_type (XCAR (tem));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (type)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 valid_p = type->valid_p (object);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return valid_p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Log error message with format string FORMAT and argument ARG.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Signaling an error, e.g. when an image cannot be loaded, is not a
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 good idea because this would interrupt redisplay, and the error
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 message display would lead to another redisplay. This function
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 therefore simply displays a message. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error (format, arg1, arg2)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char *format;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object arg1, arg2;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 add_to_log (format, arg1, arg2);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /***********************************************************************
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Image specifications
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ***********************************************************************/
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 enum image_value_type
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 IMAGE_DONT_CHECK_VALUE_TYPE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 IMAGE_STRING_VALUE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 IMAGE_STRING_OR_NIL_VALUE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 IMAGE_SYMBOL_VALUE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 IMAGE_POSITIVE_INTEGER_VALUE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 IMAGE_NON_NEGATIVE_INTEGER_VALUE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 IMAGE_ASCENT_VALUE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 IMAGE_INTEGER_VALUE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 IMAGE_FUNCTION_VALUE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 IMAGE_NUMBER_VALUE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 IMAGE_BOOL_VALUE
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Structure used when parsing image specifications. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image_keyword
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Name of keyword. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char *name;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* The type of value allowed. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 enum image_value_type type;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Non-zero means key must be present. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int mandatory_p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Used to recognize duplicate keywords in a property list. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int count;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* The value that was found. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object value;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int parse_image_spec P_ ((Lisp_Object, struct image_keyword *,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int, Lisp_Object));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static Lisp_Object image_spec_value P_ ((Lisp_Object, Lisp_Object, int *));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Parse image spec SPEC according to KEYWORDS. A valid image spec
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 has the format (image KEYWORD VALUE ...). One of the keyword/
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 value pairs must be `:type TYPE'. KEYWORDS is a vector of
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_keywords structures of size NKEYWORDS describing other
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 allowed keyword/value pairs. Value is non-zero if SPEC is valid. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 parse_image_spec (spec, keywords, nkeywords, type)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object spec;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image_keyword *keywords;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int nkeywords;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object type;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object plist;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!IMAGEP (spec))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 plist = XCDR (spec);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 while (CONSP (plist))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object key, value;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* First element of a pair must be a symbol. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 key = XCAR (plist);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 plist = XCDR (plist);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!SYMBOLP (key))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* There must follow a value. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!CONSP (plist))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 value = XCAR (plist);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 plist = XCDR (plist);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Find key in KEYWORDS. Error if not found. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = 0; i < nkeywords; ++i)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (strcmp (keywords[i].name, SDATA (SYMBOL_NAME (key))) == 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (i == nkeywords)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 continue;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Record that we recognized the keyword. If a keywords
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 was found more than once, it's an error. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 keywords[i].value = value;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ++keywords[i].count;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (keywords[i].count > 1)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Check type of value against allowed type. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 switch (keywords[i].type)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 case IMAGE_STRING_VALUE:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!STRINGP (value))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 case IMAGE_STRING_OR_NIL_VALUE:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!STRINGP (value) && !NILP (value))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 case IMAGE_SYMBOL_VALUE:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!SYMBOLP (value))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 case IMAGE_POSITIVE_INTEGER_VALUE:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!INTEGERP (value) || XINT (value) <= 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 case IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (INTEGERP (value) && XINT (value) >= 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (CONSP (value)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && INTEGERP (XCAR (value)) && INTEGERP (XCDR (value))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && XINT (XCAR (value)) >= 0 && XINT (XCDR (value)) >= 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 case IMAGE_ASCENT_VALUE:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (SYMBOLP (value) && EQ (value, Qcenter))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (INTEGERP (value)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && XINT (value) >= 0
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && XINT (value) <= 100)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 case IMAGE_NON_NEGATIVE_INTEGER_VALUE:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!INTEGERP (value) || XINT (value) < 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 case IMAGE_DONT_CHECK_VALUE_TYPE:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 case IMAGE_FUNCTION_VALUE:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 value = indirect_function (value);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (SUBRP (value)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 || COMPILEDP (value)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 || (CONSP (value) && EQ (XCAR (value), Qlambda)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 case IMAGE_NUMBER_VALUE:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!INTEGERP (value) && !FLOATP (value))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 case IMAGE_INTEGER_VALUE:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!INTEGERP (value))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 case IMAGE_BOOL_VALUE:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!NILP (value) && !EQ (value, Qt))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 default:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 abort ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (EQ (key, QCtype) && !EQ (type, value))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Check that all mandatory fields are present. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = 0; i < nkeywords; ++i)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (keywords[i].mandatory_p && keywords[i].count == 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return NILP (plist);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Return the value of KEY in image specification SPEC. Value is nil
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if KEY is not present in SPEC. if FOUND is not null, set *FOUND
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 to 1 if KEY was found in SPEC, set it to 0 otherwise. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static Lisp_Object
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_spec_value (spec, key, found)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object spec, key;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int *found;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object tail;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xassert (valid_image_p (spec));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (tail = XCDR (spec);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CONSP (tail) && CONSP (XCDR (tail));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tail = XCDR (XCDR (tail)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (EQ (XCAR (tail), key))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (found)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *found = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return XCAR (XCDR (tail));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (found)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *found = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return Qnil;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEFUN ("image-size", Fimage_size, Simage_size, 1, 3, 0,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 doc: /* Return the size of image SPEC as pair (WIDTH . HEIGHT).
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PIXELS non-nil means return the size in pixels, otherwise return the
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 size in canonical character units.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FRAME is the frame on which the image will be displayed. FRAME nil
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 or omitted means use the selected frame. */)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (spec, pixels, frame)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object spec, pixels, frame;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object size;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 size = Qnil;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (valid_image_p (spec))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f = check_x_frame (frame);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int id = lookup_image (f, spec);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img = IMAGE_FROM_ID (f, id);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int width = img->width + 2 * img->hmargin;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int height = img->height + 2 * img->vmargin;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (NILP (pixels))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 size = Fcons (make_float ((double) width / FRAME_COLUMN_WIDTH (f)),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 make_float ((double) height / FRAME_LINE_HEIGHT (f)));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 size = Fcons (make_number (width), make_number (height));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 error ("Invalid image specification");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return size;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEFUN ("image-mask-p", Fimage_mask_p, Simage_mask_p, 1, 2, 0,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 doc: /* Return t if image SPEC has a mask bitmap.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FRAME is the frame on which the image will be displayed. FRAME nil
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 or omitted means use the selected frame. */)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (spec, frame)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object spec, frame;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object mask;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 mask = Qnil;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (valid_image_p (spec))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f = check_x_frame (frame);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int id = lookup_image (f, spec);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img = IMAGE_FROM_ID (f, id);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (img->mask)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 mask = Qt;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 error ("Invalid image specification");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return mask;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEFUN ("image-extension-data", Fimage_extension_data, Simage_extension_data, 1, 2, 0,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 doc: /* Return extension data for image SPEC.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FRAME is the frame on which the image will be displayed. FRAME nil
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 or omitted means use the selected frame. */)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (spec, frame)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object spec, frame;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object ext;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ext = Qnil;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (valid_image_p (spec))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f = check_x_frame (frame);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int id = lookup_image (f, spec);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img = IMAGE_FROM_ID (f, id);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ext = img->data.lisp_val;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return ext;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /***********************************************************************
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Image type independent image structures
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ***********************************************************************/
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static struct image *make_image P_ ((Lisp_Object spec, unsigned hash));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void free_image P_ ((struct frame *f, struct image *img));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int check_image_size P_ ((struct frame *f, int width, int height));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define MAX_IMAGE_SIZE 6.0
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object Vmax_image_size;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Allocate and return a new image structure for image specification
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SPEC. SPEC has a hash value of HASH. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static struct image *
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 make_image (spec, hash)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object spec;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned hash;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img = (struct image *) xmalloc (sizeof *img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xassert (valid_image_p (spec));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bzero (img, sizeof *img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xassert (img->type != NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->spec = spec;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->data.lisp_val = Qnil;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->ascent = DEFAULT_IMAGE_ASCENT;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->hash = hash;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->corners[BOT_CORNER] = -1; /* Full image */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Free image IMG which was used on frame F, including its resources. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 free_image (f, img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Remove IMG from the hash table of its cache. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (img->prev)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->prev->next = img->next;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 c->buckets[img->hash % IMAGE_CACHE_BUCKETS_SIZE] = img->next;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (img->next)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->next->prev = img->prev;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 c->images[img->id] = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Free resources, then free IMG. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->type->free (f, img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Return 1 if the given widths and heights are valid for display;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 otherwise, return 0. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 check_image_size (f, width, height)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int width;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int w, h;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (width <= 0 || height <= 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (INTEGERP (Vmax_image_size))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 w = h = XINT (Vmax_image_size);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (FLOATP (Vmax_image_size))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (f != NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 w = FRAME_PIXEL_WIDTH (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 h = FRAME_PIXEL_HEIGHT (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 w = h = 1024; /* Arbitrary size for unknown frame. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 w = (int) (XFLOAT_DATA (Vmax_image_size) * w);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 h = (int) (XFLOAT_DATA (Vmax_image_size) * h);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return (width <= w && height <= h);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Prepare image IMG for display on frame F. Must be called before
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 drawing an image. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 prepare_image_for_display (f, img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 EMACS_TIME t;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* We're about to display IMG, so set its timestamp to `now'. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 EMACS_GET_TIME (t);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->timestamp = EMACS_SECS (t);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* If IMG doesn't have a pixmap yet, load it now, using the image
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 type dependent loader function. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (img->pixmap == NO_PIXMAP && !img->load_failed_p)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->load_failed_p = img->type->load (f, img) == 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (MAC_OS) && USE_CG_DRAWING
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!img->load_failed_p && img->data.ptr_val == NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->data.ptr_val = mac_create_cg_image_from_image (f, img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (img->data.ptr_val == NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->load_failed_p = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->type->free (f, img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Value is the number of pixels for the ascent of image IMG when
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 drawn in face FACE. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_ascent (img, face, slice)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct face *face;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct glyph_slice *slice;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int ascent;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (slice->height == img->height)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 height = img->height + img->vmargin;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (slice->y == 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 height = slice->height + img->vmargin;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 height = slice->height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (img->ascent == CENTERED_IMAGE_ASCENT)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (face->font)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* W32 specific version. Why?. ++kfs */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ascent = height / 2 - (FONT_DESCENT (face->font)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 - FONT_BASE (face->font)) / 2;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* This expression is arranged so that if the image can't be
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 exactly centered, it will be moved slightly up. This is
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 because a typical font is `top-heavy' (due to the presence
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 uppercase letters), so the image placement should err towards
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 being top-heavy too. It also just generally looks better. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ascent = (height + face->font->ascent - face->font->descent + 1) / 2;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ascent = height / 2;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ascent = (int) (height * img->ascent / 100.0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return ascent;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Image background colors. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Find the "best" corner color of a bitmap.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 On W32, XIMG is assumed to a device context with the bitmap selected. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static RGB_PIXEL_COLOR
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 four_corners_best (ximg, corners, width, height)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImagePtr_or_DC ximg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int *corners;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long width, height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 RGB_PIXEL_COLOR corner_pixels[4], best;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i, best_count;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (corners && corners[BOT_CORNER] >= 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Get the colors at the corner_pixels of ximg. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 corner_pixels[0] = GET_PIXEL (ximg, corners[LEFT_CORNER], corners[TOP_CORNER]);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 corner_pixels[1] = GET_PIXEL (ximg, corners[RIGHT_CORNER] - 1, corners[TOP_CORNER]);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 corner_pixels[2] = GET_PIXEL (ximg, corners[RIGHT_CORNER] - 1, corners[BOT_CORNER] - 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 corner_pixels[3] = GET_PIXEL (ximg, corners[LEFT_CORNER], corners[BOT_CORNER] - 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Get the colors at the corner_pixels of ximg. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 corner_pixels[0] = GET_PIXEL (ximg, 0, 0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 corner_pixels[1] = GET_PIXEL (ximg, width - 1, 0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 corner_pixels[2] = GET_PIXEL (ximg, width - 1, height - 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 corner_pixels[3] = GET_PIXEL (ximg, 0, height - 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Choose the most frequently found color as background. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = best_count = 0; i < 4; ++i)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int j, n;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (j = n = 0; j < 4; ++j)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (corner_pixels[i] == corner_pixels[j])
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ++n;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (n > best_count)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 best = corner_pixels[i], best_count = n;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return best;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Portability macros */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define Destroy_Image(img_dc, prev) \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 do { SelectObject (img_dc, prev); DeleteDC (img_dc); } while (0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define Free_Pixmap(display, pixmap) \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DeleteObject (pixmap)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define Destroy_Image(ximg, dummy) \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XDestroyImage (ximg)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define Free_Pixmap(display, pixmap) \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XFreePixmap (display, pixmap)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Return the `background' field of IMG. If IMG doesn't have one yet,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 it is guessed heuristically. If non-zero, XIMG is an existing
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImage object (or device context with the image selected on W32) to
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 use for the heuristic. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 RGB_PIXEL_COLOR
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_background (img, f, ximg)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImagePtr_or_DC ximg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (! img->background_valid)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* IMG doesn't have a background yet, try to guess a reasonable value. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int free_ximg = !ximg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 HGDIOBJ prev;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (free_ximg)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifndef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ximg = XGetImage (FRAME_X_DISPLAY (f), img->pixmap,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 0, 0, img->width, img->height, ~0, ZPixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 HDC frame_dc = get_frame_dc (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ximg = CreateCompatibleDC (frame_dc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 release_frame_dc (f, frame_dc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 prev = SelectObject (ximg, img->pixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* !HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->background = four_corners_best (ximg, img->corners, img->width, img->height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (free_ximg)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Destroy_Image (ximg, prev);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->background_valid = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return img->background;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Return the `background_transparent' field of IMG. If IMG doesn't
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 have one yet, it is guessed heuristically. If non-zero, MASK is an
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 existing XImage object to use for the heuristic. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_background_transparent (img, f, mask)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImagePtr_or_DC mask;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (! img->background_transparent_valid)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* IMG doesn't have a background yet, try to guess a reasonable value. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (img->mask)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int free_mask = !mask;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 HGDIOBJ prev;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (free_mask)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifndef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 mask = XGetImage (FRAME_X_DISPLAY (f), img->mask,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 0, 0, img->width, img->height, ~0, ZPixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 HDC frame_dc = get_frame_dc (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 mask = CreateCompatibleDC (frame_dc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 release_frame_dc (f, frame_dc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 prev = SelectObject (mask, img->mask);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->background_transparent
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 = (four_corners_best (mask, img->corners, img->width, img->height) == PIX_MASK_RETAIN);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (free_mask)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Destroy_Image (mask, prev);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->background_transparent = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->background_transparent_valid = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return img->background_transparent;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /***********************************************************************
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Helper functions for X image types
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ***********************************************************************/
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void x_clear_image_1 P_ ((struct frame *, struct image *, int,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int, int));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void x_clear_image P_ ((struct frame *f, struct image *img));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static unsigned long x_alloc_image_color P_ ((struct frame *f,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object color_name,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long dflt));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Clear X resources of image IMG on frame F. PIXMAP_P non-zero means
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 free the pixmap if any. MASK_P non-zero means clear the mask
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pixmap if any. COLORS_P non-zero means free colors allocated for
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 the image, if any. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_clear_image_1 (f, img, pixmap_p, mask_p, colors_p)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int pixmap_p, mask_p, colors_p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (pixmap_p && img->pixmap)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Free_Pixmap (FRAME_X_DISPLAY (f), img->pixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->pixmap = NO_PIXMAP;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->background_valid = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (mask_p && img->mask)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Free_Pixmap (FRAME_X_DISPLAY (f), img->mask);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->mask = NO_PIXMAP;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->background_transparent_valid = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (colors_p && img->ncolors)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* MAC_TODO: color table support. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* W32_TODO: color table support. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_X_WINDOWS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_free_colors (f, img->colors, img->ncolors);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_X_WINDOWS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (img->colors);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->colors = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->ncolors = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (MAC_OS) && USE_CG_DRAWING
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (img->data.ptr_val)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CGImageRelease (img->data.ptr_val);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->data.ptr_val = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Free X resources of image IMG which is used on frame F. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_clear_image (f, img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 BLOCK_INPUT;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_clear_image_1 (f, img, 1, 1, 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNBLOCK_INPUT;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Allocate color COLOR_NAME for image IMG on frame F. If color
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 cannot be allocated, use DFLT. Add a newly allocated color to
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 IMG->colors, so that it can be freed again. Value is the pixel
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static unsigned long
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_alloc_image_color (f, img, color_name, dflt)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object color_name;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long dflt;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XColor color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long result;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xassert (STRINGP (color_name));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (x_defined_color (f, SDATA (color_name), &color, 1))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* This isn't called frequently so we get away with simply
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 reallocating the color vector to the needed size, here. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ++img->ncolors;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->colors =
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (unsigned long *) xrealloc (img->colors,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->ncolors * sizeof *img->colors);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->colors[img->ncolors - 1] = color.pixel;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 result = color.pixel;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 result = dflt;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return result;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /***********************************************************************
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Image Cache
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ***********************************************************************/
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static struct image *search_image_cache P_ ((struct frame *, Lisp_Object, unsigned));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void cache_image P_ ((struct frame *f, struct image *img));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void postprocess_image P_ ((struct frame *, struct image *));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Return a new, initialized image cache that is allocated from the
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 heap. Call free_image_cache to free an image cache. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image_cache *
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 make_image_cache ()
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image_cache *c = (struct image_cache *) xmalloc (sizeof *c);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int size;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bzero (c, sizeof *c);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 c->size = 50;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 c->images = (struct image **) xmalloc (c->size * sizeof *c->images);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 size = IMAGE_CACHE_BUCKETS_SIZE * sizeof *c->buckets;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 c->buckets = (struct image **) xmalloc (size);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bzero (c->buckets, size);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return c;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Find an image matching SPEC in the cache, and return it. If no
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image is found, return NULL. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static struct image *
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 search_image_cache (f, spec, hash)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object spec;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned hash;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i = hash % IMAGE_CACHE_BUCKETS_SIZE;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!c) return NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* If the image spec does not specify a background color, the cached
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image must have the same background color as the current frame.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 The foreground color must also match, for the sake of monochrome
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 images.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 In fact, we could ignore the foreground color matching condition
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for color images, or if the image spec specifies :foreground;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 similarly we could ignore the background color matching condition
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for formats that don't use transparency (such as jpeg), or if the
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image spec specifies :background. However, the extra memory
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 usage is probably negligible in practice, so we don't bother. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (img = c->buckets[i]; img; img = img->next)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (img->hash == hash
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && !NILP (Fequal (img->spec, spec))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && img->frame_foreground == FRAME_FOREGROUND_PIXEL (f)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && img->frame_background == FRAME_BACKGROUND_PIXEL (f))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Search frame F for an image with spec SPEC, and free it. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 uncache_image (f, spec)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object spec;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img = search_image_cache (f, spec, sxhash (spec, 0));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 free_image (f, img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Free image cache of frame F. Be aware that X frames share images
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 caches. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 free_image_cache (f)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (c)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Cache should not be referenced by any frame when freed. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xassert (c->refcount == 0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = 0; i < c->used; ++i)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 free_image (f, c->images[i]);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (c->images);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (c->buckets);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (c);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FRAME_X_IMAGE_CACHE (f) = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Clear image cache of frame F. FORCE_P non-zero means free all
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 images. FORCE_P zero means clear only images that haven't been
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 displayed for some time. Should be called from time to time to
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 reduce the number of loaded images. If image-eviction-seconds is
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 non-nil, this frees images in the cache which weren't displayed for
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 at least that many seconds. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 clear_image_cache (f, force_p)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int force_p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (c && INTEGERP (Vimage_cache_eviction_delay))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 EMACS_TIME t;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long old;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i, nfreed;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 EMACS_GET_TIME (t);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 old = EMACS_SECS (t) - XFASTINT (Vimage_cache_eviction_delay);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Block input so that we won't be interrupted by a SIGIO
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 while being in an inconsistent state. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 BLOCK_INPUT;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = nfreed = 0; i < c->used; ++i)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img = c->images[i];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (img != NULL
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && (force_p || img->timestamp < old))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 free_image (f, img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ++nfreed;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* We may be clearing the image cache because, for example,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Emacs was iconified for a longer period of time. In that
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 case, current matrices may still contain references to
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 images freed above. So, clear these matrices. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (nfreed)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object tail, frame;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FOR_EACH_FRAME (tail, frame)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f = XFRAME (frame);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (FRAME_WINDOW_P (f)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && FRAME_X_IMAGE_CACHE (f) == c)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 clear_current_matrices (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ++windows_or_buffers_changed;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNBLOCK_INPUT;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEFUN ("clear-image-cache", Fclear_image_cache, Sclear_image_cache,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 0, 1, 0,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 doc: /* Clear the image cache of FRAME.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FRAME nil or omitted means use the selected frame.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FRAME t means clear the image caches of all frames. */)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (frame)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object frame;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (EQ (frame, Qt))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object tail;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FOR_EACH_FRAME (tail, frame)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (FRAME_WINDOW_P (XFRAME (frame)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 clear_image_cache (XFRAME (frame), 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 clear_image_cache (check_x_frame (frame), 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return Qnil;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEFUN ("image-refresh", Fimage_refresh, Simage_refresh,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 1, 2, 0,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 doc: /* Refresh the image with specification SPEC on frame FRAME.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 If SPEC specifies an image file, the displayed image is updated with
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 the current contents of that file.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FRAME nil or omitted means use the selected frame.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FRAME t means refresh the image on all frames. */)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (spec, frame)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object spec, frame;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!valid_image_p (spec))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 error ("Invalid image specification");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (EQ (frame, Qt))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object tail;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FOR_EACH_FRAME (tail, frame)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f = XFRAME (frame);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (FRAME_WINDOW_P (f))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 uncache_image (f, spec);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 uncache_image (check_x_frame (frame), spec);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return Qnil;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Compute masks and transform image IMG on frame F, as specified
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 by the image's specification, */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 postprocess_image (f, img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Manipulation of the image's mask. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (img->pixmap)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object conversion, spec;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object mask;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 spec = img->spec;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* `:heuristic-mask t'
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 `:mask heuristic'
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 means build a mask heuristically.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 `:heuristic-mask (R G B)'
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 `:mask (heuristic (R G B))'
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 means build a mask from color (R G B) in the
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 `:mask nil'
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 means remove a mask, if any. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 mask = image_spec_value (spec, QCheuristic_mask, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!NILP (mask))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_build_heuristic_mask (f, img, mask);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int found_p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 mask = image_spec_value (spec, QCmask, &found_p);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (EQ (mask, Qheuristic))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_build_heuristic_mask (f, img, Qt);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (CONSP (mask)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && EQ (XCAR (mask), Qheuristic))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (CONSP (XCDR (mask)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_build_heuristic_mask (f, img, XCAR (XCDR (mask)));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_build_heuristic_mask (f, img, XCDR (mask));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (NILP (mask) && found_p && img->mask)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Free_Pixmap (FRAME_X_DISPLAY (f), img->mask);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->mask = NO_PIXMAP;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Should we apply an image transformation algorithm? */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 conversion = image_spec_value (spec, QCconversion, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (EQ (conversion, Qdisabled))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_disable_image (f, img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (EQ (conversion, Qlaplace))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_laplace (f, img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (EQ (conversion, Qemboss))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_emboss (f, img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (CONSP (conversion)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && EQ (XCAR (conversion), Qedge_detection))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object tem;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tem = XCDR (conversion);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (CONSP (tem))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_edge_detection (f, img,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Fplist_get (tem, QCmatrix),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Fplist_get (tem, QCcolor_adjustment));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Return the id of image with Lisp specification SPEC on frame F.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SPEC must be a valid Lisp image specification (see valid_image_p). */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 lookup_image (f, spec)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object spec;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned hash;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct gcpro gcpro1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 EMACS_TIME now;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* F must be a window-system frame, and SPEC must be a valid image
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 specification. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xassert (FRAME_WINDOW_P (f));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xassert (valid_image_p (spec));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GCPRO1 (spec);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Look up SPEC in the hash table of the image cache. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 hash = sxhash (spec, 0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img = search_image_cache (f, spec, hash);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (img && img->load_failed_p)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 free_image (f, img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* If not found, create a new image and cache it. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (img == NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 extern Lisp_Object Qpostscript;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 BLOCK_INPUT;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img = make_image (spec, hash);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 cache_image (f, img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->load_failed_p = img->type->load (f, img) == 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->frame_foreground = FRAME_FOREGROUND_PIXEL (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->frame_background = FRAME_BACKGROUND_PIXEL (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* If we can't load the image, and we don't have a width and
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 height, use some arbitrary width and height so that we can
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 draw a rectangle for it. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (img->load_failed_p)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object value;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 value = image_spec_value (spec, QCwidth, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->width = (INTEGERP (value)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ? XFASTINT (value) : DEFAULT_IMAGE_WIDTH);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 value = image_spec_value (spec, QCheight, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->height = (INTEGERP (value)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ? XFASTINT (value) : DEFAULT_IMAGE_HEIGHT);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Handle image type independent image attributes
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 `:ascent ASCENT', `:margin MARGIN', `:relief RELIEF',
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 `:background COLOR'. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object ascent, margin, relief, bg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ascent = image_spec_value (spec, QCascent, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (INTEGERP (ascent))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->ascent = XFASTINT (ascent);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (EQ (ascent, Qcenter))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->ascent = CENTERED_IMAGE_ASCENT;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 margin = image_spec_value (spec, QCmargin, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (INTEGERP (margin) && XINT (margin) >= 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->vmargin = img->hmargin = XFASTINT (margin);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (CONSP (margin) && INTEGERP (XCAR (margin))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && INTEGERP (XCDR (margin)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (XINT (XCAR (margin)) > 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->hmargin = XFASTINT (XCAR (margin));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (XINT (XCDR (margin)) > 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->vmargin = XFASTINT (XCDR (margin));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 relief = image_spec_value (spec, QCrelief, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (INTEGERP (relief))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->relief = XINT (relief);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->hmargin += abs (img->relief);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->vmargin += abs (img->relief);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (! img->background_valid)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bg = image_spec_value (img->spec, QCbackground, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!NILP (bg))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->background
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 = x_alloc_image_color (f, img, bg,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FRAME_BACKGROUND_PIXEL (f));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->background_valid = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Do image transformations and compute masks, unless we
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 don't have the image yet. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!EQ (*img->type->type, Qpostscript))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 postprocess_image (f, img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNBLOCK_INPUT;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* We're using IMG, so set its timestamp to `now'. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 EMACS_GET_TIME (now);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->timestamp = EMACS_SECS (now);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Value is the image id. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return img->id;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Cache image IMG in the image cache of frame F. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 cache_image (f, img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Find a free slot in c->images. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = 0; i < c->used; ++i)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (c->images[i] == NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* If no free slot found, maybe enlarge c->images. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (i == c->used && c->used == c->size)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 c->size *= 2;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 c->images = (struct image **) xrealloc (c->images,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 c->size * sizeof *c->images);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Add IMG to c->images, and assign IMG an id. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 c->images[i] = img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->id = i;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (i == c->used)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ++c->used;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Add IMG to the cache's hash table. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 i = img->hash % IMAGE_CACHE_BUCKETS_SIZE;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->next = c->buckets[i];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (img->next)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->next->prev = img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->prev = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 c->buckets[i] = img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Call FN on every image in the image cache of frame F. Used to mark
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp Objects in the image cache. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 forall_images_in_image_cache (f, fn)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 void (*fn) P_ ((struct image *img));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (FRAME_LIVE_P (f) && FRAME_WINDOW_P (f))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (c)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = 0; i < c->used; ++i)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (c->images[i])
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn (c->images[i]);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /***********************************************************************
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 X / MAC / W32 support code
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ***********************************************************************/
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Macro for defining functions that will be loaded from image DLLs. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define DEF_IMGLIB_FN(func) int (FAR CDECL *fn_##func)()
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Macro for loading those image functions from the library. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define LOAD_IMGLIB_FN(lib,func) { \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_##func = (void *) GetProcAddress (lib, #func); \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!fn_##func) return 0; \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Load a DLL implementing an image type.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 The `image-library-alist' variable associates a symbol,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 identifying an image type, to a list of possible filenames.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 The function returns NULL if no library could be loaded for
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 the given image type, or if the library was previously loaded;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else the handle of the DLL. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static HMODULE
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 w32_delayed_load (Lisp_Object libraries, Lisp_Object type)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 HMODULE library = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (CONSP (libraries) && NILP (Fassq (type, Vimage_type_cache)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object dlls = Fassq (type, libraries);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (CONSP (dlls))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (dlls = XCDR (dlls); CONSP (dlls); dlls = XCDR (dlls))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CHECK_STRING_CAR (dlls);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (library = LoadLibrary (SDATA (XCAR (dlls))))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return library;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int x_create_x_image_and_pixmap P_ ((struct frame *, int, int, int,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImagePtr *, Pixmap *));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void x_destroy_x_image P_ ((XImagePtr));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void x_put_x_image P_ ((struct frame *, XImagePtr, Pixmap, int, int));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Create an XImage and a pixmap of size WIDTH x HEIGHT for use on
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 frame F. Set *XIMG and *PIXMAP to the XImage and Pixmap created.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Set (*XIMG)->data to a raster of WIDTH x HEIGHT pixels allocated
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 via xmalloc. Print error messages via image_error if an error
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 occurs. Value is non-zero if successful.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 On W32, a DEPTH of zero signifies a 24 bit image, otherwise DEPTH
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 should indicate the bit depth of the image. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_create_x_image_and_pixmap (f, width, height, depth, ximg, pixmap)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int width, height, depth;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImagePtr *ximg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Pixmap *pixmap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_X_WINDOWS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Display *display = FRAME_X_DISPLAY (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Window window = FRAME_X_WINDOW (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Screen *screen = FRAME_X_SCREEN (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xassert (interrupt_input_blocked);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (depth <= 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 depth = DefaultDepthOfScreen (screen);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *ximg = XCreateImage (display, DefaultVisualOfScreen (screen),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 depth, ZPixmap, 0, NULL, width, height,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 depth > 16 ? 32 : depth > 8 ? 16 : 8, 0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (*ximg == NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Unable to allocate X image", Qnil, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Allocate image raster. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (*ximg)->data = (char *) xmalloc ((*ximg)->bytes_per_line * height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Allocate a pixmap of the same size. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *pixmap = XCreatePixmap (display, window, width, height, depth);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (*pixmap == NO_PIXMAP)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_x_image (*ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *ximg = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Unable to create X pixmap", Qnil, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_X_WINDOWS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 BITMAPINFOHEADER *header;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 HDC hdc;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int scanline_width_bits;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int remainder;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int palette_colors = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (depth == 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 depth = 24;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (depth != 1 && depth != 4 && depth != 8
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && depth != 16 && depth != 24 && depth != 32)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Invalid image bit depth specified", Qnil, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 scanline_width_bits = width * depth;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 remainder = scanline_width_bits % 32;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (remainder)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 scanline_width_bits += 32 - remainder;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Bitmaps with a depth less than 16 need a palette. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* BITMAPINFO structure already contains the first RGBQUAD. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (depth < 16)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 palette_colors = 1 << depth - 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *ximg = xmalloc (sizeof (XImage) + palette_colors * sizeof (RGBQUAD));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (*ximg == NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Unable to allocate memory for XImage", Qnil, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 header = &((*ximg)->info.bmiHeader);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bzero (&((*ximg)->info), sizeof (BITMAPINFO));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 header->biSize = sizeof (*header);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 header->biWidth = width;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 header->biHeight = -height; /* negative indicates a top-down bitmap. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 header->biPlanes = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 header->biBitCount = depth;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 header->biCompression = BI_RGB;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 header->biClrUsed = palette_colors;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* TODO: fill in palette. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (depth == 1)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (*ximg)->info.bmiColors[0].rgbBlue = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (*ximg)->info.bmiColors[0].rgbGreen = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (*ximg)->info.bmiColors[0].rgbRed = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (*ximg)->info.bmiColors[0].rgbReserved = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (*ximg)->info.bmiColors[1].rgbBlue = 255;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (*ximg)->info.bmiColors[1].rgbGreen = 255;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (*ximg)->info.bmiColors[1].rgbRed = 255;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (*ximg)->info.bmiColors[1].rgbReserved = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 hdc = get_frame_dc (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Create a DIBSection and raster array for the bitmap,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 and store its handle in *pixmap. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *pixmap = CreateDIBSection (hdc, &((*ximg)->info),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (depth < 16) ? DIB_PAL_COLORS : DIB_RGB_COLORS,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* casting avoids a GCC warning */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (void **)&((*ximg)->data), NULL, 0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Realize display palette and garbage all frames. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 release_frame_dc (f, hdc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (*pixmap == NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DWORD err = GetLastError ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object errcode;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* All system errors are < 10000, so the following is safe. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XSETINT (errcode, (int) err);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Unable to create bitmap, error code %d", errcode, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_x_image (*ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef MAC_OS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Display *display = FRAME_X_DISPLAY (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Window window = FRAME_X_WINDOW (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xassert (interrupt_input_blocked);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Allocate a pixmap of the same size. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *pixmap = XCreatePixmap (display, window, width, height, depth);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (*pixmap == NO_PIXMAP)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *ximg = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Unable to create X pixmap", Qnil, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LockPixels (GetGWorldPixMap (*pixmap));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *ximg = *pixmap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* MAC_OS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Destroy XImage XIMG. Free XIMG->data. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_x_image (ximg)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImagePtr ximg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xassert (interrupt_input_blocked);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (ximg)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_X_WINDOWS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (ximg->data);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ximg->data = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XDestroyImage (ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_X_WINDOWS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Data will be freed by DestroyObject. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ximg->data = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef MAC_OS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XDestroyImage (ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* MAC_OS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Put XImage XIMG into pixmap PIXMAP on frame F. WIDTH and HEIGHT
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 are width and height of both the image and pixmap. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_put_x_image (f, ximg, pixmap, width, height)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImagePtr ximg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Pixmap pixmap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int width, height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_X_WINDOWS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GC gc;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xassert (interrupt_input_blocked);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gc = XCreateGC (FRAME_X_DISPLAY (f), pixmap, 0, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPutImage (FRAME_X_DISPLAY (f), pixmap, gc, ximg, 0, 0, 0, 0, width, height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XFreeGC (FRAME_X_DISPLAY (f), gc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_X_WINDOWS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if 0 /* I don't think this is necessary looking at where it is used. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 HDC hdc = get_frame_dc (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SetDIBits (hdc, pixmap, 0, height, ximg->data, &(ximg->info), DIB_RGB_COLORS);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 release_frame_dc (f, hdc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef MAC_OS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xassert (ximg == pixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* MAC_OS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /***********************************************************************
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 File Handling
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ***********************************************************************/
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static unsigned char *slurp_file P_ ((char *, int *));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Find image file FILE. Look in data-directory/images, then
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x-bitmap-file-path. Value is the encoded full name of the file
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 found, or nil if not found. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_find_image_file (file)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object file;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object file_found, search_path;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct gcpro gcpro1, gcpro2;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int fd;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 file_found = Qnil;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* TODO I think this should use something like image-load-path
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 instead. Unfortunately, that can contain non-string elements. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 search_path = Fcons (Fexpand_file_name (build_string ("images"),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Vdata_directory),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Vx_bitmap_file_path);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GCPRO2 (file_found, search_path);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Try to find FILE in data-directory, then x-bitmap-file-path. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fd = openp (search_path, file, Qnil, &file_found, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (fd == -1)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 file_found = Qnil;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 file_found = ENCODE_FILE (file_found);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 close (fd);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return file_found;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Read FILE into memory. Value is a pointer to a buffer allocated
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 with xmalloc holding FILE's contents. Value is null if an error
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 occurred. *SIZE is set to the size of the file. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static unsigned char *
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 slurp_file (file, size)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char *file;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int *size;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FILE *fp = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned char *buf = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct stat st;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (stat (file, &st) == 0
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && (fp = fopen (file, "rb")) != NULL
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && (buf = (unsigned char *) xmalloc (st.st_size),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fread (buf, 1, st.st_size, fp) == st.st_size))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *size = st.st_size;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fclose (fp);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (fp)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fclose (fp);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (buf)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (buf);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 buf = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return buf;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef MAC_OS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /***********************************************************************
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 MAC Image Load Functions
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ***********************************************************************/
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int image_load_quicktime P_ ((struct frame *, struct image *img,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 OSType));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef MAC_OSX
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int image_load_quartz2d P_ ((struct frame *, struct image *img, int));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static OSErr
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 find_image_fsspec (specified_file, file, fss)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object specified_file, *file;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FSSpec *fss;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 OSErr err;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 AEDesc desc;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *file = x_find_image_file (specified_file);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!STRINGP (*file))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return fnfErr; /* file or directory not found;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 incomplete pathname */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Try to open the image file. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 err = AECoercePtr (TYPE_FILE_NAME, SDATA (*file),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SBYTES (*file), typeFSS, &desc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (err == noErr)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if TARGET_API_MAC_CARBON
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 err = AEGetDescData (&desc, fss, sizeof (FSSpec));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *fss = *(FSSpec *)(*(desc.dataHandle));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 AEDisposeDesc (&desc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return err;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_load_qt_1 (f, img, type, fss, dh)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 OSType type;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 const FSSpec *fss;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Handle dh;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ComponentResult err;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GraphicsImportComponent gi;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Rect rect;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int width, height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ImageDescriptionHandle desc_handle;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 short draw_all_pixels;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object specified_bg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XColor color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImagePtr ximg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 RGBColor bg_color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 err = OpenADefaultComponent (GraphicsImporterComponentType, type, &gi);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (err != noErr)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Cannot get importer component for `%s'", img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (dh == NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* read from file system spec */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 err = GraphicsImportSetDataFile (gi, fss);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (err != noErr)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Cannot set fsspec to graphics importer for '%s'",
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* read from data handle */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 err = GraphicsImportSetDataHandle (gi, dh);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (err != noErr)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Cannot set data handle to graphics importer for `%s'",
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 err = GraphicsImportGetImageDescription (gi, &desc_handle);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (err != noErr || desc_handle == NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Error reading `%s'", img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 width = img->width = (*desc_handle)->width;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 height = img->height = (*desc_handle)->height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DisposeHandle ((Handle)desc_handle);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!check_image_size (f, width, height))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Invalid image size", Qnil, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 err = GraphicsImportDoesDrawAllPixels (gi, &draw_all_pixels);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if 0
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Don't check the error code here. It may have an undocumented
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 value -32766. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (err != noErr)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Error reading `%s'", img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (draw_all_pixels != graphicsImporterDrawsAllPixels)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 specified_bg = image_spec_value (img->spec, QCbackground, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!STRINGP (specified_bg) ||
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 !mac_defined_color (f, SDATA (specified_bg), &color, 0))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color.pixel = FRAME_BACKGROUND_PIXEL (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color.red = RED16_FROM_ULONG (color.pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color.green = GREEN16_FROM_ULONG (color.pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color.blue = BLUE16_FROM_ULONG (color.pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (draw_all_pixels != graphicsImporterDrawsAllPixels)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CGrafPtr old_port;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GDHandle old_gdh;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GetGWorld (&old_port, &old_gdh);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SetGWorld (ximg, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bg_color.red = color.red;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bg_color.green = color.green;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bg_color.blue = color.blue;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 RGBBackColor (&bg_color);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if TARGET_API_MAC_CARBON
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GetPortBounds (ximg, &rect);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 EraseRect (&rect);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 EraseRect (&(ximg->portRect));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SetGWorld (old_port, old_gdh);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GraphicsImportSetGWorld (gi, ximg, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GraphicsImportDraw (gi);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CloseComponent (gi);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Maybe fill in the background field while we have ximg handy. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 IMAGE_BACKGROUND (img, f, ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Put the image into the pixmap. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_put_x_image (f, ximg, img->pixmap, width, height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_x_image (ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 error:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CloseComponent (gi);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Load an image using the QuickTime Graphics Importer.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Note: The alpha channel does not work for PNG images. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_load_quicktime (f, img, type)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 OSType type;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object specified_file;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object specified_data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 OSErr err;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 specified_file = image_spec_value (img->spec, QCfile, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 specified_data = image_spec_value (img->spec, QCdata, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (NILP (specified_data))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Read from a file */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object file;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FSSpec fss;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 err = find_image_fsspec (specified_file, &file, &fss);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (err != noErr)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (err == fnfErr)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Cannot find image file `%s'", specified_file, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Cannot open `%s'", file, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return image_load_qt_1 (f, img, type, &fss, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Memory source! */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int success_p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Handle dh;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 err = PtrToHand (SDATA (specified_data), &dh, SBYTES (specified_data));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (err != noErr)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Cannot allocate data handle for `%s'",
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 success_p = image_load_qt_1 (f, img, type, NULL, dh);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DisposeHandle (dh);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return success_p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef MAC_OSX
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Load a PNG/JPEG image using Quartz 2D decoding routines.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CGImageCreateWithPNGDataProvider is provided after Mac OS X 10.2.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 So don't use this function directly but determine at runtime
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 whether it exists. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 typedef CGImageRef (*CGImageCreateWithPNGDataProviderProcType)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (CGDataProviderRef, const float [], bool, CGColorRenderingIntent);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static CGImageCreateWithPNGDataProviderProcType MyCGImageCreateWithPNGDataProvider;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 init_image_func_pointer ()
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (NSIsSymbolNameDefined ("_CGImageCreateWithPNGDataProvider"))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 MyCGImageCreateWithPNGDataProvider
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 = (CGImageCreateWithPNGDataProviderProcType)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 NSAddressOfSymbol (NSLookupAndBindSymbol
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ("_CGImageCreateWithPNGDataProvider"));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 MyCGImageCreateWithPNGDataProvider = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_load_quartz2d (f, img, png_p)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int png_p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object file, specified_file;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object specified_data, specified_bg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct gcpro gcpro1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CGDataProviderRef source;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CGImageRef image;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int width, height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XColor color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImagePtr ximg = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CGContextRef context;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CGRect rectangle;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Open the file. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 specified_file = image_spec_value (img->spec, QCfile, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 specified_data = image_spec_value (img->spec, QCdata, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 file = Qnil;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GCPRO1 (file);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (NILP (specified_data))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CFStringRef path;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CFURLRef url;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 file = x_find_image_file (specified_file);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!STRINGP (file))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Cannot find image file `%s'", specified_file, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 path = cfstring_create_with_utf8_cstring (SDATA (file));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 url = CFURLCreateWithFileSystemPath (NULL, path,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 kCFURLPOSIXPathStyle, 0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CFRelease (path);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 source = CGDataProviderCreateWithURL (url);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CFRelease (url);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 source = CGDataProviderCreateWithData (NULL, SDATA (specified_data),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SBYTES (specified_data), NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (png_p)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image = (*MyCGImageCreateWithPNGDataProvider) (source, NULL, FALSE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 kCGRenderingIntentDefault);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image = CGImageCreateWithJPEGDataProvider (source, NULL, FALSE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 kCGRenderingIntentDefault);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CGDataProviderRelease (source);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (image == NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Error reading image `%s'", img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 width = img->width = CGImageGetWidth (image);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 height = img->height = CGImageGetHeight (image);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!check_image_size (f, width, height))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CGImageRelease (image);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Invalid image size", Qnil, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (png_p)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 specified_bg = image_spec_value (img->spec, QCbackground, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!STRINGP (specified_bg) ||
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 !mac_defined_color (f, SDATA (specified_bg), &color, 0))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color.pixel = FRAME_BACKGROUND_PIXEL (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color.red = RED16_FROM_ULONG (color.pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color.green = GREEN16_FROM_ULONG (color.pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color.blue = BLUE16_FROM_ULONG (color.pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CGImageRelease (image);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 rectangle = CGRectMake (0, 0, width, height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 QDBeginCGContext (ximg, &context);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (png_p)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CGContextSetRGBFillColor (context, color.red / 65535.0,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color.green / 65535.0,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color.blue / 65535.0, 1.0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CGContextFillRect (context, rectangle);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CGContextDrawImage (context, rectangle, image);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 QDEndCGContext (ximg, &context);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CGImageRelease (image);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Maybe fill in the background field while we have ximg handy. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 IMAGE_BACKGROUND (img, f, ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Put the image into the pixmap. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_put_x_image (f, ximg, img->pixmap, width, height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_x_image (ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* MAC_OS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /***********************************************************************
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XBM images
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ***********************************************************************/
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int xbm_scan P_ ((unsigned char **, unsigned char *, char *, int *));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int xbm_load P_ ((struct frame *f, struct image *img));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int xbm_load_image P_ ((struct frame *f, struct image *img,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned char *, unsigned char *));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int xbm_image_p P_ ((Lisp_Object object));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int xbm_read_bitmap_data P_ ((struct frame *f,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned char *, unsigned char *,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int *, int *, unsigned char **));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int xbm_file_p P_ ((Lisp_Object));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Indices of image specification fields in xbm_format, below. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 enum xbm_keyword_index
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XBM_TYPE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XBM_FILE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XBM_WIDTH,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XBM_HEIGHT,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XBM_DATA,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XBM_FOREGROUND,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XBM_BACKGROUND,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XBM_ASCENT,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XBM_MARGIN,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XBM_RELIEF,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XBM_ALGORITHM,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XBM_HEURISTIC_MASK,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XBM_MASK,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XBM_LAST
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Vector of image_keyword structures describing the format
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 of valid XBM image specifications. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static struct image_keyword xbm_format[XBM_LAST] =
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":type", IMAGE_SYMBOL_VALUE, 1},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":file", IMAGE_STRING_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":width", IMAGE_POSITIVE_INTEGER_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":height", IMAGE_POSITIVE_INTEGER_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":data", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":foreground", IMAGE_STRING_OR_NIL_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":background", IMAGE_STRING_OR_NIL_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":ascent", IMAGE_ASCENT_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":relief", IMAGE_INTEGER_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0}
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Structure describing the image type XBM. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static struct image_type xbm_type =
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &Qxbm,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xbm_image_p,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xbm_load,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_clear_image,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 NULL
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Tokens returned from xbm_scan. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 enum xbm_token
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XBM_TK_IDENT = 256,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XBM_TK_NUMBER
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Return non-zero if OBJECT is a valid XBM-type image specification.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 A valid specification is a list starting with the symbol `image'
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 The rest of the list is a property list which must contain an
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 entry `:type xbm..
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 If the specification specifies a file to load, it must contain
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 an entry `:file FILENAME' where FILENAME is a string.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 If the specification is for a bitmap loaded from memory it must
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 contain `:width WIDTH', `:height HEIGHT', and `:data DATA', where
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 WIDTH and HEIGHT are integers > 0. DATA may be:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 1. a string large enough to hold the bitmap data, i.e. it must
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 have a size >= (WIDTH + 7) / 8 * HEIGHT
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 2. a bool-vector of size >= WIDTH * HEIGHT
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 3. a vector of strings or bool-vectors, one for each line of the
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bitmap.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 4. A string containing an in-memory XBM file. WIDTH and HEIGHT
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 may not be specified in this case because they are defined in the
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XBM file.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Both the file and data forms may contain the additional entries
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 `:background COLOR' and `:foreground COLOR'. If not present,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 foreground and background of the frame on which the image is
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 displayed is used. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xbm_image_p (object)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object object;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image_keyword kw[XBM_LAST];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bcopy (xbm_format, kw, sizeof kw);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!parse_image_spec (object, kw, XBM_LAST, Qxbm))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xassert (EQ (kw[XBM_TYPE].value, Qxbm));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (kw[XBM_FILE].count)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (kw[XBM_WIDTH].count || kw[XBM_HEIGHT].count || kw[XBM_DATA].count)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (kw[XBM_DATA].count && xbm_file_p (kw[XBM_DATA].value))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* In-memory XBM file. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (kw[XBM_WIDTH].count || kw[XBM_HEIGHT].count || kw[XBM_FILE].count)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int width, height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Entries for `:width', `:height' and `:data' must be present. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!kw[XBM_WIDTH].count
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 || !kw[XBM_HEIGHT].count
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 || !kw[XBM_DATA].count)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 data = kw[XBM_DATA].value;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 width = XFASTINT (kw[XBM_WIDTH].value);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 height = XFASTINT (kw[XBM_HEIGHT].value);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Check type of data, and width and height against contents of
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 data. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (VECTORP (data))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Number of elements of the vector must be >= height. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (XVECTOR (data)->size < height)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Each string or bool-vector in data must be large enough
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for one line of the image. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = 0; i < height; ++i)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object elt = XVECTOR (data)->contents[i];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (STRINGP (elt))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (SCHARS (elt)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 < (width + BITS_PER_CHAR - 1) / BITS_PER_CHAR)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (BOOL_VECTOR_P (elt))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (XBOOL_VECTOR (elt)->size < width)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (STRINGP (data))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (SCHARS (data)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 < (width + BITS_PER_CHAR - 1) / BITS_PER_CHAR * height)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (BOOL_VECTOR_P (data))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (XBOOL_VECTOR (data)->size < width * height)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Scan a bitmap file. FP is the stream to read from. Value is
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 either an enumerator from enum xbm_token, or a character for a
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 single-character token, or 0 at end of file. If scanning an
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 identifier, store the lexeme of the identifier in SVAL. If
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 scanning a number, store its value in *IVAL. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xbm_scan (s, end, sval, ival)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned char **s, *end;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char *sval;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int *ival;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned int c;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 loop:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Skip white space. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 while (*s < end && (c = *(*s)++, isspace (c)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (*s >= end)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 c = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (isdigit (c))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int value = 0, digit;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (c == '0' && *s < end)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 c = *(*s)++;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (c == 'x' || c == 'X')
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 while (*s < end)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 c = *(*s)++;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (isdigit (c))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 digit = c - '0';
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (c >= 'a' && c <= 'f')
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 digit = c - 'a' + 10;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (c >= 'A' && c <= 'F')
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 digit = c - 'A' + 10;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 value = 16 * value + digit;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (isdigit (c))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 value = c - '0';
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 while (*s < end
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && (c = *(*s)++, isdigit (c)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 value = 8 * value + c - '0';
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 value = c - '0';
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 while (*s < end
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && (c = *(*s)++, isdigit (c)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 value = 10 * value + c - '0';
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (*s < end)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *s = *s - 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *ival = value;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 c = XBM_TK_NUMBER;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (isalpha (c) || c == '_')
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *sval++ = c;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 while (*s < end
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && (c = *(*s)++, (isalnum (c) || c == '_')))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *sval++ = c;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *sval = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (*s < end)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *s = *s - 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 c = XBM_TK_IDENT;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (c == '/' && **s == '*')
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* C-style comment. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ++*s;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 while (**s && (**s != '*' || *(*s + 1) != '/'))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ++*s;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (**s)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *s += 2;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto loop;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return c;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Create a Windows bitmap from X bitmap data. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static HBITMAP
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 w32_create_pixmap_from_bitmap_data (int width, int height, char *data)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static unsigned char swap_nibble[16]
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 = { 0x0, 0x8, 0x4, 0xc, /* 0000 1000 0100 1100 */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 0x2, 0xa, 0x6, 0xe, /* 0010 1010 0110 1110 */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 0x1, 0x9, 0x5, 0xd, /* 0001 1001 0101 1101 */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 0x3, 0xb, 0x7, 0xf }; /* 0011 1011 0111 1111 */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i, j, w1, w2;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned char *bits, *p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 HBITMAP bmp;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 w1 = (width + 7) / 8; /* nb of 8bits elt in X bitmap */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 w2 = ((width + 15) / 16) * 2; /* nb of 16bits elt in W32 bitmap */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bits = (unsigned char *) alloca (height * w2);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bzero (bits, height * w2);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = 0; i < height; i++)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p = bits + i*w2;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (j = 0; j < w1; j++)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Bitswap XBM bytes to match how Windows does things. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned char c = *data++;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *p++ = (unsigned char)((swap_nibble[c & 0xf] << 4)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 | (swap_nibble[(c>>4) & 0xf]));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bmp = CreateBitmap (width, height, 1, 1, (char *) bits);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return bmp;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 convert_mono_to_color_image (f, img, foreground, background)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 COLORREF foreground, background;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 HDC hdc, old_img_dc, new_img_dc;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 HGDIOBJ old_prev, new_prev;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 HBITMAP new_pixmap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 hdc = get_frame_dc (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 old_img_dc = CreateCompatibleDC (hdc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 new_img_dc = CreateCompatibleDC (hdc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 new_pixmap = CreateCompatibleBitmap (hdc, img->width, img->height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 release_frame_dc (f, hdc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 old_prev = SelectObject (old_img_dc, img->pixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 new_prev = SelectObject (new_img_dc, new_pixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SetTextColor (new_img_dc, background);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SetBkColor (new_img_dc, foreground);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 BitBlt (new_img_dc, 0, 0, img->width, img->height, old_img_dc,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 0, 0, SRCCOPY);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SelectObject (old_img_dc, old_prev);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SelectObject (new_img_dc, new_prev);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DeleteDC (old_img_dc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DeleteDC (new_img_dc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DeleteObject (img->pixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (new_pixmap == 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fprintf (stderr, "Failed to convert image to color.\n");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->pixmap = new_pixmap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define XBM_BIT_SHUFFLE(b) (~(b))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define XBM_BIT_SHUFFLE(b) (b)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Create_Pixmap_From_Bitmap_Data (f, img, data, fg, bg, non_default_colors)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char *data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 RGB_PIXEL_COLOR fg, bg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int non_default_colors;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->pixmap
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 = w32_create_pixmap_from_bitmap_data (img->width, img->height, data);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* If colors were specified, transfer the bitmap to a color one. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (non_default_colors)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 convert_mono_to_color_image (f, img, fg, bg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->pixmap
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 = XCreatePixmapFromBitmapData (FRAME_X_DISPLAY (f),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FRAME_X_WINDOW (f),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 data,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->width, img->height,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fg, bg,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DefaultDepthOfScreen (FRAME_X_SCREEN (f)));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Replacement for XReadBitmapFileData which isn't available under old
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 X versions. CONTENTS is a pointer to a buffer to parse; END is the
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 buffer's end. Set *WIDTH and *HEIGHT to the width and height of
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 the image. Return in *DATA the bitmap data allocated with xmalloc.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Value is non-zero if successful. DATA null means just test if
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CONTENTS looks like an in-memory XBM file. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xbm_read_bitmap_data (f, contents, end, width, height, data)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned char *contents, *end;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int *width, *height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned char **data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned char *s = contents;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char buffer[BUFSIZ];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int padding_p = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int v10 = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int bytes_per_line, i, nbytes;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned char *p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int value;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int LA1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define match() \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LA1 = xbm_scan (&s, end, buffer, &value)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define expect(TOKEN) \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (LA1 != (TOKEN)) \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto failure; \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 match ()
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define expect_ident(IDENT) \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (LA1 == XBM_TK_IDENT && strcmp (buffer, (IDENT)) == 0) \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 match (); \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto failure
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *width = *height = -1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (data)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *data = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LA1 = xbm_scan (&s, end, buffer, &value);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Parse defines for width, height and hot-spots. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 while (LA1 == '#')
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 match ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 expect_ident ("define");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 expect (XBM_TK_IDENT);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (LA1 == XBM_TK_NUMBER)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char *p = strrchr (buffer, '_');
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p = p ? p + 1 : buffer;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (strcmp (p, "width") == 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *width = value;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (strcmp (p, "height") == 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *height = value;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 expect (XBM_TK_NUMBER);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!check_image_size (f, *width, *height))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto failure;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (data == NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto success;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Parse bits. Must start with `static'. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 expect_ident ("static");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (LA1 == XBM_TK_IDENT)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (strcmp (buffer, "unsigned") == 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 match ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 expect_ident ("char");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (strcmp (buffer, "short") == 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 match ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 v10 = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (*width % 16 && *width % 16 < 9)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 padding_p = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (strcmp (buffer, "char") == 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 match ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto failure;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto failure;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 expect (XBM_TK_IDENT);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 expect ('[');
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 expect (']');
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 expect ('=');
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 expect ('{');
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bytes_per_line = (*width + 7) / 8 + padding_p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 nbytes = bytes_per_line * *height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p = *data = (unsigned char *) xmalloc (nbytes);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (v10)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = 0; i < nbytes; i += 2)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int val = value;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 expect (XBM_TK_NUMBER);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *p++ = XBM_BIT_SHUFFLE (val);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!padding_p || ((i + 2) % bytes_per_line))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *p++ = XBM_BIT_SHUFFLE (value >> 8);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (LA1 == ',' || LA1 == '}')
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 match ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto failure;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = 0; i < nbytes; ++i)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int val = value;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 expect (XBM_TK_NUMBER);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *p++ = XBM_BIT_SHUFFLE (val);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (LA1 == ',' || LA1 == '}')
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 match ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto failure;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 success:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 failure:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (data && *data)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (*data);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *data = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #undef match
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #undef expect
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #undef expect_ident
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Load XBM image IMG which will be displayed on frame F from buffer
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CONTENTS. END is the end of the buffer. Value is non-zero if
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 successful. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xbm_load_image (f, img, contents, end)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned char *contents, *end;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int rc;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned char *data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int success_p = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 rc = xbm_read_bitmap_data (f, contents, end, &img->width, &img->height, &data);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (rc)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long foreground = FRAME_FOREGROUND_PIXEL (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long background = FRAME_BACKGROUND_PIXEL (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int non_default_colors = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object value;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xassert (img->width > 0 && img->height > 0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Get foreground and background colors, maybe allocate colors. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 value = image_spec_value (img->spec, QCforeground, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!NILP (value))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 foreground = x_alloc_image_color (f, img, value, foreground);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 non_default_colors = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 value = image_spec_value (img->spec, QCbackground, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!NILP (value))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 background = x_alloc_image_color (f, img, value, background);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->background = background;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->background_valid = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 non_default_colors = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Create_Pixmap_From_Bitmap_Data (f, img, data,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 foreground, background,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 non_default_colors);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (data);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (img->pixmap == NO_PIXMAP)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_clear_image (f, img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Unable to create X pixmap for `%s'", img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 success_p = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Error loading XBM image `%s'", img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return success_p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Value is non-zero if DATA looks like an in-memory XBM file. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xbm_file_p (data)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int w, h;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return (STRINGP (data)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && xbm_read_bitmap_data (NULL, SDATA (data),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (SDATA (data)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 + SBYTES (data)),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &w, &h, NULL));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Fill image IMG which is used on frame F with pixmap data. Value is
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 non-zero if successful. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xbm_load (f, img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int success_p = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object file_name;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xassert (xbm_image_p (img->spec));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* If IMG->spec specifies a file name, create a non-file spec from it. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 file_name = image_spec_value (img->spec, QCfile, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (STRINGP (file_name))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object file;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned char *contents;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int size;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct gcpro gcpro1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 file = x_find_image_file (file_name);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GCPRO1 (file);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!STRINGP (file))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Cannot find image file `%s'", file_name, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 contents = slurp_file (SDATA (file), &size);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (contents == NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Error loading XBM image `%s'", img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 success_p = xbm_load_image (f, img, contents, contents + size);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image_keyword fmt[XBM_LAST];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long foreground = FRAME_FOREGROUND_PIXEL (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long background = FRAME_BACKGROUND_PIXEL (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int non_default_colors = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char *bits;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int parsed_p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int in_memory_file_p = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* See if data looks like an in-memory XBM file. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 data = image_spec_value (img->spec, QCdata, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 in_memory_file_p = xbm_file_p (data);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Parse the image specification. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bcopy (xbm_format, fmt, sizeof fmt);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 parsed_p = parse_image_spec (img->spec, fmt, XBM_LAST, Qxbm);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xassert (parsed_p);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Get specified width, and height. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!in_memory_file_p)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->width = XFASTINT (fmt[XBM_WIDTH].value);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->height = XFASTINT (fmt[XBM_HEIGHT].value);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xassert (img->width > 0 && img->height > 0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Get foreground and background colors, maybe allocate colors. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (fmt[XBM_FOREGROUND].count
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && STRINGP (fmt[XBM_FOREGROUND].value))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 foreground = x_alloc_image_color (f, img, fmt[XBM_FOREGROUND].value,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 foreground);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 non_default_colors = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (fmt[XBM_BACKGROUND].count
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && STRINGP (fmt[XBM_BACKGROUND].value))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 background = x_alloc_image_color (f, img, fmt[XBM_BACKGROUND].value,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 background);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 non_default_colors = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (in_memory_file_p)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 success_p = xbm_load_image (f, img, SDATA (data),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (SDATA (data)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 + SBYTES (data)));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (VECTORP (data))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char *p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int nbytes = (img->width + BITS_PER_CHAR - 1) / BITS_PER_CHAR;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p = bits = (char *) alloca (nbytes * img->height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = 0; i < img->height; ++i, p += nbytes)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object line = XVECTOR (data)->contents[i];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (STRINGP (line))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bcopy (SDATA (line), p, nbytes);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bcopy (XBOOL_VECTOR (line)->data, p, nbytes);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (STRINGP (data))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bits = SDATA (data);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bits = XBOOL_VECTOR (data)->data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Create the pixmap. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Create_Pixmap_From_Bitmap_Data (f, img, bits,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 foreground, background,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 non_default_colors);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (img->pixmap)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 success_p = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Unable to create pixmap for XBM image `%s'",
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_clear_image (f, img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return success_p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /***********************************************************************
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPM images
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ***********************************************************************/
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (HAVE_XPM) || defined (MAC_OS)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int xpm_image_p P_ ((Lisp_Object object));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int xpm_load P_ ((struct frame *f, struct image *img));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int xpm_valid_color_symbols_p P_ ((Lisp_Object));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_XPM || MAC_OS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_XPM
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Indicate to xpm.h that we don't have Xlib. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define FOR_MSW
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* simx.h in xpm defines XColor and XImage differently than Emacs. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* It also defines Display the same way as Emacs, but gcc 3.3 still barfs. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define XColor xpm_XColor
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define XImage xpm_XImage
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define Display xpm_Display
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define PIXEL_ALREADY_TYPEDEFED
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include "X11/xpm.h"
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #undef FOR_MSW
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #undef XColor
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #undef XImage
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #undef Display
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #undef PIXEL_ALREADY_TYPEDEFED
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include "X11/xpm.h"
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_XPM */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (HAVE_XPM) || defined (MAC_OS)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* The symbol `xpm' identifying XPM-format images. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object Qxpm;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Indices of image specification fields in xpm_format, below. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 enum xpm_keyword_index
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPM_TYPE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPM_FILE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPM_DATA,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPM_ASCENT,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPM_MARGIN,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPM_RELIEF,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPM_ALGORITHM,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPM_HEURISTIC_MASK,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPM_MASK,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPM_COLOR_SYMBOLS,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPM_BACKGROUND,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPM_LAST
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Vector of image_keyword structures describing the format
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 of valid XPM image specifications. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static struct image_keyword xpm_format[XPM_LAST] =
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":type", IMAGE_SYMBOL_VALUE, 1},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":file", IMAGE_STRING_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":data", IMAGE_STRING_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":ascent", IMAGE_ASCENT_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":relief", IMAGE_INTEGER_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":color-symbols", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":background", IMAGE_STRING_OR_NIL_VALUE, 0}
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Structure describing the image type XPM. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static struct image_type xpm_type =
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &Qxpm,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_image_p,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_load,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_clear_image,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 NULL
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_X_WINDOWS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Define ALLOC_XPM_COLORS if we can use Emacs' own color allocation
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 functions for allocating image colors. Our own functions handle
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color allocation failures more gracefully than the ones on the XPM
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 lib. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined XpmAllocColor && defined XpmFreeColors && defined XpmColorClosure
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define ALLOC_XPM_COLORS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_X_WINDOWS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef ALLOC_XPM_COLORS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void xpm_init_color_cache P_ ((struct frame *, XpmAttributes *));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void xpm_free_color_cache P_ ((void));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int xpm_lookup_color P_ ((struct frame *, char *, XColor *));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int xpm_color_bucket P_ ((char *));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static struct xpm_cached_color *xpm_cache_color P_ ((struct frame *, char *,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XColor *, int));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* An entry in a hash table used to cache color definitions of named
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 colors. This cache is necessary to speed up XPM image loading in
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 case we do color allocations ourselves. Without it, we would need
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 a call to XParseColor per pixel in the image. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct xpm_cached_color
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Next in collision chain. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct xpm_cached_color *next;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Color definition (RGB and pixel color). */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XColor color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Color name. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char name[1];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* The hash table used for the color cache, and its bucket vector
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 size. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define XPM_COLOR_CACHE_BUCKETS 1001
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct xpm_cached_color **xpm_color_cache;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Initialize the color cache. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_init_color_cache (f, attrs)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XpmAttributes *attrs;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 size_t nbytes = XPM_COLOR_CACHE_BUCKETS * sizeof *xpm_color_cache;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_color_cache = (struct xpm_cached_color **) xmalloc (nbytes);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 memset (xpm_color_cache, 0, nbytes);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 init_color_table ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (attrs->valuemask & XpmColorSymbols)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XColor color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = 0; i < attrs->numsymbols; ++i)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (XParseColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 attrs->colorsymbols[i].value, &color))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color.pixel = lookup_rgb_color (f, color.red, color.green,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color.blue);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_cache_color (f, attrs->colorsymbols[i].name, &color, -1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Free the color cache. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_free_color_cache ()
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct xpm_cached_color *p, *next;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = 0; i < XPM_COLOR_CACHE_BUCKETS; ++i)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (p = xpm_color_cache[i]; p; p = next)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 next = p->next;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (p);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (xpm_color_cache);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_color_cache = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 free_color_table ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Return the bucket index for color named COLOR_NAME in the color
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 cache. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_color_bucket (color_name)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char *color_name;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned h = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char *s;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (s = color_name; *s; ++s)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 h = (h << 2) ^ *s;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return h %= XPM_COLOR_CACHE_BUCKETS;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* On frame F, cache values COLOR for color with name COLOR_NAME.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 BUCKET, if >= 0, is a precomputed bucket index. Value is the cache
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 entry added. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static struct xpm_cached_color *
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_cache_color (f, color_name, color, bucket)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char *color_name;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XColor *color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int bucket;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 size_t nbytes;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct xpm_cached_color *p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (bucket < 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bucket = xpm_color_bucket (color_name);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 nbytes = sizeof *p + strlen (color_name);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p = (struct xpm_cached_color *) xmalloc (nbytes);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 strcpy (p->name, color_name);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->color = *color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->next = xpm_color_cache[bucket];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_color_cache[bucket] = p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Look up color COLOR_NAME for frame F in the color cache. If found,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return the cached definition in *COLOR. Otherwise, make a new
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 entry in the cache and allocate the color. Value is zero if color
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 allocation failed. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_lookup_color (f, color_name, color)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char *color_name;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XColor *color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct xpm_cached_color *p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int h = xpm_color_bucket (color_name);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (p = xpm_color_cache[h]; p; p = p->next)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (strcmp (p->name, color_name) == 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (p != NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *color = p->color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (XParseColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color_name, color))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color->pixel = lookup_rgb_color (f, color->red, color->green,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color->blue);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p = xpm_cache_color (f, color_name, color, h);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* You get `opaque' at least from ImageMagick converting pbm to xpm
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 with transparency, and it's useful. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (strcmp ("opaque", color_name) == 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bzero (color, sizeof (XColor)); /* Is this necessary/correct? */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color->pixel = FRAME_FOREGROUND_PIXEL (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p = xpm_cache_color (f, color_name, color, h);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return p != NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Callback for allocating color COLOR_NAME. Called from the XPM lib.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CLOSURE is a pointer to the frame on which we allocate the
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color. Return in *COLOR the allocated color. Value is non-zero
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if successful. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_alloc_color (dpy, cmap, color_name, color, closure)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Display *dpy;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Colormap cmap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char *color_name;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XColor *color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 void *closure;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return xpm_lookup_color ((struct frame *) closure, color_name, color);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Callback for freeing NPIXELS colors contained in PIXELS. CLOSURE
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 is a pointer to the frame on which we allocate the color. Value is
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 non-zero if successful. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_free_colors (dpy, cmap, pixels, npixels, closure)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Display *dpy;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Colormap cmap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Pixel *pixels;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int npixels;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 void *closure;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* ALLOC_XPM_COLORS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* XPM library details. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (XpmFreeAttributes);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (XpmCreateImageFromBuffer);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (XpmReadFileToImage);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (XImageFree);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 init_xpm_functions (Lisp_Object libraries)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 HMODULE library;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!(library = w32_delayed_load (libraries, Qxpm)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, XpmFreeAttributes);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, XpmCreateImageFromBuffer);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, XpmReadFileToImage);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, XImageFree);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Value is non-zero if COLOR_SYMBOLS is a valid color symbols list
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for XPM images. Such a list must consist of conses whose car and
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 cdr are strings. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_valid_color_symbols_p (color_symbols)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object color_symbols;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 while (CONSP (color_symbols))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object sym = XCAR (color_symbols);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!CONSP (sym)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 || !STRINGP (XCAR (sym))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 || !STRINGP (XCDR (sym)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color_symbols = XCDR (color_symbols);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return NILP (color_symbols);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Value is non-zero if OBJECT is a valid XPM image specification. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_image_p (object)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object object;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image_keyword fmt[XPM_LAST];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bcopy (xpm_format, fmt, sizeof fmt);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return (parse_image_spec (object, fmt, XPM_LAST, Qxpm)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Either `:file' or `:data' must be present. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && fmt[XPM_FILE].count + fmt[XPM_DATA].count == 1
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Either no `:color-symbols' or it's a list of conses
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 whose car and cdr are strings. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && (fmt[XPM_COLOR_SYMBOLS].count == 0
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 || xpm_valid_color_symbols_p (fmt[XPM_COLOR_SYMBOLS].value)));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_XPM || MAC_OS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (HAVE_XPM) && defined (HAVE_X_WINDOWS)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_create_bitmap_from_xpm_data (f, bits)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char **bits;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int id, rc;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XpmAttributes attrs;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Pixmap bitmap, mask;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bzero (&attrs, sizeof attrs);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 attrs.visual = FRAME_X_VISUAL (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 attrs.colormap = FRAME_X_COLORMAP (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 attrs.valuemask |= XpmVisual;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 attrs.valuemask |= XpmColormap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 rc = XpmCreatePixmapFromData (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bits, &bitmap, &mask, &attrs);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (rc != XpmSuccess)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XpmFreeAttributes (&attrs);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return -1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 id = x_allocate_bitmap_record (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].pixmap = bitmap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].have_mask = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].mask = mask;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].file = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].height = attrs.height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].width = attrs.width;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].depth = attrs.depth;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo->bitmaps[id - 1].refcount = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XpmFreeAttributes (&attrs);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return id;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* defined (HAVE_XPM) && defined (HAVE_X_WINDOWS) */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Load image IMG which will be displayed on frame F. Value is
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 non-zero if successful. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_XPM
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_load (f, img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int rc;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XpmAttributes attrs;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object specified_file, color_symbols;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 HDC hdc;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_XImage * xpm_image = NULL, * xpm_mask = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Configure the XPM lib. Use the visual of frame F. Allocate
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 close colors. Return colors allocated. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bzero (&attrs, sizeof attrs);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifndef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 attrs.visual = FRAME_X_VISUAL (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 attrs.colormap = FRAME_X_COLORMAP (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 attrs.valuemask |= XpmVisual;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 attrs.valuemask |= XpmColormap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef ALLOC_XPM_COLORS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Allocate colors with our own functions which handle
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 failing color allocation more gracefully. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 attrs.color_closure = f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 attrs.alloc_color = xpm_alloc_color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 attrs.free_colors = xpm_free_colors;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 attrs.valuemask |= XpmAllocColor | XpmFreeColors | XpmColorClosure;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else /* not ALLOC_XPM_COLORS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Let the XPM lib allocate colors. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 attrs.valuemask |= XpmReturnAllocPixels;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef XpmAllocCloseColors
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 attrs.alloc_close_colors = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 attrs.valuemask |= XpmAllocCloseColors;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else /* not XpmAllocCloseColors */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 attrs.closeness = 600;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 attrs.valuemask |= XpmCloseness;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* not XpmAllocCloseColors */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* ALLOC_XPM_COLORS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* If image specification contains symbolic color definitions, add
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 these to `attrs'. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color_symbols = image_spec_value (img->spec, QCcolor_symbols, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (CONSP (color_symbols))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object tail;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XpmColorSymbol *xpm_syms;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i, size;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 attrs.valuemask |= XpmColorSymbols;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Count number of symbols. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 attrs.numsymbols = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (tail = color_symbols; CONSP (tail); tail = XCDR (tail))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ++attrs.numsymbols;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Allocate an XpmColorSymbol array. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 size = attrs.numsymbols * sizeof *xpm_syms;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_syms = (XpmColorSymbol *) alloca (size);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bzero (xpm_syms, size);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 attrs.colorsymbols = xpm_syms;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Fill the color symbol array. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (tail = color_symbols, i = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CONSP (tail);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ++i, tail = XCDR (tail))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object name = XCAR (XCAR (tail));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object color = XCDR (XCAR (tail));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_syms[i].name = (char *) alloca (SCHARS (name) + 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 strcpy (xpm_syms[i].name, SDATA (name));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_syms[i].value = (char *) alloca (SCHARS (color) + 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 strcpy (xpm_syms[i].value, SDATA (color));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Create a pixmap for the image, either from a file, or from a
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 string buffer containing data in the same format as an XPM file. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef ALLOC_XPM_COLORS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_init_color_cache (f, &attrs);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 specified_file = image_spec_value (img->spec, QCfile, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 HDC frame_dc = get_frame_dc (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 hdc = CreateCompatibleDC (frame_dc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 release_frame_dc (f, frame_dc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (STRINGP (specified_file))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object file = x_find_image_file (specified_file);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!STRINGP (file))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Cannot find image file `%s'", specified_file, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* XpmReadFileToPixmap is not available in the Windows port of
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 libxpm. But XpmReadFileToImage almost does what we want. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 rc = fn_XpmReadFileToImage (&hdc, SDATA (file),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &xpm_image, &xpm_mask,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &attrs);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 rc = XpmReadFileToPixmap (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SDATA (file), &img->pixmap, &img->mask,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &attrs);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object buffer = image_spec_value (img->spec, QCdata, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* XpmCreatePixmapFromBuffer is not available in the Windows port
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 of libxpm. But XpmCreateImageFromBuffer almost does what we want. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 rc = fn_XpmCreateImageFromBuffer (&hdc, SDATA (buffer),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &xpm_image, &xpm_mask,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &attrs);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 rc = XpmCreatePixmapFromBuffer (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SDATA (buffer),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &img->pixmap, &img->mask,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &attrs);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (rc == XpmSuccess)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (COLOR_TABLE_SUPPORT) && defined (ALLOC_XPM_COLORS)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->colors = colors_in_color_table (&img->ncolors);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else /* not ALLOC_XPM_COLORS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* W32 XPM uses XImage to wrap what W32 Emacs calls a Pixmap,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 plus some duplicate attributes. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (xpm_image && xpm_image->bitmap)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->pixmap = xpm_image->bitmap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* XImageFree in libXpm frees XImage struct without destroying
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 the bitmap, which is what we want. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_XImageFree (xpm_image);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (xpm_mask && xpm_mask->bitmap)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* The mask appears to be inverted compared with what we expect.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 TODO: invert our expectations. See other places where we
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 have to invert bits because our idea of masks is backwards. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 HGDIOBJ old_obj;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 old_obj = SelectObject (hdc, xpm_mask->bitmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PatBlt (hdc, 0, 0, xpm_mask->width, xpm_mask->height, DSTINVERT);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SelectObject (hdc, old_obj);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->mask = xpm_mask->bitmap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_XImageFree (xpm_mask);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DeleteDC (hdc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DeleteDC (hdc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Remember allocated colors. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->ncolors = attrs.nalloc_pixels;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->colors = (unsigned long *) xmalloc (img->ncolors
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 * sizeof *img->colors);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = 0; i < attrs.nalloc_pixels; ++i)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->colors[i] = attrs.alloc_pixels[i];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef DEBUG_X_COLORS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 register_color (img->colors[i]);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* not ALLOC_XPM_COLORS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->width = attrs.width;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->height = attrs.height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xassert (img->width > 0 && img->height > 0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* The call to XpmFreeAttributes below frees attrs.alloc_pixels. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_XpmFreeAttributes (&attrs);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XpmFreeAttributes (&attrs);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DeleteDC (hdc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 switch (rc)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 case XpmOpenFailed:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Error opening XPM file (%s)", img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 case XpmFileInvalid:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Invalid XPM file (%s)", img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 case XpmNoMemory:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Out of memory (%s)", img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 case XpmColorFailed:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Color allocation error (%s)", img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 default:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Unknown error (%s)", img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef ALLOC_XPM_COLORS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_free_color_cache ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return rc == XpmSuccess;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_XPM */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef MAC_OS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* XPM support functions for Mac OS where libxpm is not available.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Only XPM version 3 (without any extensions) is supported. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int xpm_scan P_ ((const unsigned char **, const unsigned char *,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 const unsigned char **, int *));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static Lisp_Object xpm_make_color_table_v
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 P_ ((void (**) (Lisp_Object, const unsigned char *, int, Lisp_Object),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object (**) (Lisp_Object, const unsigned char *, int)));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void xpm_put_color_table_v P_ ((Lisp_Object, const unsigned char *,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int, Lisp_Object));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static Lisp_Object xpm_get_color_table_v P_ ((Lisp_Object,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 const unsigned char *, int));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static Lisp_Object xpm_make_color_table_h
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 P_ ((void (**) (Lisp_Object, const unsigned char *, int, Lisp_Object),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object (**) (Lisp_Object, const unsigned char *, int)));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void xpm_put_color_table_h P_ ((Lisp_Object, const unsigned char *,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int, Lisp_Object));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static Lisp_Object xpm_get_color_table_h P_ ((Lisp_Object,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 const unsigned char *, int));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int xpm_str_to_color_key P_ ((const char *));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int xpm_load_image P_ ((struct frame *, struct image *,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 const unsigned char *, const unsigned char *));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Tokens returned from xpm_scan. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 enum xpm_token
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPM_TK_IDENT = 256,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPM_TK_STRING,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPM_TK_EOF
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Scan an XPM data and return a character (< 256) or a token defined
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 by enum xpm_token above. *S and END are the start (inclusive) and
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 the end (exclusive) addresses of the data, respectively. Advance
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *S while scanning. If token is either XPM_TK_IDENT or
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPM_TK_STRING, *BEG and *LEN are set to the start address and the
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 length of the corresponding token, respectively. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_scan (s, end, beg, len)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 const unsigned char **s, *end, **beg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int *len;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int c;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 while (*s < end)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Skip white-space. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 while (*s < end && (c = *(*s)++, isspace (c)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* gnus-pointer.xpm uses '-' in its identifier.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 sb-dir-plus.xpm uses '+' in its identifier. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (isalpha (c) || c == '_' || c == '-' || c == '+')
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *beg = *s - 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 while (*s < end &&
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (c = **s, isalnum (c) || c == '_' || c == '-' || c == '+'))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ++*s;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *len = *s - *beg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return XPM_TK_IDENT;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (c == '"')
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *beg = *s;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 while (*s < end && **s != '"')
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ++*s;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *len = *s - *beg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (*s < end)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ++*s;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return XPM_TK_STRING;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (c == '/')
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (*s < end && **s == '*')
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* C-style comment. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ++*s;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 do
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 while (*s < end && *(*s)++ != '*')
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 while (*s < end && **s != '/');
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (*s < end)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ++*s;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return c;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return c;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return XPM_TK_EOF;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Functions for color table lookup in XPM data. A Key is a string
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 specifying the color of each pixel in XPM data. A value is either
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 an integer that specifies a pixel color, Qt that specifies
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 transparency, or Qnil for the unspecified color. If the length of
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 the key string is one, a vector is used as a table. Otherwise, a
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 hash table is used. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static Lisp_Object
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_make_color_table_v (put_func, get_func)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 void (**put_func) (Lisp_Object, const unsigned char *, int, Lisp_Object);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object (**get_func) (Lisp_Object, const unsigned char *, int);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *put_func = xpm_put_color_table_v;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *get_func = xpm_get_color_table_v;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return Fmake_vector (make_number (256), Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_put_color_table_v (color_table, chars_start, chars_len, color)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object color_table;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 const unsigned char *chars_start;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int chars_len;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XVECTOR (color_table)->contents[*chars_start] = color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static Lisp_Object
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_get_color_table_v (color_table, chars_start, chars_len)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object color_table;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 const unsigned char *chars_start;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int chars_len;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return XVECTOR (color_table)->contents[*chars_start];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static Lisp_Object
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_make_color_table_h (put_func, get_func)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 void (**put_func) (Lisp_Object, const unsigned char *, int, Lisp_Object);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object (**get_func) (Lisp_Object, const unsigned char *, int);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *put_func = xpm_put_color_table_h;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *get_func = xpm_get_color_table_h;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return make_hash_table (Qequal, make_number (DEFAULT_HASH_SIZE),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 make_float (DEFAULT_REHASH_SIZE),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 make_float (DEFAULT_REHASH_THRESHOLD),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Qnil, Qnil, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_put_color_table_h (color_table, chars_start, chars_len, color)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object color_table;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 const unsigned char *chars_start;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int chars_len;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct Lisp_Hash_Table *table = XHASH_TABLE (color_table);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned hash_code;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object chars = make_unibyte_string (chars_start, chars_len);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 hash_lookup (table, chars, &hash_code);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 hash_put (table, chars, color, hash_code);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static Lisp_Object
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_get_color_table_h (color_table, chars_start, chars_len)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object color_table;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 const unsigned char *chars_start;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int chars_len;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct Lisp_Hash_Table *table = XHASH_TABLE (color_table);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i = hash_lookup (table, make_unibyte_string (chars_start, chars_len),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return i >= 0 ? HASH_VALUE (table, i) : Qnil;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 enum xpm_color_key {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPM_COLOR_KEY_S,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPM_COLOR_KEY_M,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPM_COLOR_KEY_G4,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPM_COLOR_KEY_G,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPM_COLOR_KEY_C
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static const char xpm_color_key_strings[][4] = {"s", "m", "g4", "g", "c"};
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_str_to_color_key (s)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 const char *s;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 i < sizeof xpm_color_key_strings / sizeof xpm_color_key_strings[0];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 i++)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (strcmp (xpm_color_key_strings[i], s) == 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return i;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return -1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_load_image (f, img, contents, end)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 const unsigned char *contents, *end;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 const unsigned char *s = contents, *beg, *str;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned char buffer[BUFSIZ];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int width, height, x, y;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int num_colors, chars_per_pixel;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int len, LA1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 void (*put_color_table) (Lisp_Object, const unsigned char *, int, Lisp_Object);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object (*get_color_table) (Lisp_Object, const unsigned char *, int);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object frame, color_symbols, color_table;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int best_key, have_mask = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImagePtr ximg = NULL, mask_img = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define match() \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LA1 = xpm_scan (&s, end, &beg, &len)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define expect(TOKEN) \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (LA1 != (TOKEN)) \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto failure; \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 match ()
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define expect_ident(IDENT) \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (LA1 == XPM_TK_IDENT \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && strlen ((IDENT)) == len && memcmp ((IDENT), beg, len) == 0) \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 match (); \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto failure
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!(end - s >= 9 && memcmp (s, "/* XPM */", 9) == 0))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto failure;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 s += 9;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 match();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 expect_ident ("static");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 expect_ident ("char");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 expect ('*');
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 expect (XPM_TK_IDENT);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 expect ('[');
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 expect (']');
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 expect ('=');
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 expect ('{');
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 expect (XPM_TK_STRING);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (len >= BUFSIZ)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto failure;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 memcpy (buffer, beg, len);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 buffer[len] = '\0';
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (sscanf (buffer, "%d %d %d %d", &width, &height,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &num_colors, &chars_per_pixel) != 4
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 || width <= 0 || height <= 0
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 || num_colors <= 0 || chars_per_pixel <= 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto failure;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!check_image_size (f, width, height))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Invalid image size", Qnil, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto failure;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 expect (',');
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XSETFRAME (frame, f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!NILP (Fxw_display_color_p (frame)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 best_key = XPM_COLOR_KEY_C;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (!NILP (Fx_display_grayscale_p (frame)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 best_key = (XFASTINT (Fx_display_planes (frame)) > 2
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ? XPM_COLOR_KEY_G : XPM_COLOR_KEY_G4);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 best_key = XPM_COLOR_KEY_M;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color_symbols = image_spec_value (img->spec, QCcolor_symbols, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (chars_per_pixel == 1)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color_table = xpm_make_color_table_v (&put_color_table,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &get_color_table);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color_table = xpm_make_color_table_h (&put_color_table,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &get_color_table);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 while (num_colors-- > 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned char *color, *max_color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int key, next_key, max_key = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object symbol_color = Qnil, color_val;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XColor cdef;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 expect (XPM_TK_STRING);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (len <= chars_per_pixel || len >= BUFSIZ + chars_per_pixel)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto failure;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 memcpy (buffer, beg + chars_per_pixel, len - chars_per_pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 buffer[len - chars_per_pixel] = '\0';
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 str = strtok (buffer, " \t");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (str == NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto failure;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 key = xpm_str_to_color_key (str);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (key < 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto failure;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 do
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color = strtok (NULL, " \t");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (color == NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto failure;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 while ((str = strtok (NULL, " \t")) != NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 next_key = xpm_str_to_color_key (str);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (next_key >= 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color[strlen (color)] = ' ';
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (key == XPM_COLOR_KEY_S)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (NILP (symbol_color))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 symbol_color = build_string (color);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (max_key < key && key <= best_key)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 max_key = key;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 max_color = color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 key = next_key;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 while (str);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color_val = Qnil;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!NILP (color_symbols) && !NILP (symbol_color))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object specified_color = Fassoc (symbol_color, color_symbols);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (CONSP (specified_color) && STRINGP (XCDR (specified_color)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (xstricmp (SDATA (XCDR (specified_color)), "None") == 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color_val = Qt;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (x_defined_color (f, SDATA (XCDR (specified_color)),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &cdef, 0))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color_val = make_number (cdef.pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (NILP (color_val) && max_key > 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (xstricmp (max_color, "None") == 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color_val = Qt;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (x_defined_color (f, max_color, &cdef, 0))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color_val = make_number (cdef.pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!NILP (color_val))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (*put_color_table) (color_table, beg, chars_per_pixel, color_val);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 expect (',');
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!x_create_x_image_and_pixmap (f, width, height, 0,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &ximg, &img->pixmap)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 || !x_create_x_image_and_pixmap (f, width, height, 1,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &mask_img, &img->mask))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Out of memory (%s)", img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (y = 0; y < height; y++)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 expect (XPM_TK_STRING);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 str = beg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (len < width * chars_per_pixel)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto failure;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (x = 0; x < width; x++, str += chars_per_pixel)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object color_val =
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (*get_color_table) (color_table, str, chars_per_pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPutPixel (ximg, x, y,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (INTEGERP (color_val) ? XINT (color_val)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 : FRAME_FOREGROUND_PIXEL (f)));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPutPixel (mask_img, x, y,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (!EQ (color_val, Qt) ? PIX_MASK_DRAW
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 : (have_mask = 1, PIX_MASK_RETAIN)));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (y + 1 < height)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 expect (',');
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->width = width;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->height = height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Maybe fill in the background field while we have ximg handy. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 IMAGE_BACKGROUND (img, f, ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_put_x_image (f, ximg, img->pixmap, width, height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_x_image (ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (have_mask)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Fill in the background_transparent field while we have the
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 mask handy. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_background_transparent (img, f, mask_img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_put_x_image (f, mask_img, img->mask, width, height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_x_image (mask_img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_x_image (mask_img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Free_Pixmap (FRAME_X_DISPLAY (f), img->mask);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->mask = NO_PIXMAP;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 failure:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Invalid XPM file (%s)", img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 error:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_x_image (ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_x_image (mask_img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_clear_image (f, img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #undef match
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #undef expect
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #undef expect_ident
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xpm_load (f, img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int success_p = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object file_name;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* If IMG->spec specifies a file name, create a non-file spec from it. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 file_name = image_spec_value (img->spec, QCfile, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (STRINGP (file_name))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object file;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned char *contents;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int size;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct gcpro gcpro1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 file = x_find_image_file (file_name);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GCPRO1 (file);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!STRINGP (file))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Cannot find image file `%s'", file_name, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 contents = slurp_file (SDATA (file), &size);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (contents == NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Error loading XPM image `%s'", img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 success_p = xpm_load_image (f, img, contents, contents + size);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (contents);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 data = image_spec_value (img->spec, QCdata, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 success_p = xpm_load_image (f, img, SDATA (data),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SDATA (data) + SBYTES (data));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return success_p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* MAC_OS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /***********************************************************************
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Color table
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ***********************************************************************/
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef COLOR_TABLE_SUPPORT
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* An entry in the color table mapping an RGB color to a pixel color. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct ct_color
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int r, g, b;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long pixel;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Next in color table collision list. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct ct_color *next;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* The bucket vector size to use. Must be prime. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define CT_SIZE 101
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Value is a hash of the RGB color given by R, G, and B. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define CT_HASH_RGB(R, G, B) (((R) << 16) ^ ((G) << 8) ^ (B))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* The color hash table. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct ct_color **ct_table;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Number of entries in the color table. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int ct_colors_allocated;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Initialize the color table. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 init_color_table ()
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int size = CT_SIZE * sizeof (*ct_table);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ct_table = (struct ct_color **) xmalloc (size);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bzero (ct_table, size);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ct_colors_allocated = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Free memory associated with the color table. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 free_color_table ()
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct ct_color *p, *next;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = 0; i < CT_SIZE; ++i)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (p = ct_table[i]; p; p = next)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 next = p->next;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (p);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (ct_table);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ct_table = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Value is a pixel color for RGB color R, G, B on frame F. If an
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 entry for that color already is in the color table, return the
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pixel color of that entry. Otherwise, allocate a new color for R,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 G, B, and make an entry in the color table. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static unsigned long
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 lookup_rgb_color (f, r, g, b)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int r, g, b;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned hash = CT_HASH_RGB (r, g, b);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i = hash % CT_SIZE;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct ct_color *p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Display_Info *dpyinfo;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Handle TrueColor visuals specially, which improves performance by
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 two orders of magnitude. Freeing colors on TrueColor visuals is
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 a nop, and pixel colors specify RGB values directly. See also
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 the Xlib spec, chapter 3.1. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 dpyinfo = FRAME_X_DISPLAY_INFO (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (dpyinfo->red_bits > 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long pr, pg, pb;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Apply gamma-correction like normal color allocation does. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (f->gamma)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XColor color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color.red = r, color.green = g, color.blue = b;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gamma_correct (f, &color);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 r = color.red, g = color.green, b = color.blue;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Scale down RGB values to the visual's bits per RGB, and shift
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 them to the right position in the pixel color. Note that the
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 original RGB values are 16-bit values, as usual in X. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pr = (r >> (16 - dpyinfo->red_bits)) << dpyinfo->red_offset;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pg = (g >> (16 - dpyinfo->green_bits)) << dpyinfo->green_offset;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pb = (b >> (16 - dpyinfo->blue_bits)) << dpyinfo->blue_offset;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Assemble the pixel color. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return pr | pg | pb;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (p = ct_table[i]; p; p = p->next)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (p->r == r && p->g == g && p->b == b)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (p == NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_X_WINDOWS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XColor color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Colormap cmap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int rc;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color.red = r;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color.green = g;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color.blue = b;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 cmap = FRAME_X_COLORMAP (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 rc = x_alloc_nearest_color (f, cmap, &color);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (rc)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ++ct_colors_allocated;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p = (struct ct_color *) xmalloc (sizeof *p);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->r = r;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->g = g;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->b = b;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->pixel = color.pixel;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->next = ct_table[i];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ct_table[i] = p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return FRAME_FOREGROUND_PIXEL (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 COLORREF color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color = PALETTERGB (r, g, b);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color = RGB_TO_ULONG (r, g, b);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ++ct_colors_allocated;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p = (struct ct_color *) xmalloc (sizeof *p);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->r = r;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->g = g;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->b = b;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->pixel = color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->next = ct_table[i];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ct_table[i] = p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_X_WINDOWS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return p->pixel;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Look up pixel color PIXEL which is used on frame F in the color
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 table. If not already present, allocate it. Value is PIXEL. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static unsigned long
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 lookup_pixel_color (f, pixel)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long pixel;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i = pixel % CT_SIZE;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct ct_color *p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (p = ct_table[i]; p; p = p->next)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (p->pixel == pixel)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (p == NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XColor color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Colormap cmap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int rc;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_X_WINDOWS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 cmap = FRAME_X_COLORMAP (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color.pixel = pixel;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_query_color (f, &color);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 rc = x_alloc_nearest_color (f, cmap, &color);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 BLOCK_INPUT;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color.pixel = pixel;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XQueryColor (NULL, cmap, &color);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 rc = x_alloc_nearest_color (f, cmap, &color);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNBLOCK_INPUT;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_X_WINDOWS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (rc)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ++ct_colors_allocated;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p = (struct ct_color *) xmalloc (sizeof *p);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->r = color.red;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->g = color.green;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->b = color.blue;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->pixel = pixel;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->next = ct_table[i];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ct_table[i] = p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return FRAME_FOREGROUND_PIXEL (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return p->pixel;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Value is a vector of all pixel colors contained in the color table,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 allocated via xmalloc. Set *N to the number of colors. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static unsigned long *
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 colors_in_color_table (n)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int *n;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i, j;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct ct_color *p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long *colors;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (ct_colors_allocated == 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *n = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 colors = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 colors = (unsigned long *) xmalloc (ct_colors_allocated
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 * sizeof *colors);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *n = ct_colors_allocated;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = j = 0; i < CT_SIZE; ++i)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (p = ct_table[i]; p; p = p->next)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 colors[j++] = p->pixel;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return colors;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else /* COLOR_TABLE_SUPPORT */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static unsigned long
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 lookup_rgb_color (f, r, g, b)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int r, g, b;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long pixel;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef MAC_OS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pixel = RGB_TO_ULONG (r >> 8, g >> 8, b >> 8);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gamma_correct (f, &pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* MAC_OS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pixel = PALETTERGB (r >> 8, g >> 8, b >> 8);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return pixel;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 init_color_table ()
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* COLOR_TABLE_SUPPORT */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /***********************************************************************
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Algorithms
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ***********************************************************************/
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static XColor *x_to_xcolors P_ ((struct frame *, struct image *, int));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void x_from_xcolors P_ ((struct frame *, struct image *, XColor *));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void x_detect_edges P_ ((struct frame *, struct image *, int[9], int));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void XPutPixel (XImagePtr , int, int, COLORREF);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Non-zero means draw a cross on images having `:conversion
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 disabled'. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int cross_disabled_images;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Edge detection matrices for different edge-detection
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 strategies. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int emboss_matrix[9] = {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* x - 1 x x + 1 */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 2, -1, 0, /* y - 1 */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 -1, 0, 1, /* y */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 0, 1, -2 /* y + 1 */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int laplace_matrix[9] = {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* x - 1 x x + 1 */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 1, 0, 0, /* y - 1 */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 0, 0, 0, /* y */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 0, 0, -1 /* y + 1 */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Value is the intensity of the color whose red/green/blue values
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 are R, G, and B. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define COLOR_INTENSITY(R, G, B) ((2 * (R) + 3 * (G) + (B)) / 6)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* On frame F, return an array of XColor structures describing image
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 IMG->pixmap. Each XColor structure has its pixel color set. RGB_P
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 non-zero means also fill the red/green/blue members of the XColor
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 structures. Value is a pointer to the array of XColors structures,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 allocated with xmalloc; it must be freed by the caller. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static XColor *
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_to_xcolors (f, img, rgb_p)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int rgb_p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int x, y;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XColor *colors, *p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImagePtr_or_DC ximg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 HDC hdc;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 HGDIOBJ prev;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 colors = (XColor *) xmalloc (img->width * img->height * sizeof *colors);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifndef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Get the X image IMG->pixmap. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ximg = XGetImage (FRAME_X_DISPLAY (f), img->pixmap,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 0, 0, img->width, img->height, ~0, ZPixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Load the image into a memory device context. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 hdc = get_frame_dc (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ximg = CreateCompatibleDC (hdc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 release_frame_dc (f, hdc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 prev = SelectObject (ximg, img->pixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Fill the `pixel' members of the XColor array. I wished there
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 were an easy and portable way to circumvent XGetPixel. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p = colors;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (y = 0; y < img->height; ++y)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XColor *row = p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_X_WINDOWS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (x = 0; x < img->width; ++x, ++p)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->pixel = XGetPixel (ximg, x, y);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (rgb_p)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_query_colors (f, row, img->width);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (x = 0; x < img->width; ++x, ++p)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* W32_TODO: palette support needed here? */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->pixel = GET_PIXEL (ximg, x, y);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (rgb_p)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef MAC_OS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->red = RED16_FROM_ULONG (p->pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->green = GREEN16_FROM_ULONG (p->pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->blue = BLUE16_FROM_ULONG (p->pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* MAC_OS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->red = 256 * GetRValue (p->pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->green = 256 * GetGValue (p->pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->blue = 256 * GetBValue (p->pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_X_WINDOWS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Destroy_Image (ximg, prev);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return colors;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Put a pixel of COLOR at position X, Y in XIMG. XIMG must have been
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 created with CreateDIBSection, with the pointer to the bit values
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 stored in ximg->data. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPutPixel (ximg, x, y, color)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImagePtr ximg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int x, y;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 COLORREF color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int width = ximg->info.bmiHeader.biWidth;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int height = ximg->info.bmiHeader.biHeight;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned char * pixel;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* True color images. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (ximg->info.bmiHeader.biBitCount == 24)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int rowbytes = width * 3;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Ensure scanlines are aligned on 4 byte boundaries. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (rowbytes % 4)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 rowbytes += 4 - (rowbytes % 4);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pixel = ximg->data + y * rowbytes + x * 3;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Windows bitmaps are in BGR order. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *pixel = GetBValue (color);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *(pixel + 1) = GetGValue (color);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *(pixel + 2) = GetRValue (color);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Monochrome images. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (ximg->info.bmiHeader.biBitCount == 1)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int rowbytes = width / 8;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Ensure scanlines are aligned on 4 byte boundaries. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (rowbytes % 4)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 rowbytes += 4 - (rowbytes % 4);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pixel = ximg->data + y * rowbytes + x / 8;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Filter out palette info. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (color & 0x00ffffff)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *pixel = *pixel | (1 << x % 8);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *pixel = *pixel & ~(1 << x % 8);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("XPutPixel: palette image not supported", Qnil, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Create IMG->pixmap from an array COLORS of XColor structures, whose
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 RGB members are set. F is the frame on which this all happens.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 COLORS will be freed; an existing IMG->pixmap will be freed, too. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_from_xcolors (f, img, colors)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XColor *colors;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int x, y;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImagePtr oimg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Pixmap pixmap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XColor *p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 init_color_table ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_create_x_image_and_pixmap (f, img->width, img->height, 0,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &oimg, &pixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p = colors;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (y = 0; y < img->height; ++y)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (x = 0; x < img->width; ++x, ++p)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long pixel;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pixel = lookup_rgb_color (f, p->red, p->green, p->blue);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPutPixel (oimg, x, y, pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (colors);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_clear_image_1 (f, img, 1, 0, 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_put_x_image (f, oimg, pixmap, img->width, img->height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_x_image (oimg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->pixmap = pixmap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef COLOR_TABLE_SUPPORT
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->colors = colors_in_color_table (&img->ncolors);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 free_color_table ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* COLOR_TABLE_SUPPORT */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* On frame F, perform edge-detection on image IMG.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 MATRIX is a nine-element array specifying the transformation
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 matrix. See emboss_matrix for an example.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 COLOR_ADJUST is a color adjustment added to each pixel of the
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 outgoing image. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_detect_edges (f, img, matrix, color_adjust)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int matrix[9], color_adjust;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XColor *colors = x_to_xcolors (f, img, 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XColor *new, *p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int x, y, i, sum;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = sum = 0; i < 9; ++i)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 sum += abs (matrix[i]);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define COLOR(A, X, Y) ((A) + (Y) * img->width + (X))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 new = (XColor *) xmalloc (img->width * img->height * sizeof *new);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (y = 0; y < img->height; ++y)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p = COLOR (new, 0, y);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->red = p->green = p->blue = 0xffff/2;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p = COLOR (new, img->width - 1, y);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->red = p->green = p->blue = 0xffff/2;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (x = 1; x < img->width - 1; ++x)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p = COLOR (new, x, 0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->red = p->green = p->blue = 0xffff/2;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p = COLOR (new, x, img->height - 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->red = p->green = p->blue = 0xffff/2;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (y = 1; y < img->height - 1; ++y)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p = COLOR (new, 1, y);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (x = 1; x < img->width - 1; ++x, ++p)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int r, g, b, y1, x1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 r = g = b = i = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (y1 = y - 1; y1 < y + 2; ++y1)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (x1 = x - 1; x1 < x + 2; ++x1, ++i)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (matrix[i])
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XColor *t = COLOR (colors, x1, y1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 r += matrix[i] * t->red;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 g += matrix[i] * t->green;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 b += matrix[i] * t->blue;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 r = (r / sum + color_adjust) & 0xffff;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 g = (g / sum + color_adjust) & 0xffff;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 b = (b / sum + color_adjust) & 0xffff;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->red = p->green = p->blue = COLOR_INTENSITY (r, g, b);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (colors);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_from_xcolors (f, img, new);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #undef COLOR
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Perform the pre-defined `emboss' edge-detection on image IMG
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 on frame F. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_emboss (f, img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_detect_edges (f, img, emboss_matrix, 0xffff / 2);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Transform image IMG which is used on frame F with a Laplace
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 edge-detection algorithm. The result is an image that can be used
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 to draw disabled buttons, for example. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_laplace (f, img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_detect_edges (f, img, laplace_matrix, 45000);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Perform edge-detection on image IMG on frame F, with specified
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 transformation matrix MATRIX and color-adjustment COLOR_ADJUST.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 MATRIX must be either
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 - a list of at least 9 numbers in row-major form
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 - a vector of at least 9 numbers
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 COLOR_ADJUST nil means use a default; otherwise it must be a
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 number. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_edge_detection (f, img, matrix, color_adjust)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object matrix, color_adjust;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int trans[9];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (CONSP (matrix))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 i < 9 && CONSP (matrix) && NUMBERP (XCAR (matrix));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ++i, matrix = XCDR (matrix))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 trans[i] = XFLOATINT (XCAR (matrix));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (VECTORP (matrix) && ASIZE (matrix) >= 9)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = 0; i < 9 && NUMBERP (AREF (matrix, i)); ++i)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 trans[i] = XFLOATINT (AREF (matrix, i));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (NILP (color_adjust))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color_adjust = make_number (0xffff / 2);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (i == 9 && NUMBERP (color_adjust))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_detect_edges (f, img, trans, (int) XFLOATINT (color_adjust));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Transform image IMG on frame F so that it looks disabled. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_disable_image (f, img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int n_planes = dpyinfo->n_planes * dpyinfo->n_cbits;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int n_planes = dpyinfo->n_planes;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (n_planes >= 2)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Color (or grayscale). Convert to gray, and equalize. Just
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 drawing such images with a stipple can look very odd, so
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 we're using this method instead. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XColor *colors = x_to_xcolors (f, img, 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XColor *p, *end;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 const int h = 15000;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 const int l = 30000;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (p = colors, end = colors + img->width * img->height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p < end;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ++p)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i = COLOR_INTENSITY (p->red, p->green, p->blue);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i2 = (0xffff - h - l) * i / 0xffff + l;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p->red = p->green = p->blue = i2;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_from_xcolors (f, img, colors);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Draw a cross over the disabled image, if we must or if we
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 should. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (n_planes < 2 || cross_disabled_images)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifndef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Display *dpy = FRAME_X_DISPLAY (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GC gc;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef MAC_OS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define MaskForeground(f) PIX_MASK_DRAW
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define MaskForeground(f) WHITE_PIX_DEFAULT (f)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gc = XCreateGC (dpy, img->pixmap, 0, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XSetForeground (dpy, gc, BLACK_PIX_DEFAULT (f));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XDrawLine (dpy, img->pixmap, gc, 0, 0,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->width - 1, img->height - 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XDrawLine (dpy, img->pixmap, gc, 0, img->height - 1,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->width - 1, 0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XFreeGC (dpy, gc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (img->mask)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gc = XCreateGC (dpy, img->mask, 0, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XSetForeground (dpy, gc, MaskForeground (f));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XDrawLine (dpy, img->mask, gc, 0, 0,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->width - 1, img->height - 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XDrawLine (dpy, img->mask, gc, 0, img->height - 1,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->width - 1, 0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XFreeGC (dpy, gc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 HDC hdc, bmpdc;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 HGDIOBJ prev;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 hdc = get_frame_dc (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bmpdc = CreateCompatibleDC (hdc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 release_frame_dc (f, hdc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 prev = SelectObject (bmpdc, img->pixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SetTextColor (bmpdc, BLACK_PIX_DEFAULT (f));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 MoveToEx (bmpdc, 0, 0, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LineTo (bmpdc, img->width - 1, img->height - 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 MoveToEx (bmpdc, 0, img->height - 1, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LineTo (bmpdc, img->width - 1, 0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (img->mask)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SelectObject (bmpdc, img->mask);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SetTextColor (bmpdc, WHITE_PIX_DEFAULT (f));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 MoveToEx (bmpdc, 0, 0, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LineTo (bmpdc, img->width - 1, img->height - 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 MoveToEx (bmpdc, 0, img->height - 1, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LineTo (bmpdc, img->width - 1, 0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SelectObject (bmpdc, prev);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DeleteDC (bmpdc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Build a mask for image IMG which is used on frame F. FILE is the
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 name of an image file, for error messages. HOW determines how to
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 determine the background color of IMG. If it is a list '(R G B)',
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 with R, G, and B being integers >= 0, take that as the color of the
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 background. Otherwise, determine the background color of IMG
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 heuristically. Value is non-zero if successful. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_build_heuristic_mask (f, img, how)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object how;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImagePtr_or_DC ximg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifndef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImagePtr mask_img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 HDC frame_dc;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 HGDIOBJ prev;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char *mask_img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int row_width;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int x, y, rc, use_img_background;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long bg = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (img->mask)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Free_Pixmap (FRAME_X_DISPLAY (f), img->mask);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->mask = NO_PIXMAP;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->background_transparent_valid = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifndef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Create an image and pixmap serving as mask. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 rc = x_create_x_image_and_pixmap (f, img->width, img->height, 1,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &mask_img, &img->mask);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!rc)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Get the X image of IMG->pixmap. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ximg = XGetImage (FRAME_X_DISPLAY (f), img->pixmap, 0, 0,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->width, img->height,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ~0, ZPixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Create the bit array serving as mask. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 row_width = (img->width + 7) / 8;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 mask_img = xmalloc (row_width * img->height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bzero (mask_img, row_width * img->height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Create a memory device context for IMG->pixmap. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 frame_dc = get_frame_dc (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ximg = CreateCompatibleDC (frame_dc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 release_frame_dc (f, frame_dc);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 prev = SelectObject (ximg, img->pixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Determine the background color of ximg. If HOW is `(R G B)'
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 take that as color. Otherwise, use the image's background color. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 use_img_background = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (CONSP (how))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int rgb[3], i;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = 0; i < 3 && CONSP (how) && NATNUMP (XCAR (how)); ++i)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 rgb[i] = XFASTINT (XCAR (how)) & 0xffff;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 how = XCDR (how);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (i == 3 && NILP (how))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char color_name[30];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 sprintf (color_name, "#%04x%04x%04x", rgb[0], rgb[1], rgb[2]);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bg = (
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 0x00ffffff & /* Filter out palette info. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_alloc_image_color (f, img, build_string (color_name), 0));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 use_img_background = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (use_img_background)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bg = four_corners_best (ximg, img->corners, img->width, img->height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Set all bits in mask_img to 1 whose color in ximg is different
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 from the background color bg. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifndef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (y = 0; y < img->height; ++y)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (x = 0; x < img->width; ++x)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPutPixel (mask_img, x, y, (XGetPixel (ximg, x, y) != bg
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ? PIX_MASK_DRAW : PIX_MASK_RETAIN));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Fill in the background_transparent field while we have the mask handy. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_background_transparent (img, f, mask_img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Put mask_img into img->mask. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_put_x_image (f, mask_img, img->mask, img->width, img->height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_x_image (mask_img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (y = 0; y < img->height; ++y)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (x = 0; x < img->width; ++x)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 COLORREF p = GetPixel (ximg, x, y);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (p != bg)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 mask_img[y * row_width + x / 8] |= 1 << (x % 8);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Create the mask image. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->mask = w32_create_pixmap_from_bitmap_data (img->width, img->height,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 mask_img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Fill in the background_transparent field while we have the mask handy. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SelectObject (ximg, img->mask);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_background_transparent (img, f, ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Was: x_destroy_x_image ((XImagePtr )mask_img); which seems bogus ++kfs */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (mask_img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Destroy_Image (ximg, prev);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /***********************************************************************
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PBM (mono, gray, color)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ***********************************************************************/
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int pbm_image_p P_ ((Lisp_Object object));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int pbm_load P_ ((struct frame *f, struct image *img));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int pbm_scan_number P_ ((unsigned char **, unsigned char *));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* The symbol `pbm' identifying images of this type. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object Qpbm;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Indices of image specification fields in gs_format, below. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 enum pbm_keyword_index
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PBM_TYPE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PBM_FILE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PBM_DATA,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PBM_ASCENT,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PBM_MARGIN,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PBM_RELIEF,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PBM_ALGORITHM,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PBM_HEURISTIC_MASK,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PBM_MASK,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PBM_FOREGROUND,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PBM_BACKGROUND,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PBM_LAST
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Vector of image_keyword structures describing the format
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 of valid user-defined image specifications. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static struct image_keyword pbm_format[PBM_LAST] =
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":type", IMAGE_SYMBOL_VALUE, 1},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":file", IMAGE_STRING_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":data", IMAGE_STRING_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":ascent", IMAGE_ASCENT_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":relief", IMAGE_INTEGER_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":foreground", IMAGE_STRING_OR_NIL_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":background", IMAGE_STRING_OR_NIL_VALUE, 0}
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Structure describing the image type `pbm'. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static struct image_type pbm_type =
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &Qpbm,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pbm_image_p,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pbm_load,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_clear_image,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 NULL
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Return non-zero if OBJECT is a valid PBM image specification. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pbm_image_p (object)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object object;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image_keyword fmt[PBM_LAST];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bcopy (pbm_format, fmt, sizeof fmt);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!parse_image_spec (object, fmt, PBM_LAST, Qpbm))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Must specify either :data or :file. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return fmt[PBM_DATA].count + fmt[PBM_FILE].count == 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Scan a decimal number from *S and return it. Advance *S while
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 reading the number. END is the end of the string. Value is -1 at
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 end of input. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pbm_scan_number (s, end)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned char **s, *end;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int c = 0, val = -1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 while (*s < end)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Skip white-space. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 while (*s < end && (c = *(*s)++, isspace (c)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (c == '#')
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Skip comment to end of line. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 while (*s < end && (c = *(*s)++, c != '\n'))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (isdigit (c))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Read decimal number. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 val = c - '0';
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 while (*s < end && (c = *(*s)++, isdigit (c)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 val = 10 * val + c - '0';
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return val;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if 0 /* Unused. ++kfs */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Read FILE into memory. Value is a pointer to a buffer allocated
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 with xmalloc holding FILE's contents. Value is null if an error
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 occurred. *SIZE is set to the size of the file. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static char *
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pbm_read_file (file, size)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object file;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int *size;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FILE *fp = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char *buf = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct stat st;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (stat (SDATA (file), &st) == 0
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && (fp = fopen (SDATA (file), "rb")) != NULL
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && (buf = (char *) xmalloc (st.st_size),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fread (buf, 1, st.st_size, fp) == st.st_size))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 *size = st.st_size;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fclose (fp);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (fp)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fclose (fp);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (buf)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (buf);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 buf = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return buf;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Load PBM image IMG for use on frame F. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pbm_load (f, img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int raw_p, x, y;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int width, height, max_color_idx = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImagePtr ximg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object file, specified_file;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 enum {PBM_MONO, PBM_GRAY, PBM_COLOR} type;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct gcpro gcpro1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned char *contents = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned char *end, *p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int size;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 specified_file = image_spec_value (img->spec, QCfile, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 file = Qnil;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GCPRO1 (file);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (STRINGP (specified_file))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 file = x_find_image_file (specified_file);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!STRINGP (file))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Cannot find image file `%s'", specified_file, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 contents = slurp_file (SDATA (file), &size);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (contents == NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Error reading `%s'", file, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p = contents;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 end = contents + size;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 data = image_spec_value (img->spec, QCdata, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 p = SDATA (data);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 end = p + SBYTES (data);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Check magic number. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (end - p < 2 || *p++ != 'P')
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Not a PBM image: `%s'", img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 error:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (contents);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 switch (*p++)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 case '1':
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 raw_p = 0, type = PBM_MONO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 case '2':
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 raw_p = 0, type = PBM_GRAY;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 case '3':
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 raw_p = 0, type = PBM_COLOR;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 case '4':
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 raw_p = 1, type = PBM_MONO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 case '5':
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 raw_p = 1, type = PBM_GRAY;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 case '6':
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 raw_p = 1, type = PBM_COLOR;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 default:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Not a PBM image: `%s'", img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Read width, height, maximum color-component. Characters
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 starting with `#' up to the end of a line are ignored. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 width = pbm_scan_number (&p, end);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 height = pbm_scan_number (&p, end);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (type != PBM_MONO)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 max_color_idx = pbm_scan_number (&p, end);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (raw_p && max_color_idx > 255)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 max_color_idx = 255;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!check_image_size (f, width, height)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 || (type != PBM_MONO && max_color_idx < 0))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!x_create_x_image_and_pixmap (f, width, height, 0,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &ximg, &img->pixmap))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Initialize the color hash table. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 init_color_table ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (type == PBM_MONO)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int c = 0, g;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image_keyword fmt[PBM_LAST];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long fg = FRAME_FOREGROUND_PIXEL (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long bg = FRAME_BACKGROUND_PIXEL (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Parse the image specification. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bcopy (pbm_format, fmt, sizeof fmt);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 parse_image_spec (img->spec, fmt, PBM_LAST, Qpbm);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Get foreground and background colors, maybe allocate colors. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (fmt[PBM_FOREGROUND].count
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && STRINGP (fmt[PBM_FOREGROUND].value))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fg = x_alloc_image_color (f, img, fmt[PBM_FOREGROUND].value, fg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (fmt[PBM_BACKGROUND].count
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && STRINGP (fmt[PBM_BACKGROUND].value))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bg = x_alloc_image_color (f, img, fmt[PBM_BACKGROUND].value, bg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->background = bg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->background_valid = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (y = 0; y < height; ++y)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (x = 0; x < width; ++x)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (raw_p)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if ((x & 7) == 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (p >= end)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_x_image (ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_clear_image (f, img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Invalid image size in image `%s'",
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 c = *p++;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 g = c & 0x80;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 c <<= 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 g = pbm_scan_number (&p, end);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPutPixel (ximg, x, y, g ? fg : bg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (raw_p
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && ((type == PBM_GRAY)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ? (p + height * width > end)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 : (p + 3 * height * width > end)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_x_image (ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_clear_image (f, img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Invalid image size in image `%s'",
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (y = 0; y < height; ++y)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (x = 0; x < width; ++x)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int r, g, b;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (type == PBM_GRAY)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 r = g = b = raw_p ? *p++ : pbm_scan_number (&p, end);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (raw_p)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 r = *p++;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 g = *p++;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 b = *p++;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 r = pbm_scan_number (&p, end);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 g = pbm_scan_number (&p, end);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 b = pbm_scan_number (&p, end);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (r < 0 || g < 0 || b < 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_x_image (ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Invalid pixel value in image `%s'",
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* RGB values are now in the range 0..max_color_idx.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Scale this to the range 0..0xffff supported by X. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 r = (double) r * 65535 / max_color_idx;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 g = (double) g * 65535 / max_color_idx;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 b = (double) b * 65535 / max_color_idx;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPutPixel (ximg, x, y, lookup_rgb_color (f, r, g, b));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef COLOR_TABLE_SUPPORT
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Store in IMG->colors the colors allocated for the image, and
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 free the color table. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->colors = colors_in_color_table (&img->ncolors);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 free_color_table ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* COLOR_TABLE_SUPPORT */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->width = width;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->height = height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Maybe fill in the background field while we have ximg handy. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Casting avoids a GCC warning. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Put the image into a pixmap. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_put_x_image (f, ximg, img->pixmap, width, height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_x_image (ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* X and W32 versions did it here, MAC version above. ++kfs
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->width = width;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->height = height; */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (contents);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /***********************************************************************
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PNG
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ***********************************************************************/
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (HAVE_PNG) || defined (MAC_OS)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Function prototypes. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int png_image_p P_ ((Lisp_Object object));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int png_load P_ ((struct frame *f, struct image *img));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* The symbol `png' identifying images of this type. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object Qpng;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Indices of image specification fields in png_format, below. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 enum png_keyword_index
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PNG_TYPE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PNG_DATA,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PNG_FILE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PNG_ASCENT,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PNG_MARGIN,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PNG_RELIEF,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PNG_ALGORITHM,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PNG_HEURISTIC_MASK,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PNG_MASK,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PNG_BACKGROUND,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PNG_LAST
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Vector of image_keyword structures describing the format
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 of valid user-defined image specifications. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static struct image_keyword png_format[PNG_LAST] =
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":type", IMAGE_SYMBOL_VALUE, 1},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":data", IMAGE_STRING_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":file", IMAGE_STRING_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":ascent", IMAGE_ASCENT_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":relief", IMAGE_INTEGER_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":background", IMAGE_STRING_OR_NIL_VALUE, 0}
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Structure describing the image type `png'. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static struct image_type png_type =
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &Qpng,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_image_p,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_load,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_clear_image,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 NULL
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Return non-zero if OBJECT is a valid PNG image specification. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_image_p (object)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object object;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image_keyword fmt[PNG_LAST];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bcopy (png_format, fmt, sizeof fmt);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!parse_image_spec (object, fmt, PNG_LAST, Qpng))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Must specify either the :data or :file keyword. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return fmt[PNG_FILE].count + fmt[PNG_DATA].count == 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_PNG || MAC_OS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_PNG
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined HAVE_LIBPNG_PNG_H
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 # include <libpng/png.h>
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 # include <png.h>
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* PNG library details. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (png_get_io_ptr);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (png_check_sig);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (png_create_read_struct);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (png_create_info_struct);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (png_destroy_read_struct);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (png_set_read_fn);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (png_set_sig_bytes);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (png_read_info);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (png_get_IHDR);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (png_get_valid);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (png_set_strip_16);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (png_set_expand);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (png_set_gray_to_rgb);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (png_set_background);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (png_get_bKGD);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (png_read_update_info);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (png_get_channels);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (png_get_rowbytes);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (png_read_image);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (png_read_end);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (png_error);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 init_png_functions (Lisp_Object libraries)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 HMODULE library;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Try loading libpng under probable names. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!(library = w32_delayed_load (libraries, Qpng)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, png_get_io_ptr);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, png_check_sig);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, png_create_read_struct);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, png_create_info_struct);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, png_destroy_read_struct);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, png_set_read_fn);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, png_set_sig_bytes);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, png_read_info);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, png_get_IHDR);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, png_get_valid);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, png_set_strip_16);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, png_set_expand);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, png_set_gray_to_rgb);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, png_set_background);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, png_get_bKGD);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, png_read_update_info);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, png_get_channels);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, png_get_rowbytes);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, png_read_image);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, png_read_end);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, png_error);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_png_get_io_ptr png_get_io_ptr
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_png_check_sig png_check_sig
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_png_create_read_struct png_create_read_struct
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_png_create_info_struct png_create_info_struct
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_png_destroy_read_struct png_destroy_read_struct
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_png_set_read_fn png_set_read_fn
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_png_set_sig_bytes png_set_sig_bytes
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_png_read_info png_read_info
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_png_get_IHDR png_get_IHDR
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_png_get_valid png_get_valid
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_png_set_strip_16 png_set_strip_16
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_png_set_expand png_set_expand
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_png_set_gray_to_rgb png_set_gray_to_rgb
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_png_set_background png_set_background
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_png_get_bKGD png_get_bKGD
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_png_read_update_info png_read_update_info
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_png_get_channels png_get_channels
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_png_get_rowbytes png_get_rowbytes
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_png_read_image png_read_image
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_png_read_end png_read_end
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_png_error png_error
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Error and warning handlers installed when the PNG library
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 is initialized. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 my_png_error (png_ptr, msg)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_struct *png_ptr;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char *msg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xassert (png_ptr != NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("PNG error: %s", build_string (msg), Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 longjmp (png_ptr->jmpbuf, 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 my_png_warning (png_ptr, msg)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_struct *png_ptr;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char *msg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xassert (png_ptr != NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("PNG warning: %s", build_string (msg), Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Memory source for PNG decoding. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct png_memory_storage
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned char *bytes; /* The data */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 size_t len; /* How big is it? */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int index; /* Where are we? */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Function set as reader function when reading PNG image from memory.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PNG_PTR is a pointer to the PNG control structure. Copy LENGTH
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bytes from the input to DATA. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_read_from_memory (png_ptr, data, length)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_structp png_ptr;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_bytep data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_size_t length;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct png_memory_storage *tbr
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 = (struct png_memory_storage *) fn_png_get_io_ptr (png_ptr);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (length > tbr->len - tbr->index)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_png_error (png_ptr, "Read error");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bcopy (tbr->bytes + tbr->index, data, length);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tbr->index = tbr->index + length;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Function set as reader function when reading PNG image from a file.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PNG_PTR is a pointer to the PNG control structure. Copy LENGTH
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bytes from the input to DATA. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_read_from_file (png_ptr, data, length)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_structp png_ptr;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_bytep data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_size_t length;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FILE *fp = (FILE *) fn_png_get_io_ptr (png_ptr);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (fread (data, 1, length, fp) < length)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_png_error (png_ptr, "Read error");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Load PNG image IMG for use on frame F. Value is non-zero if
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 successful. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_load (f, img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object file, specified_file;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object specified_data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int x, y, i;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImagePtr ximg, mask_img = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct gcpro gcpro1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_struct *png_ptr = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_info *info_ptr = NULL, *end_info = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FILE *volatile fp = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_byte sig[8];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_byte * volatile pixels = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_byte ** volatile rows = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_uint_32 width, height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int bit_depth, color_type, interlace_type;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_byte channels;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_uint_32 row_bytes;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int transparent_p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 double screen_gamma;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct png_memory_storage tbr; /* Data to be read */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Find out what file to load. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 specified_file = image_spec_value (img->spec, QCfile, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 specified_data = image_spec_value (img->spec, QCdata, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 file = Qnil;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GCPRO1 (file);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (NILP (specified_data))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 file = x_find_image_file (specified_file);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!STRINGP (file))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Cannot find image file `%s'", specified_file, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Open the image file. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fp = fopen (SDATA (file), "rb");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!fp)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Cannot open image file `%s'", file, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Check PNG signature. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (fread (sig, 1, sizeof sig, fp) != sizeof sig
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 || !fn_png_check_sig (sig, sizeof sig))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Not a PNG file: `%s'", file, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fclose (fp);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Read from memory. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tbr.bytes = SDATA (specified_data);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tbr.len = SBYTES (specified_data);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tbr.index = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Check PNG signature. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (tbr.len < sizeof sig
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 || !fn_png_check_sig (tbr.bytes, sizeof sig))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Not a PNG image: `%s'", img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Need to skip past the signature. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tbr.bytes += sizeof (sig);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Initialize read and info structs for PNG lib. Casting return
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 value avoids a GCC warning on W32. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_ptr = (png_structp)fn_png_create_read_struct (PNG_LIBPNG_VER_STRING,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 NULL, my_png_error,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 my_png_warning);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!png_ptr)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (fp) fclose (fp);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Casting return value avoids a GCC warning on W32. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 info_ptr = (png_infop)fn_png_create_info_struct (png_ptr);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!info_ptr)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_png_destroy_read_struct (&png_ptr, NULL, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (fp) fclose (fp);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Casting return value avoids a GCC warning on W32. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 end_info = (png_infop)fn_png_create_info_struct (png_ptr);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!end_info)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (fp) fclose (fp);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Set error jump-back. We come back here when the PNG library
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 detects an error. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (setjmp (png_ptr->jmpbuf))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 error:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (png_ptr)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_png_destroy_read_struct (&png_ptr, &info_ptr, &end_info);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (pixels);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (rows);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (fp) fclose (fp);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Read image info. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!NILP (specified_data))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_png_set_read_fn (png_ptr, (void *) &tbr, png_read_from_memory);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_png_set_read_fn (png_ptr, (void *) fp, png_read_from_file);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_png_set_sig_bytes (png_ptr, sizeof sig);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_png_read_info (png_ptr, info_ptr);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_png_get_IHDR (png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &interlace_type, NULL, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!check_image_size (f, width, height))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* If image contains simply transparency data, we prefer to
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 construct a clipping mask. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (fn_png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 transparent_p = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 transparent_p = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* This function is easier to write if we only have to handle
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 one data format: RGB or RGBA with 8 bits per channel. Let's
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 transform other formats into that format. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Strip more than 8 bits per channel. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (bit_depth == 16)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_png_set_strip_16 (png_ptr);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Expand data to 24 bit RGB, or 8 bit grayscale, with alpha channel
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if available. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_png_set_expand (png_ptr);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Convert grayscale images to RGB. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (color_type == PNG_COLOR_TYPE_GRAY
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 || color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_png_set_gray_to_rgb (png_ptr);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 screen_gamma = (f->gamma ? 1 / f->gamma / 0.45455 : 2.2);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if 0 /* Avoid double gamma correction for PNG images. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 { /* Tell the PNG lib to handle gamma correction for us. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int intent;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 double image_gamma;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #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);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* if 0 */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Handle alpha channel by combining the image with a background
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color. Do this only if a real alpha channel is supplied. For
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 simple transparency, we prefer a clipping mask. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!transparent_p)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_color_16 *image_bg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object specified_bg
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 = image_spec_value (img->spec, QCbackground, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (STRINGP (specified_bg))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* The user specified `:background', use that. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* W32 version incorrectly used COLORREF here!! ++kfs */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XColor color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (x_defined_color (f, SDATA (specified_bg), &color, 0))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_color_16 user_bg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bzero (&user_bg, sizeof user_bg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 user_bg.red = color.red >> 8;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 user_bg.green = color.green >> 8;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 user_bg.blue = color.blue >> 8;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_png_set_background (png_ptr, &user_bg,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* The commented-out code checked if the png specifies a default
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 background color, and uses that. Since we use the current
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 frame background, it is OK for us to ignore this.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (fn_png_get_bKGD (png_ptr, info_ptr, &image_bg))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_png_set_background (png_ptr, image_bg,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Image does not contain a background color with which
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 to combine the image data via an alpha channel. Use
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 the frame's background instead. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_X_WINDOWS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XColor color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_color_16 frame_background;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color.pixel = FRAME_BACKGROUND_PIXEL (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_query_color (f, &color);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bzero (&frame_background, sizeof frame_background);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 frame_background.red = color.red >> 8;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 frame_background.green = color.green >> 8;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 frame_background.blue = color.blue >> 8;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_X_WINDOWS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 COLORREF color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_color_16 frame_background;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color = FRAME_BACKGROUND_PIXEL (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if 0 /* W32 TODO : Colormap support. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_query_color (f, &color);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bzero (&frame_background, sizeof frame_background);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 frame_background.red = GetRValue (color);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 frame_background.green = GetGValue (color);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 frame_background.blue = GetBValue (color);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef MAC_OS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_color_16 frame_background;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color = FRAME_BACKGROUND_PIXEL (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if 0 /* MAC/W32 TODO : Colormap support. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_query_color (f, &color);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bzero (&frame_background, sizeof frame_background);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 frame_background.red = RED_FROM_ULONG (color);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 frame_background.green = GREEN_FROM_ULONG (color);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 frame_background.blue = BLUE_FROM_ULONG (color);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* MAC_OS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_png_set_background (png_ptr, &frame_background,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Update info structure. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_png_read_update_info (png_ptr, info_ptr);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Get number of channels. Valid values are 1 for grayscale images
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 and images with a palette, 2 for grayscale images with transparency
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 information (alpha channel), 3 for RGB images, and 4 for RGB
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 images with alpha channel, i.e. RGBA. If conversions above were
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 sufficient we should only have 3 or 4 channels here. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 channels = fn_png_get_channels (png_ptr, info_ptr);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xassert (channels == 3 || channels == 4);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Number of bytes needed for one row of the image. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 row_bytes = fn_png_get_rowbytes (png_ptr, info_ptr);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Allocate memory for the image. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pixels = (png_byte *) xmalloc (row_bytes * height * sizeof *pixels);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 rows = (png_byte **) xmalloc (height * sizeof *rows);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = 0; i < height; ++i)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 rows[i] = pixels + i * row_bytes;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Read the entire image. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_png_read_image (png_ptr, rows);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_png_read_end (png_ptr, info_ptr);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (fp)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fclose (fp);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fp = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Create the X image and pixmap. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &img->pixmap))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Create an image and pixmap serving as mask if the PNG image
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 contains an alpha channel. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (channels == 4
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && !transparent_p
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && !x_create_x_image_and_pixmap (f, width, height, 1,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &mask_img, &img->mask))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_x_image (ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Free_Pixmap (FRAME_X_DISPLAY (f), img->pixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->pixmap = NO_PIXMAP;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Fill the X image and mask from PNG data. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 init_color_table ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (y = 0; y < height; ++y)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_byte *p = rows[y];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (x = 0; x < width; ++x)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned r, g, b;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 r = *p++ << 8;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 g = *p++ << 8;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 b = *p++ << 8;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPutPixel (ximg, x, y, lookup_rgb_color (f, r, g, b));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* An alpha channel, aka mask channel, associates variable
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 transparency with an image. Where other image formats
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 support binary transparency---fully transparent or fully
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 opaque---PNG allows up to 254 levels of partial transparency.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 The PNG library implements partial transparency by combining
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 the image with a specified background color.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 I'm not sure how to handle this here nicely: because the
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 background on which the image is displayed may change, for
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 real alpha channel support, it would be necessary to create
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 a new image for each possible background.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 What I'm doing now is that a mask is created if we have
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 boolean transparency information. Otherwise I'm using
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 the frame's background color to combine the image with. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (channels == 4)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (mask_img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPutPixel (mask_img, x, y, *p > 0 ? PIX_MASK_DRAW : PIX_MASK_RETAIN);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ++p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Set IMG's background color from the PNG image, unless the user
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 overrode it. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_color_16 *bg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (fn_png_get_bKGD (png_ptr, info_ptr, &bg))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->background = lookup_rgb_color (f, bg->red, bg->green, bg->blue);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->background_valid = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef COLOR_TABLE_SUPPORT
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Remember colors allocated for this image. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->colors = colors_in_color_table (&img->ncolors);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 free_color_table ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* COLOR_TABLE_SUPPORT */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Clean up. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_png_destroy_read_struct (&png_ptr, &info_ptr, &end_info);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (rows);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (pixels);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->width = width;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->height = height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Maybe fill in the background field while we have ximg handy.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Casting avoids a GCC warning. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Put the image into the pixmap, then free the X image and its buffer. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_put_x_image (f, ximg, img->pixmap, width, height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_x_image (ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Same for the mask. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (mask_img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Fill in the background_transparent field while we have the
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 mask handy. Casting avoids a GCC warning. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_background_transparent (img, f, (XImagePtr_or_DC)mask_img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_put_x_image (f, mask_img, img->mask, img->width, img->height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_x_image (mask_img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else /* HAVE_PNG */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef MAC_OS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 png_load (f, img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef MAC_OSX
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (MyCGImageCreateWithPNGDataProvider)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return image_load_quartz2d (f, img, 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return image_load_quicktime (f, img, kQTFileTypePNG);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* MAC_OS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* !HAVE_PNG */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /***********************************************************************
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 JPEG
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ***********************************************************************/
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (HAVE_JPEG) || defined (MAC_OS)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int jpeg_image_p P_ ((Lisp_Object object));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int jpeg_load P_ ((struct frame *f, struct image *img));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* The symbol `jpeg' identifying images of this type. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object Qjpeg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Indices of image specification fields in gs_format, below. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 enum jpeg_keyword_index
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 JPEG_TYPE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 JPEG_DATA,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 JPEG_FILE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 JPEG_ASCENT,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 JPEG_MARGIN,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 JPEG_RELIEF,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 JPEG_ALGORITHM,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 JPEG_HEURISTIC_MASK,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 JPEG_MASK,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 JPEG_BACKGROUND,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 JPEG_LAST
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Vector of image_keyword structures describing the format
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 of valid user-defined image specifications. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static struct image_keyword jpeg_format[JPEG_LAST] =
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":type", IMAGE_SYMBOL_VALUE, 1},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":data", IMAGE_STRING_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":file", IMAGE_STRING_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":ascent", IMAGE_ASCENT_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":relief", IMAGE_INTEGER_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":conversions", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":background", IMAGE_STRING_OR_NIL_VALUE, 0}
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Structure describing the image type `jpeg'. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static struct image_type jpeg_type =
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &Qjpeg,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 jpeg_image_p,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 jpeg_load,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_clear_image,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 NULL
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Return non-zero if OBJECT is a valid JPEG image specification. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 jpeg_image_p (object)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object object;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image_keyword fmt[JPEG_LAST];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bcopy (jpeg_format, fmt, sizeof fmt);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!parse_image_spec (object, fmt, JPEG_LAST, Qjpeg))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Must specify either the :data or :file keyword. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return fmt[JPEG_FILE].count + fmt[JPEG_DATA].count == 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_JPEG || MAC_OS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_JPEG
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Work around a warning about HAVE_STDLIB_H being redefined in
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 jconfig.h. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_STDLIB_H
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define HAVE_STDLIB_H_1
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #undef HAVE_STDLIB_H
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_STLIB_H */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (HAVE_NTGUI) && !defined (__WIN32__)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* In older releases of the jpeg library, jpeglib.h will define boolean
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 differently depending on __WIN32__, so make sure it is defined. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define __WIN32__ 1
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include <jpeglib.h>
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include <jerror.h>
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include <setjmp.h>
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_STLIB_H_1
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define HAVE_STDLIB_H 1
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* JPEG library details. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (jpeg_CreateDecompress);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (jpeg_start_decompress);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (jpeg_finish_decompress);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (jpeg_destroy_decompress);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (jpeg_read_header);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (jpeg_read_scanlines);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (jpeg_std_error);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (jpeg_resync_to_restart);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 init_jpeg_functions (Lisp_Object libraries)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 HMODULE library;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!(library = w32_delayed_load (libraries, Qjpeg)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, jpeg_finish_decompress);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, jpeg_read_scanlines);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, jpeg_start_decompress);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, jpeg_read_header);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, jpeg_CreateDecompress);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, jpeg_destroy_decompress);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, jpeg_std_error);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, jpeg_resync_to_restart);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Wrapper since we can't directly assign the function pointer
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 to another function pointer that was declared more completely easily. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static boolean
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 jpeg_resync_to_restart_wrapper (cinfo, desired)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 j_decompress_ptr cinfo;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int desired;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return fn_jpeg_resync_to_restart (cinfo, desired);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_jpeg_CreateDecompress(a,b,c) jpeg_create_decompress(a)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_jpeg_start_decompress jpeg_start_decompress
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_jpeg_finish_decompress jpeg_finish_decompress
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_jpeg_destroy_decompress jpeg_destroy_decompress
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_jpeg_read_header jpeg_read_header
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_jpeg_read_scanlines jpeg_read_scanlines
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_jpeg_std_error jpeg_std_error
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define jpeg_resync_to_restart_wrapper jpeg_resync_to_restart
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct my_jpeg_error_mgr
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct jpeg_error_mgr pub;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 jmp_buf setjmp_buffer;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 my_error_exit (cinfo)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 j_common_ptr cinfo;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct my_jpeg_error_mgr *mgr = (struct my_jpeg_error_mgr *) cinfo->err;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 longjmp (mgr->setjmp_buffer, 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Init source method for JPEG data source manager. Called by
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 jpeg_read_header() before any data is actually read. See
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 libjpeg.doc from the JPEG lib distribution. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 our_common_init_source (cinfo)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 j_decompress_ptr cinfo;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Method to terminate data source. Called by
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 jpeg_finish_decompress() after all data has been processed. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 our_common_term_source (cinfo)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 j_decompress_ptr cinfo;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Fill input buffer method for JPEG data source manager. Called
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 whenever more data is needed. We read the whole image in one step,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 so this only adds a fake end of input marker at the end. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static boolean
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 our_memory_fill_input_buffer (cinfo)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 j_decompress_ptr cinfo;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Insert a fake EOI marker. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct jpeg_source_mgr *src = cinfo->src;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static JOCTET buffer[2];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 buffer[0] = (JOCTET) 0xFF;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 buffer[1] = (JOCTET) JPEG_EOI;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->next_input_byte = buffer;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->bytes_in_buffer = 2;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Method to skip over NUM_BYTES bytes in the image data. CINFO->src
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 is the JPEG data source manager. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 our_memory_skip_input_data (cinfo, num_bytes)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 j_decompress_ptr cinfo;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 long num_bytes;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct jpeg_source_mgr *src = (struct jpeg_source_mgr *) cinfo->src;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (src)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (num_bytes > src->bytes_in_buffer)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ERREXIT (cinfo, JERR_INPUT_EOF);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->bytes_in_buffer -= num_bytes;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->next_input_byte += num_bytes;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Set up the JPEG lib for reading an image from DATA which contains
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LEN bytes. CINFO is the decompression info structure created for
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 reading the image. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 jpeg_memory_src (cinfo, data, len)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 j_decompress_ptr cinfo;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 JOCTET *data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned int len;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct jpeg_source_mgr *src;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (cinfo->src == NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* First time for this JPEG object? */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 cinfo->src = (struct jpeg_source_mgr *)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 sizeof (struct jpeg_source_mgr));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src = (struct jpeg_source_mgr *) cinfo->src;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->next_input_byte = data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src = (struct jpeg_source_mgr *) cinfo->src;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->init_source = our_common_init_source;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->fill_input_buffer = our_memory_fill_input_buffer;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->skip_input_data = our_memory_skip_input_data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->resync_to_restart = jpeg_resync_to_restart_wrapper; /* Use default method. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->term_source = our_common_term_source;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->bytes_in_buffer = len;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->next_input_byte = data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct jpeg_stdio_mgr
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct jpeg_source_mgr mgr;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 boolean finished;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FILE *file;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 JOCTET *buffer;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Size of buffer to read JPEG from file.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Not too big, as we want to use alloc_small. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define JPEG_STDIO_BUFFER_SIZE 8192
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Fill input buffer method for JPEG data source manager. Called
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 whenever more data is needed. The data is read from a FILE *. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static boolean
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 our_stdio_fill_input_buffer (cinfo)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 j_decompress_ptr cinfo;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct jpeg_stdio_mgr *src;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src = (struct jpeg_stdio_mgr *) cinfo->src;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!src->finished)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 size_t bytes;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bytes = fread (src->buffer, 1, JPEG_STDIO_BUFFER_SIZE, src->file);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (bytes > 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->mgr.bytes_in_buffer = bytes;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 WARNMS (cinfo, JWRN_JPEG_EOF);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->finished = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->buffer[0] = (JOCTET) 0xFF;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->buffer[1] = (JOCTET) JPEG_EOI;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->mgr.bytes_in_buffer = 2;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->mgr.next_input_byte = src->buffer;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Method to skip over NUM_BYTES bytes in the image data. CINFO->src
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 is the JPEG data source manager. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 our_stdio_skip_input_data (cinfo, num_bytes)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 j_decompress_ptr cinfo;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 long num_bytes;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct jpeg_stdio_mgr *src;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src = (struct jpeg_stdio_mgr *) cinfo->src;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 while (num_bytes > 0 && !src->finished)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (num_bytes <= src->mgr.bytes_in_buffer)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->mgr.bytes_in_buffer -= num_bytes;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->mgr.next_input_byte += num_bytes;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 num_bytes -= src->mgr.bytes_in_buffer;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->mgr.bytes_in_buffer = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->mgr.next_input_byte = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 our_stdio_fill_input_buffer (cinfo);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Set up the JPEG lib for reading an image from a FILE *.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CINFO is the decompression info structure created for
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 reading the image. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 jpeg_file_src (cinfo, fp)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 j_decompress_ptr cinfo;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FILE *fp;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct jpeg_stdio_mgr *src;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (cinfo->src != NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src = (struct jpeg_stdio_mgr *) cinfo->src;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* First time for this JPEG object? */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 cinfo->src = (struct jpeg_source_mgr *)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 sizeof (struct jpeg_stdio_mgr));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src = (struct jpeg_stdio_mgr *) cinfo->src;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->buffer = (JOCTET *)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 JPEG_STDIO_BUFFER_SIZE);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->file = fp;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->finished = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->mgr.init_source = our_common_init_source;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->mgr.fill_input_buffer = our_stdio_fill_input_buffer;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->mgr.skip_input_data = our_stdio_skip_input_data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->mgr.resync_to_restart = jpeg_resync_to_restart_wrapper; /* Use default method. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->mgr.term_source = our_common_term_source;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->mgr.bytes_in_buffer = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->mgr.next_input_byte = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Load image IMG for use on frame F. Patterned after example.c
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 from the JPEG lib. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 jpeg_load (f, img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct jpeg_decompress_struct cinfo;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct my_jpeg_error_mgr mgr;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object file, specified_file;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object specified_data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FILE * volatile fp = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 JSAMPARRAY buffer;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int row_stride, x, y;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImagePtr ximg = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int rc;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long *colors;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int width, height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct gcpro gcpro1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Open the JPEG file. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 specified_file = image_spec_value (img->spec, QCfile, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 specified_data = image_spec_value (img->spec, QCdata, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 file = Qnil;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GCPRO1 (file);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (NILP (specified_data))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 file = x_find_image_file (specified_file);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!STRINGP (file))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Cannot find image file `%s'", specified_file, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fp = fopen (SDATA (file), "rb");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (fp == NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Cannot open `%s'", file, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Customize libjpeg's error handling to call my_error_exit when an
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 error is detected. This function will perform a longjmp.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Casting return value avoids a GCC warning on W32. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 cinfo.err = (struct jpeg_error_mgr *)fn_jpeg_std_error (&mgr.pub);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 mgr.pub.error_exit = my_error_exit;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if ((rc = setjmp (mgr.setjmp_buffer)) != 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (rc == 1)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Called from my_error_exit. Display a JPEG error. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char buffer[JMSG_LENGTH_MAX];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 cinfo.err->format_message ((j_common_ptr) &cinfo, buffer);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Error reading JPEG image `%s': %s", img->spec,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 build_string (buffer));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Close the input file and destroy the JPEG object. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (fp)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fclose ((FILE *) fp);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_jpeg_destroy_decompress (&cinfo);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* If we already have an XImage, free that. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_x_image (ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Free pixmap and colors. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_clear_image (f, img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Create the JPEG decompression object. Let it read from fp.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Read the JPEG image header. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_jpeg_CreateDecompress (&cinfo, JPEG_LIB_VERSION, sizeof (cinfo));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (NILP (specified_data))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 jpeg_file_src (&cinfo, (FILE *) fp);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 jpeg_memory_src (&cinfo, SDATA (specified_data),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SBYTES (specified_data));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_jpeg_read_header (&cinfo, 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Customize decompression so that color quantization will be used.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Start decompression. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 cinfo.quantize_colors = 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_jpeg_start_decompress (&cinfo);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 width = img->width = cinfo.output_width;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 height = img->height = cinfo.output_height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!check_image_size (f, width, height))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Invalid image size", Qnil, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 longjmp (mgr.setjmp_buffer, 2);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Create X image and pixmap. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 longjmp (mgr.setjmp_buffer, 2);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Allocate colors. When color quantization is used,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 cinfo.actual_number_of_colors has been set with the number of
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 colors generated, and cinfo.colormap is a two-dimensional array
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 of color indices in the range 0..cinfo.actual_number_of_colors.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 No more than 255 colors will be generated. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i, ir, ig, ib;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (cinfo.out_color_components > 2)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ir = 0, ig = 1, ib = 2;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (cinfo.out_color_components > 1)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ir = 0, ig = 1, ib = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ir = 0, ig = 0, ib = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Use the color table mechanism because it handles colors that
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 cannot be allocated nicely. Such colors will be replaced with
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 a default color, and we don't have to care about which colors
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 can be freed safely, and which can't. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 init_color_table ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 colors = (unsigned long *) alloca (cinfo.actual_number_of_colors
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 * sizeof *colors);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = 0; i < cinfo.actual_number_of_colors; ++i)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Multiply RGB values with 255 because X expects RGB values
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 in the range 0..0xffff. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int r = cinfo.colormap[ir][i] << 8;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int g = cinfo.colormap[ig][i] << 8;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int b = cinfo.colormap[ib][i] << 8;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 colors[i] = lookup_rgb_color (f, r, g, b);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef COLOR_TABLE_SUPPORT
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Remember those colors actually allocated. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->colors = colors_in_color_table (&img->ncolors);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 free_color_table ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* COLOR_TABLE_SUPPORT */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Read pixels. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 row_stride = width * cinfo.output_components;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 buffer = cinfo.mem->alloc_sarray ((j_common_ptr) &cinfo, JPOOL_IMAGE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 row_stride, 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (y = 0; y < height; ++y)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_jpeg_read_scanlines (&cinfo, buffer, 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (x = 0; x < cinfo.output_width; ++x)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPutPixel (ximg, x, y, colors[buffer[0][x]]);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Clean up. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_jpeg_finish_decompress (&cinfo);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_jpeg_destroy_decompress (&cinfo);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (fp)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fclose ((FILE *) fp);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Maybe fill in the background field while we have ximg handy. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Casting avoids a GCC warning. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Put the image into the pixmap. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_put_x_image (f, ximg, img->pixmap, width, height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_x_image (ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else /* HAVE_JPEG */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef MAC_OS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 jpeg_load (f, img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef MAC_OSX
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return image_load_quartz2d (f, img, 0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return image_load_quicktime (f, img, kQTFileTypeJPEG);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* MAC_OS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* !HAVE_JPEG */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /***********************************************************************
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 TIFF
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ***********************************************************************/
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (HAVE_TIFF) || defined (MAC_OS)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int tiff_image_p P_ ((Lisp_Object object));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int tiff_load P_ ((struct frame *f, struct image *img));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* The symbol `tiff' identifying images of this type. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object Qtiff;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Indices of image specification fields in tiff_format, below. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 enum tiff_keyword_index
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 TIFF_TYPE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 TIFF_DATA,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 TIFF_FILE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 TIFF_ASCENT,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 TIFF_MARGIN,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 TIFF_RELIEF,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 TIFF_ALGORITHM,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 TIFF_HEURISTIC_MASK,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 TIFF_MASK,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 TIFF_BACKGROUND,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 TIFF_LAST
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Vector of image_keyword structures describing the format
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 of valid user-defined image specifications. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static struct image_keyword tiff_format[TIFF_LAST] =
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":type", IMAGE_SYMBOL_VALUE, 1},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":data", IMAGE_STRING_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":file", IMAGE_STRING_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":ascent", IMAGE_ASCENT_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":relief", IMAGE_INTEGER_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":conversions", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":background", IMAGE_STRING_OR_NIL_VALUE, 0}
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Structure describing the image type `tiff'. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static struct image_type tiff_type =
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &Qtiff,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tiff_image_p,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tiff_load,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_clear_image,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 NULL
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Return non-zero if OBJECT is a valid TIFF image specification. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tiff_image_p (object)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object object;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image_keyword fmt[TIFF_LAST];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bcopy (tiff_format, fmt, sizeof fmt);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!parse_image_spec (object, fmt, TIFF_LAST, Qtiff))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Must specify either the :data or :file keyword. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return fmt[TIFF_FILE].count + fmt[TIFF_DATA].count == 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_TIFF || MAC_OS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_TIFF
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include <tiffio.h>
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* 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 (Lisp_Object libraries)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 HMODULE library;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!(library = w32_delayed_load (libraries, Qtiff)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 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;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_TIFFSetErrorHandler TIFFSetErrorHandler
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_TIFFSetWarningHandler TIFFSetWarningHandler
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_TIFFOpen TIFFOpen
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_TIFFClientOpen TIFFClientOpen
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_TIFFGetField TIFFGetField
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_TIFFReadRGBAImage TIFFReadRGBAImage
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_TIFFClose TIFFClose
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Reading from a memory buffer for TIFF images Based on the PNG
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 memory source, but we have to provide a lot of extra functions.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Blah.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 We really only need to implement read and seek, but I am not
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 convinced that the TIFF library is smart enough not to destroy
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 itself if we only hand it the function pointers we need to
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 override. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 typedef struct
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned char *bytes;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 size_t len;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int index;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tiff_memory_source;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static size_t
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tiff_read_from_memory (data, buf, size)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 thandle_t data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tdata_t buf;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tsize_t size;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tiff_memory_source *src = (tiff_memory_source *) data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (size > src->len - src->index)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return (size_t) -1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bcopy (src->bytes + src->index, buf, size);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->index += size;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return size;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static size_t
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tiff_write_from_memory (data, buf, size)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 thandle_t data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tdata_t buf;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tsize_t size;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return (size_t) -1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static toff_t
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tiff_seek_in_memory (data, off, whence)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 thandle_t data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 toff_t off;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int whence;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tiff_memory_source *src = (tiff_memory_source *) data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int idx;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 switch (whence)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 case SEEK_SET: /* Go from beginning of source. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 idx = off;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 case SEEK_END: /* Go from end of source. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 idx = src->len + off;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 case SEEK_CUR: /* Go from current position. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 idx = src->index + off;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 default: /* Invalid `whence'. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return -1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (idx > src->len || idx < 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return -1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->index = idx;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return src->index;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tiff_close_memory (data)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 thandle_t data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* NOOP */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tiff_mmap_memory (data, pbase, psize)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 thandle_t data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tdata_t *pbase;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 toff_t *psize;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* It is already _IN_ memory. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tiff_unmap_memory (data, base, size)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 thandle_t data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tdata_t base;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 toff_t size;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* We don't need to do this. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static toff_t
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tiff_size_of_memory (data)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 thandle_t data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return ((tiff_memory_source *) data)->len;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tiff_error_handler (title, format, ap)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 const char *title, *format;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 va_list ap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char buf[512];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int len;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 len = sprintf (buf, "TIFF error: %s ", title);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 vsprintf (buf + len, format, ap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 add_to_log (buf, Qnil, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tiff_warning_handler (title, format, ap)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 const char *title, *format;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 va_list ap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char buf[512];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int len;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 len = sprintf (buf, "TIFF warning: %s ", title);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 vsprintf (buf + len, format, ap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 add_to_log (buf, Qnil, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Load TIFF image IMG for use on frame F. Value is non-zero if
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 successful. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tiff_load (f, img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object file, specified_file;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object specified_data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 TIFF *tiff;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int width, height, x, y;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 uint32 *buf;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int rc;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImagePtr ximg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct gcpro gcpro1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tiff_memory_source memsrc;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 specified_file = image_spec_value (img->spec, QCfile, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 specified_data = image_spec_value (img->spec, QCdata, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 file = Qnil;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GCPRO1 (file);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_TIFFSetErrorHandler (tiff_error_handler);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_TIFFSetWarningHandler (tiff_warning_handler);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (NILP (specified_data))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Read from a file */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 file = x_find_image_file (specified_file);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!STRINGP (file))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Cannot find image file `%s'", specified_file, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Try to open the image file. Casting return value avoids a
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GCC warning on W32. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tiff = (TIFF *)fn_TIFFOpen (SDATA (file), "r");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (tiff == NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Cannot open `%s'", file, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Memory source! */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 memsrc.bytes = SDATA (specified_data);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 memsrc.len = SBYTES (specified_data);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 memsrc.index = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Casting return value avoids a GCC warning on W32. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tiff = (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)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Cannot open memory source for `%s'", img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* 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);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!check_image_size (f, width, height))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Invalid image size", Qnil, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 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);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (buf);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Create the X image and pixmap. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (buf);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Initialize the color table. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 init_color_table ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Process the pixel raster. Origin is in the lower-left corner. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (y = 0; y < height; ++y)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 uint32 *row = buf + y * width;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 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));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef COLOR_TABLE_SUPPORT
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Remember the colors allocated for the image. Free the color table. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->colors = colors_in_color_table (&img->ncolors);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 free_color_table ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* COLOR_TABLE_SUPPORT */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->width = width;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->height = height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Maybe fill in the background field while we have ximg handy. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Casting avoids a GCC warning on W32. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Put the image into the pixmap, then free the X image and its buffer. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_put_x_image (f, ximg, img->pixmap, width, height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_x_image (ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (buf);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else /* HAVE_TIFF */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef MAC_OS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tiff_load (f, img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return image_load_quicktime (f, img, kQTFileTypeTIFF);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* MAC_OS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* !HAVE_TIFF */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /***********************************************************************
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GIF
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ***********************************************************************/
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (HAVE_GIF) || defined (MAC_OS)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int gif_image_p P_ ((Lisp_Object object));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int gif_load P_ ((struct frame *f, struct image *img));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void gif_clear_image P_ ((struct frame *f, struct image *img));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* The symbol `gif' identifying images of this type. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object Qgif;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Indices of image specification fields in gif_format, below. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 enum gif_keyword_index
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GIF_TYPE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GIF_DATA,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GIF_FILE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GIF_ASCENT,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GIF_MARGIN,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GIF_RELIEF,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GIF_ALGORITHM,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GIF_HEURISTIC_MASK,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GIF_MASK,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GIF_IMAGE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GIF_BACKGROUND,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GIF_LAST
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Vector of image_keyword structures describing the format
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 of valid user-defined image specifications. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static struct image_keyword gif_format[GIF_LAST] =
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":type", IMAGE_SYMBOL_VALUE, 1},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":data", IMAGE_STRING_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":file", IMAGE_STRING_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":ascent", IMAGE_ASCENT_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":relief", IMAGE_INTEGER_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":image", IMAGE_NON_NEGATIVE_INTEGER_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":background", IMAGE_STRING_OR_NIL_VALUE, 0}
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Structure describing the image type `gif'. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static struct image_type gif_type =
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &Qgif,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gif_image_p,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gif_load,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gif_clear_image,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 NULL
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Free X resources of GIF image IMG which is used on frame F. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gif_clear_image (f, img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* IMG->data.ptr_val may contain extension data. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->data.lisp_val = Qnil;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_clear_image (f, img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Return non-zero if OBJECT is a valid GIF image specification. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gif_image_p (object)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object object;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image_keyword fmt[GIF_LAST];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bcopy (gif_format, fmt, sizeof fmt);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!parse_image_spec (object, fmt, GIF_LAST, Qgif))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Must specify either the :data or :file keyword. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return fmt[GIF_FILE].count + fmt[GIF_DATA].count == 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_GIF || MAC_OS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_GIF
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (HAVE_NTGUI) || defined (MAC_OS)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* winuser.h might define DrawText to DrawTextA or DrawTextW.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Undefine before redefining to avoid a preprocessor warning. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef DrawText
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #undef DrawText
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* avoid conflict with QuickdrawText.h */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define DrawText gif_DrawText
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include <gif_lib.h>
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #undef DrawText
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else /* HAVE_NTGUI || MAC_OS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include <gif_lib.h>
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI || MAC_OS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* GIF library details. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (DGifCloseFile);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (DGifSlurp);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (DGifOpen);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (DGifOpenFileName);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 init_gif_functions (Lisp_Object libraries)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 HMODULE library;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!(library = w32_delayed_load (libraries, Qgif)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, DGifCloseFile);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, DGifSlurp);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, DGifOpen);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, DGifOpenFileName);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_DGifCloseFile DGifCloseFile
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_DGifSlurp DGifSlurp
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_DGifOpen DGifOpen
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_DGifOpenFileName DGifOpenFileName
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Reading a GIF image from memory
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Based on the PNG memory stuff to a certain extent. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 typedef struct
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned char *bytes;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 size_t len;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int index;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gif_memory_source;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Make the current memory source available to gif_read_from_memory.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 It's done this way because not all versions of libungif support
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 a UserData field in the GifFileType structure. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static gif_memory_source *current_gif_memory_src;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gif_read_from_memory (file, buf, len)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GifFileType *file;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GifByteType *buf;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int len;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gif_memory_source *src = current_gif_memory_src;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (len > src->len - src->index)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return -1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bcopy (src->bytes + src->index, buf, len);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 src->index += len;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return len;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Load GIF image IMG for use on frame F. Value is non-zero if
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 successful. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gif_load (f, img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object file, specified_file;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object specified_data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int rc, width, height, x, y, i;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImagePtr ximg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ColorMapObject *gif_color_map;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long pixel_colors[256];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GifFileType *gif;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct gcpro gcpro1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object image;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int ino, image_height, image_width;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gif_memory_source memsrc;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned char *raster;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 specified_file = image_spec_value (img->spec, QCfile, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 specified_data = image_spec_value (img->spec, QCdata, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 file = Qnil;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GCPRO1 (file);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (NILP (specified_data))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 file = x_find_image_file (specified_file);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!STRINGP (file))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Cannot find image file `%s'", specified_file, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Open the GIF file. Casting return value avoids a GCC warning
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 on W32. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gif = (GifFileType *)fn_DGifOpenFileName (SDATA (file));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (gif == NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Cannot open `%s'", file, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Read from memory! */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 current_gif_memory_src = &memsrc;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 memsrc.bytes = SDATA (specified_data);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 memsrc.len = SBYTES (specified_data);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 memsrc.index = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Casting return value avoids a GCC warning on W32. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gif = (GifFileType *) fn_DGifOpen (&memsrc, gif_read_from_memory);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!gif)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Cannot open memory source `%s'", img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Before reading entire contents, check the declared image size. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!check_image_size (f, gif->SWidth, gif->SHeight))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Invalid image size", Qnil, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_DGifCloseFile (gif);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Read entire contents. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 rc = fn_DGifSlurp (gif);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (rc == GIF_ERROR)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Error reading `%s'", img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_DGifCloseFile (gif);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image = image_spec_value (img->spec, QCindex, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ino = INTEGERP (image) ? XFASTINT (image) : 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (ino >= gif->ImageCount)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Invalid image number `%s' in image `%s'",
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image, img->spec);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_DGifCloseFile (gif);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->corners[TOP_CORNER] = gif->SavedImages[ino].ImageDesc.Top;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->corners[LEFT_CORNER] = gif->SavedImages[ino].ImageDesc.Left;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_height = gif->SavedImages[ino].ImageDesc.Height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->corners[BOT_CORNER] = img->corners[TOP_CORNER] + image_height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_width = gif->SavedImages[ino].ImageDesc.Width;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->corners[RIGHT_CORNER] = img->corners[LEFT_CORNER] + image_width;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 width = img->width = max (gif->SWidth,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 max (gif->Image.Left + gif->Image.Width,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->corners[RIGHT_CORNER]));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 height = img->height = max (gif->SHeight,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 max (gif->Image.Top + gif->Image.Height,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->corners[BOT_CORNER]));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!check_image_size (f, width, height))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Invalid image size", Qnil, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_DGifCloseFile (gif);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Create the X image and pixmap. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_DGifCloseFile (gif);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Allocate colors. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gif_color_map = gif->SavedImages[ino].ImageDesc.ColorMap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!gif_color_map)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gif_color_map = gif->SColorMap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 init_color_table ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bzero (pixel_colors, sizeof pixel_colors);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = 0; i < gif_color_map->ColorCount; ++i)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int r = gif_color_map->Colors[i].Red << 8;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int g = gif_color_map->Colors[i].Green << 8;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int b = gif_color_map->Colors[i].Blue << 8;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pixel_colors[i] = lookup_rgb_color (f, r, g, b);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef COLOR_TABLE_SUPPORT
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->colors = colors_in_color_table (&img->ncolors);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 free_color_table ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* COLOR_TABLE_SUPPORT */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Clear the part of the screen image that are not covered by
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 the image from the GIF file. Full animated GIF support
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 requires more than can be done here (see the gif89 spec,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 disposal methods). Let's simply assume that the part
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 not covered by a sub-image is in the frame's background color. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (y = 0; y < img->corners[TOP_CORNER]; ++y)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (x = 0; x < width; ++x)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (y = img->corners[BOT_CORNER]; y < height; ++y)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (x = 0; x < width; ++x)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (y = img->corners[TOP_CORNER]; y < img->corners[BOT_CORNER]; ++y)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (x = 0; x < img->corners[LEFT_CORNER]; ++x)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (x = img->corners[RIGHT_CORNER]; x < width; ++x)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Read the GIF image into the X image. We use a local variable
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 `raster' here because RasterBits below is a char *, and invites
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 problems with bytes >= 0x80. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 raster = (unsigned char *) gif->SavedImages[ino].RasterBits;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (gif->SavedImages[ino].ImageDesc.Interlace)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int interlace_start[] = {0, 4, 2, 1};
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int interlace_increment[] = {8, 8, 4, 2};
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int pass;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int row = interlace_start[0];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pass = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (y = 0; y < image_height; y++)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (row >= image_height)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 row = interlace_start[++pass];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 while (row >= image_height)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 row = interlace_start[++pass];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (x = 0; x < image_width; x++)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i = raster[(y * image_width) + x];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPutPixel (ximg, x + img->corners[LEFT_CORNER],
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 row + img->corners[TOP_CORNER], pixel_colors[i]);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 row += interlace_increment[pass];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (y = 0; y < image_height; ++y)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (x = 0; x < image_width; ++x)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i = raster[y * image_width + x];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPutPixel (ximg, x + img->corners[LEFT_CORNER],
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 y + img->corners[TOP_CORNER], pixel_colors[i]);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Save GIF image extension data for `image-extension-data'.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Format is (count IMAGES FUNCTION "BYTES" ...). */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->data.lisp_val = Qnil;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (gif->SavedImages[ino].ExtensionBlockCount > 0)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ExtensionBlock *ext = gif->SavedImages[ino].ExtensionBlocks;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = 0; i < gif->SavedImages[ino].ExtensionBlockCount; i++, ext++)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Append (... FUNCTION "BYTES") */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->data.lisp_val = Fcons (make_unibyte_string (ext->Bytes, ext->ByteCount),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Fcons (make_number (ext->Function),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->data.lisp_val));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->data.lisp_val = Fnreverse (img->data.lisp_val);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (gif->ImageCount > 1)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->data.lisp_val = Fcons (Qcount,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Fcons (make_number (gif->ImageCount),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->data.lisp_val));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_DGifCloseFile (gif);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Maybe fill in the background field while we have ximg handy. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Casting avoids a GCC warning. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Put the image into the pixmap, then free the X image and its buffer. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_put_x_image (f, ximg, img->pixmap, width, height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_x_image (ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else /* !HAVE_GIF */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef MAC_OS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gif_load (f, img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object specified_file, file;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object specified_data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 OSErr err;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Boolean graphic_p, movie_p, prefer_graphic_p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Handle dh = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Movie movie = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object image;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Track track = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Media media = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 long nsamples;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Rect rect;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object specified_bg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XColor color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 RGBColor bg_color;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int width, height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImagePtr ximg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 TimeScale time_scale;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 TimeValue time, duration;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int ino;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CGrafPtr old_port;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GDHandle old_gdh;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 specified_file = image_spec_value (img->spec, QCfile, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 specified_data = image_spec_value (img->spec, QCdata, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Animated gifs use QuickTime Movie Toolbox. So initialize it here. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 EnterMovies ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (NILP (specified_data))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Read from a file */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FSSpec fss;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 short refnum;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 err = find_image_fsspec (specified_file, &file, &fss);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (err != noErr)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (err == fnfErr)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Cannot find image file `%s'", specified_file, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto open_error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 err = CanQuickTimeOpenFile (&fss, kQTFileTypeGIF, 0,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &graphic_p, &movie_p, &prefer_graphic_p, 0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (err != noErr)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto open_error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!graphic_p && !movie_p)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto open_error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (prefer_graphic_p)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return image_load_qt_1 (f, img, kQTFileTypeGIF, &fss, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 err = OpenMovieFile (&fss, &refnum, fsRdPerm);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (err != noErr)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto open_error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 err = NewMovieFromFile (&movie, refnum, NULL, NULL, 0, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CloseMovieFile (refnum);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (err != noErr)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Error reading `%s'", file, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Memory source! */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Handle dref = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 long file_type_atom[3];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 err = PtrToHand (SDATA (specified_data), &dh, SBYTES (specified_data));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (err != noErr)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Cannot allocate data handle for `%s'",
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 file_type_atom[0] = EndianU32_NtoB (sizeof (long) * 3);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 file_type_atom[1] = EndianU32_NtoB (kDataRefExtensionMacOSFileType);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 file_type_atom[2] = EndianU32_NtoB (kQTFileTypeGIF);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 err = PtrToHand (&dh, &dref, sizeof (Handle));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (err == noErr)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* no file name */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 err = PtrAndHand ("\p", dref, 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (err == noErr)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 err = PtrAndHand (file_type_atom, dref, sizeof (long) * 3);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (err != noErr)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Cannot allocate handle data ref for `%s'", img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 err = CanQuickTimeOpenDataRef (dref, HandleDataHandlerSubType, &graphic_p,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &movie_p, &prefer_graphic_p, 0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (err != noErr)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto open_error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!graphic_p && !movie_p)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto open_error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (prefer_graphic_p)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int success_p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DisposeHandle (dref);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 success_p = image_load_qt_1 (f, img, kQTFileTypeGIF, NULL, dh);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DisposeHandle (dh);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return success_p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 err = NewMovieFromDataRef (&movie, 0, NULL, dref,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 HandleDataHandlerSubType);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DisposeHandle (dref);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (err != noErr)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto open_error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image = image_spec_value (img->spec, QCindex, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ino = INTEGERP (image) ? XFASTINT (image) : 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 track = GetMovieIndTrack (movie, 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 media = GetTrackMedia (track);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 nsamples = GetMediaSampleCount (media);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (ino >= nsamples)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Invalid image number `%s' in image `%s'",
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image, img->spec);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 time_scale = GetMediaTimeScale (media);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 specified_bg = image_spec_value (img->spec, QCbackground, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!STRINGP (specified_bg) ||
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 !mac_defined_color (f, SDATA (specified_bg), &color, 0))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color.pixel = FRAME_BACKGROUND_PIXEL (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color.red = RED16_FROM_ULONG (color.pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color.green = GREEN16_FROM_ULONG (color.pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color.blue = BLUE16_FROM_ULONG (color.pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GetMovieBox (movie, &rect);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 width = img->width = rect.right - rect.left;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 height = img->height = rect.bottom - rect.top;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GetGWorld (&old_port, &old_gdh);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SetGWorld (ximg, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bg_color.red = color.red;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bg_color.green = color.green;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bg_color.blue = color.blue;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 RGBBackColor (&bg_color);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SetGWorld (old_port, old_gdh);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SetMovieActive (movie, 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SetMovieGWorld (movie, ximg, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SampleNumToMediaTime (media, ino + 1, &time, &duration);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SetMovieTimeValue (movie, time);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 MoviesTask (movie, 0L);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DisposeTrackMedia (media);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DisposeMovieTrack (track);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DisposeMovie (movie);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (dh)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DisposeHandle (dh);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Save GIF image extension data for `image-extension-data'.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Format is (count IMAGES 0xf9 GRAPHIC_CONTROL_EXTENSION_BLOCK). */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object gce = make_uninit_string (4);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int centisec = ((float)duration / time_scale) * 100.0f + 0.5f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Fill the delay time field. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SSET (gce, 1, centisec & 0xff);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SSET (gce, 2, (centisec >> 8) & 0xff);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* We don't know about other fields. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SSET (gce, 0, 0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SSET (gce, 3, 0);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->data.lisp_val = list4 (Qcount, make_number (nsamples),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 make_number (0xf9), gce);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Maybe fill in the background field while we have ximg handy. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 IMAGE_BACKGROUND (img, f, ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Put the image into the pixmap. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_put_x_image (f, ximg, img->pixmap, width, height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_x_image (ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 open_error:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Cannot open `%s'", file, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 error:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (media)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DisposeTrackMedia (media);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (track)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DisposeMovieTrack (track);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (movie)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DisposeMovie (movie);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (dh)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DisposeHandle (dh);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* MAC_OS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_GIF */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /***********************************************************************
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SVG
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ***********************************************************************/
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (HAVE_RSVG)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Function prototypes. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int svg_image_p P_ ((Lisp_Object object));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int svg_load P_ ((struct frame *f, struct image *img));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int svg_load_image P_ ((struct frame *, struct image *,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned char *, unsigned int));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* The symbol `svg' identifying images of this type. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object Qsvg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Indices of image specification fields in svg_format, below. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 enum svg_keyword_index
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SVG_TYPE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SVG_DATA,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SVG_FILE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SVG_ASCENT,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SVG_MARGIN,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SVG_RELIEF,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SVG_ALGORITHM,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SVG_HEURISTIC_MASK,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SVG_MASK,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SVG_BACKGROUND,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 SVG_LAST
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Vector of image_keyword structures describing the format
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 of valid user-defined image specifications. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static struct image_keyword svg_format[SVG_LAST] =
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":type", IMAGE_SYMBOL_VALUE, 1},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":data", IMAGE_STRING_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":file", IMAGE_STRING_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":ascent", IMAGE_ASCENT_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":relief", IMAGE_INTEGER_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":background", IMAGE_STRING_OR_NIL_VALUE, 0}
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Structure describing the image type `svg'. Its the same type of
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 structure defined for all image formats, handled by emacs image
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 functions. See struct image_type in dispextern.h. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static struct image_type svg_type =
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* An identifier showing that this is an image structure for the SVG format. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &Qsvg,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Handle to a function that can be used to identify a SVG file. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 svg_image_p,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Handle to function used to load a SVG file. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 svg_load,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Handle to function to free sresources for SVG. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_clear_image,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* An internal field to link to the next image type in a list of
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image types, will be filled in when registering the format. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 NULL
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Return non-zero if OBJECT is a valid SVG image specification. Do
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 this by calling parse_image_spec and supplying the keywords that
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 identify the SVG format. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 svg_image_p (object)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object object;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image_keyword fmt[SVG_LAST];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bcopy (svg_format, fmt, sizeof fmt);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!parse_image_spec (object, fmt, SVG_LAST, Qsvg))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Must specify either the :data or :file keyword. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return fmt[SVG_FILE].count + fmt[SVG_DATA].count == 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #include <librsvg/rsvg.h>
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* SVG library functions. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (rsvg_handle_new);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (rsvg_handle_set_size_callback);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (rsvg_handle_write);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (rsvg_handle_close);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (rsvg_handle_get_pixbuf);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (rsvg_handle_free);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (gdk_pixbuf_get_width);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (gdk_pixbuf_get_height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (gdk_pixbuf_get_pixels);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (gdk_pixbuf_get_rowstride);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (gdk_pixbuf_get_colorspace);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (gdk_pixbuf_get_n_channels);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (gdk_pixbuf_get_has_alpha);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (gdk_pixbuf_get_bits_per_sample);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (g_type_init);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (g_object_unref);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEF_IMGLIB_FN (g_error_free);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object Qgdk_pixbuf, Qglib;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 init_svg_functions (Lisp_Object libraries)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 HMODULE library, gdklib, glib;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!(glib = w32_delayed_load (libraries, Qglib))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 || !(gdklib = w32_delayed_load (libraries, Qgdk_pixbuf))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 || !(library = w32_delayed_load (libraries, Qsvg)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, rsvg_handle_new);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, rsvg_handle_set_size_callback);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, rsvg_handle_write);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, rsvg_handle_close);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, rsvg_handle_get_pixbuf);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (library, rsvg_handle_free);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_width);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_pixels);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_rowstride);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_colorspace);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_n_channels);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_has_alpha);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_bits_per_sample);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (glib, g_type_init);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (glib, g_object_unref);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 LOAD_IMGLIB_FN (glib, g_error_free);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* The following aliases for library functions allow dynamic loading
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 to be used on some platforms. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_rsvg_handle_new rsvg_handle_new
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_rsvg_handle_set_size_callback rsvg_handle_set_size_callback
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_rsvg_handle_write rsvg_handle_write
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_rsvg_handle_close rsvg_handle_close
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_rsvg_handle_get_pixbuf rsvg_handle_get_pixbuf
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_rsvg_handle_free rsvg_handle_free
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_gdk_pixbuf_get_width gdk_pixbuf_get_width
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_gdk_pixbuf_get_height gdk_pixbuf_get_height
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_gdk_pixbuf_get_pixels gdk_pixbuf_get_pixels
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_gdk_pixbuf_get_rowstride gdk_pixbuf_get_rowstride
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_gdk_pixbuf_get_colorspace gdk_pixbuf_get_colorspace
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_gdk_pixbuf_get_n_channels gdk_pixbuf_get_n_channels
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_gdk_pixbuf_get_has_alpha gdk_pixbuf_get_has_alpha
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_gdk_pixbuf_get_bits_per_sample gdk_pixbuf_get_bits_per_sample
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_g_type_init g_type_init
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_g_object_unref g_object_unref
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define fn_g_error_free g_error_free
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* !HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Load SVG image IMG for use on frame F. Value is non-zero if
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 successful. this function will go into the svg_type structure, and
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 the prototype thus needs to be compatible with that structure. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 svg_load (f, img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int success_p = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object file_name;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* If IMG->spec specifies a file name, create a non-file spec from it. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 file_name = image_spec_value (img->spec, QCfile, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (STRINGP (file_name))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object file;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned char *contents;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int size;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct gcpro gcpro1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 file = x_find_image_file (file_name);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GCPRO1 (file);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!STRINGP (file))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Cannot find image file `%s'", file_name, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Read the entire file into memory. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 contents = slurp_file (SDATA (file), &size);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (contents == NULL)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Error loading SVG image `%s'", img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* If the file was slurped into memory properly, parse it. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 success_p = svg_load_image (f, img, contents, size);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (contents);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Else its not a file, its a lisp object. Load the image from a
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 lisp object rather than a file. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object data;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 data = image_spec_value (img->spec, QCdata, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 success_p = svg_load_image (f, img, SDATA (data), SBYTES (data));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return success_p;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* svg_load_image is a helper function for svg_load, which does the actual
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 loading given contents and size, apart from frame and image
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 structures, passed from svg_load.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Uses librsvg to do most of the image processing.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Returns non-zero when sucessful. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 svg_load_image (f, img, contents, size)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Pointer to emacs frame sturcture. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Pointer to emacs image structure. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* String containing the SVG XML data to be parsed. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned char *contents;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Size of data in bytes. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned int size;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 RsvgHandle *rsvg_handle;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GError *error = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GdkPixbuf *pixbuf;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int width;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 const guint8 *pixels;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int rowstride;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImagePtr ximg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object specified_bg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XColor background;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int x;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int y;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* g_type_init is a glib function that must be called prior to using
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gnome type library functions. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_g_type_init ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Make a handle to a new rsvg object. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 rsvg_handle = fn_rsvg_handle_new ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Parse the contents argument and fill in the rsvg_handle. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_rsvg_handle_write (rsvg_handle, contents, size, &error);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (error)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto rsvg_error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* The parsing is complete, rsvg_handle is ready to used, close it
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for further writes. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_rsvg_handle_close (rsvg_handle, &error);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (error)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 goto rsvg_error;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* We can now get a valid pixel buffer from the svg file, if all
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 went ok. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pixbuf = fn_rsvg_handle_get_pixbuf (rsvg_handle);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 eassert (pixbuf);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Extract some meta data from the svg handle. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 width = fn_gdk_pixbuf_get_width (pixbuf);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 height = fn_gdk_pixbuf_get_height (pixbuf);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pixels = fn_gdk_pixbuf_get_pixels (pixbuf);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 rowstride = fn_gdk_pixbuf_get_rowstride (pixbuf);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Validate the svg meta data. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 eassert (fn_gdk_pixbuf_get_colorspace (pixbuf) == GDK_COLORSPACE_RGB);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 eassert (fn_gdk_pixbuf_get_n_channels (pixbuf) == 4);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 eassert (fn_gdk_pixbuf_get_has_alpha (pixbuf));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 eassert (fn_gdk_pixbuf_get_bits_per_sample (pixbuf) == 8);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Try to create a x pixmap to hold the svg pixmap. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_g_object_unref (pixbuf);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 init_color_table ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Handle alpha channel by combining the image with a background
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 specified_bg = image_spec_value (img->spec, QCbackground, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (STRINGP (specified_bg)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 && x_defined_color (f, SDATA (specified_bg), &background, 0))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 background.red >>= 8;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 background.green >>= 8;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 background.blue >>= 8;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_X_WINDOWS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 background.pixel = FRAME_BACKGROUND_PIXEL (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_query_color (f, &background);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* SVG pixmaps specify transparency in the last byte, so right
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 shift 8 bits to get rid of it, since emacs doesn't support
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 transparency. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 background.red >>= 8;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 background.green >>= 8;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 background.blue >>= 8;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #elif defined (MAC_OS)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 background.pixel = FRAME_BACKGROUND_PIXEL (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 background.red = RED_FROM_ULONG (background.pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 background.green = GREEN_FROM_ULONG (background.pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 background.blue = BLUE_FROM_ULONG (background.pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #elif defined (HAVE_NTGUI)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 background.pixel = FRAME_BACKGROUND_PIXEL (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if 0 /* W32 TODO : Colormap support. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_query_color (f, &background);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* SVG pixmaps specify transparency in the last byte, so right
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 shift 8 bits to get rid of it, since emacs doesn't support
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 transparency. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 background.red >>= 8;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 background.green >>= 8;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 background.blue >>= 8;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else /* not HAVE_X_WINDOWS && not MAC_OS*/
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #error FIXME
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* This loop handles opacity values, since Emacs assumes
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 non-transparent images. Each pixel must be "flattened" by
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 calculating he resulting color, given the transparency of the
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pixel, and the image background color. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (y = 0; y < height; ++y)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (x = 0; x < width; ++x)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned red;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned green;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned blue;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned opacity;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 red = *pixels++;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 green = *pixels++;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 blue = *pixels++;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 opacity = *pixels++;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 red = ((red * opacity)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 + (background.red * ((1 << 8) - opacity)));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 green = ((green * opacity)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 + (background.green * ((1 << 8) - opacity)));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 blue = ((blue * opacity)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 + (background.blue * ((1 << 8) - opacity)));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XPutPixel (ximg, x, y, lookup_rgb_color (f, red, green, blue));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pixels += rowstride - 4 * width;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef COLOR_TABLE_SUPPORT
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Remember colors allocated for this image. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->colors = colors_in_color_table (&img->ncolors);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 free_color_table ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* COLOR_TABLE_SUPPORT */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_g_object_unref (pixbuf);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->width = width;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->height = height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Maybe fill in the background field while we have ximg handy.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Casting avoids a GCC warning. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Put the image into the pixmap, then free the X image and its
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 buffer. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_put_x_image (f, ximg, img->pixmap, width, height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_destroy_x_image (ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 rsvg_error:
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* FIXME: Use error->message so the user knows what is the actual
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 problem with the image. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Error parsing SVG image `%s'", img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 fn_g_error_free (error);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* defined (HAVE_RSVG) */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /***********************************************************************
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Ghostscript
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ***********************************************************************/
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_X_WINDOWS
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define HAVE_GHOSTSCRIPT 1
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_X_WINDOWS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* The symbol `postscript' identifying images of this type. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object Qpostscript;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_GHOSTSCRIPT
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int gs_image_p P_ ((Lisp_Object object));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int gs_load P_ ((struct frame *f, struct image *img));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void gs_clear_image P_ ((struct frame *f, struct image *img));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Keyword symbols. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object QCloader, QCbounding_box, QCpt_width, QCpt_height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Indices of image specification fields in gs_format, below. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 enum gs_keyword_index
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GS_TYPE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GS_PT_WIDTH,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GS_PT_HEIGHT,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GS_FILE,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GS_LOADER,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GS_BOUNDING_BOX,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GS_ASCENT,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GS_MARGIN,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GS_RELIEF,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GS_ALGORITHM,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GS_HEURISTIC_MASK,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GS_MASK,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GS_BACKGROUND,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GS_LAST
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Vector of image_keyword structures describing the format
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 of valid user-defined image specifications. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static struct image_keyword gs_format[GS_LAST] =
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":type", IMAGE_SYMBOL_VALUE, 1},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":pt-width", IMAGE_POSITIVE_INTEGER_VALUE, 1},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":pt-height", IMAGE_POSITIVE_INTEGER_VALUE, 1},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":file", IMAGE_STRING_VALUE, 1},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":loader", IMAGE_FUNCTION_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":bounding-box", IMAGE_DONT_CHECK_VALUE_TYPE, 1},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":ascent", IMAGE_ASCENT_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":margin", IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":relief", IMAGE_INTEGER_VALUE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":conversion", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":heuristic-mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":mask", IMAGE_DONT_CHECK_VALUE_TYPE, 0},
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {":background", IMAGE_STRING_OR_NIL_VALUE, 0}
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Structure describing the image type `ghostscript'. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static struct image_type gs_type =
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 &Qpostscript,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gs_image_p,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gs_load,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gs_clear_image,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 NULL
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 };
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Free X resources of Ghostscript image IMG which is used on frame F. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gs_clear_image (f, img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* IMG->data.ptr_val may contain a recorded colormap. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xfree (img->data.ptr_val);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_clear_image (f, img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Return non-zero if OBJECT is a valid Ghostscript image
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 specification. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gs_image_p (object)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object object;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image_keyword fmt[GS_LAST];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object tem;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int i;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 bcopy (gs_format, fmt, sizeof fmt);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!parse_image_spec (object, fmt, GS_LAST, Qpostscript))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Bounding box must be a list or vector containing 4 integers. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tem = fmt[GS_BOUNDING_BOX].value;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (CONSP (tem))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = 0; i < 4; ++i, tem = XCDR (tem))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!CONSP (tem) || !INTEGERP (XCAR (tem)))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!NILP (tem))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else if (VECTORP (tem))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (XVECTOR (tem)->size != 4)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = 0; i < 4; ++i)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!INTEGERP (XVECTOR (tem)->contents[i]))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Load Ghostscript image IMG for use on frame F. Value is non-zero
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if successful. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 static int
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 gs_load (f, img)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 char buffer[100];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object window_and_pixmap_id = Qnil, loader, pt_height, pt_width;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct gcpro gcpro1, gcpro2;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object frame;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 double in_width, in_height;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object pixel_colors = Qnil;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Compute pixel size of pixmap needed from the given size in the
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image specification. Sizes in the specification are in pt. 1 pt
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 = 1/72 in, xdpi and ydpi are stored in the frame's X display
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 info. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pt_width = image_spec_value (img->spec, QCpt_width, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 in_width = XFASTINT (pt_width) / 72.0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->width = in_width * FRAME_X_DISPLAY_INFO (f)->resx;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pt_height = image_spec_value (img->spec, QCpt_height, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 in_height = XFASTINT (pt_height) / 72.0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->height = in_height * FRAME_X_DISPLAY_INFO (f)->resy;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!check_image_size (f, img->width, img->height))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Invalid image size", Qnil, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Create the pixmap. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xassert (img->pixmap == NO_PIXMAP);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Only W32 version did BLOCK_INPUT here. ++kfs */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 BLOCK_INPUT;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->pixmap = XCreatePixmap (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->width, img->height,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DefaultDepthOfScreen (FRAME_X_SCREEN (f)));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNBLOCK_INPUT;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (!img->pixmap)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Unable to create pixmap for `%s'", img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Call the loader to fill the pixmap. It returns a process object
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if successful. We do not record_unwind_protect here because
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 other places in redisplay like calling window scroll functions
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 don't either. Let the Lisp loader use `unwind-protect' instead. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 GCPRO2 (window_and_pixmap_id, pixel_colors);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 sprintf (buffer, "%lu %lu",
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (unsigned long) FRAME_X_WINDOW (f),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (unsigned long) img->pixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 window_and_pixmap_id = build_string (buffer);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 sprintf (buffer, "%lu %lu",
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FRAME_FOREGROUND_PIXEL (f),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 FRAME_BACKGROUND_PIXEL (f));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pixel_colors = build_string (buffer);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XSETFRAME (frame, f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 loader = image_spec_value (img->spec, QCloader, NULL);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (NILP (loader))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 loader = intern ("gs-load-image");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->data.lisp_val = call6 (loader, frame, img->spec,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 make_number (img->width),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 make_number (img->height),
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 window_and_pixmap_id,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pixel_colors);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNGCPRO;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return PROCESSP (img->data.lisp_val);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Kill the Ghostscript process that was started to fill PIXMAP on
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 frame F. Called from XTread_socket when receiving an event
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 telling Emacs that Ghostscript has finished drawing. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_kill_gs_process (pixmap, f)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Pixmap pixmap;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct frame *f;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int class, i;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 struct image *img;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Find the image containing PIXMAP. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (i = 0; i < c->used; ++i)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (c->images[i]->pixmap == pixmap)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 break;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Should someone in between have cleared the image cache, for
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 instance, give up. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (i == c->used)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Kill the GS process. We should have found PIXMAP in the image
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 cache and its image should contain a process object. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img = c->images[i];
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 xassert (PROCESSP (img->data.lisp_val));
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Fkill_process (img->data.lisp_val, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->data.lisp_val = Qnil;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (HAVE_X_WINDOWS)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* On displays with a mutable colormap, figure out the colors
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 allocated for the image by looking at the pixels of an XImage for
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->pixmap. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 class = FRAME_X_VISUAL (f)->class;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (class != StaticColor && class != StaticGray && class != TrueColor)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XImagePtr ximg;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 BLOCK_INPUT;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Try to get an XImage for img->pixmep. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ximg = XGetImage (FRAME_X_DISPLAY (f), img->pixmap,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 0, 0, img->width, img->height, ~0, ZPixmap);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (ximg)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int x, y;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Initialize the color table. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 init_color_table ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* For each pixel of the image, look its color up in the
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 color table. After having done so, the color table will
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 contain an entry for each color used by the image. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (y = 0; y < img->height; ++y)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 for (x = 0; x < img->width; ++x)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 unsigned long pixel = XGetPixel (ximg, x, y);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 lookup_pixel_color (f, pixel);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Record colors in the image. Free color table and XImage. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef COLOR_TABLE_SUPPORT
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->colors = colors_in_color_table (&img->ncolors);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 free_color_table ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 XDestroyImage (ximg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if 0 /* This doesn't seem to be the case. If we free the colors
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 here, we get a BadAccess later in x_clear_image when
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 freeing the colors. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* We have allocated colors once, but Ghostscript has also
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 allocated colors on behalf of us. So, to get the
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 reference counts right, free them once. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (img->ncolors)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 x_free_colors (f, img->colors, img->ncolors);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_error ("Cannot get X image of `%s'; colors will not be freed",
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 img->spec, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNBLOCK_INPUT;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_X_WINDOWS */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Now that we have the pixmap, compute mask and transform the
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image if requested. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 BLOCK_INPUT;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 postprocess_image (f, img);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 UNBLOCK_INPUT;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_GHOSTSCRIPT */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /***********************************************************************
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Tests
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ***********************************************************************/
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if GLYPH_DEBUG
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEFUN ("imagep", Fimagep, Simagep, 1, 1, 0,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 doc: /* Value is non-nil if SPEC is a valid image specification. */)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (spec)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object spec;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return valid_image_p (spec) ? Qt : Qnil;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEFUN ("lookup-image", Flookup_image, Slookup_image, 1, 1, 0, "")
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (spec)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object spec;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 int id = -1;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (valid_image_p (spec))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 id = lookup_image (SELECTED_FRAME (), spec);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 debug_print (spec);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return make_number (id);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* GLYPH_DEBUG != 0 */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /***********************************************************************
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Initialization
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ***********************************************************************/
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Image types that rely on external libraries are loaded dynamically
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if the library is available. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define CHECK_LIB_AVAILABLE(image_type, init_lib_fn, libraries) \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 define_image_type (image_type, init_lib_fn (libraries))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #else
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #define CHECK_LIB_AVAILABLE(image_type, init_lib_fn, libraries) \
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 define_image_type (image_type, 1)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEFUN ("init-image-library", Finit_image_library, Sinit_image_library, 2, 2, 0,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 doc: /* Initialize image library implementing image type TYPE.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Return non-nil if TYPE is a supported image type.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Image types pbm and xbm are prebuilt; other types are loaded here.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Libraries to load are specified in alist LIBRARIES (usually, the value
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 of `image-library-alist', which see). */)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (type, libraries)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object type, libraries;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Lisp_Object tested;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Don't try to reload the library. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 tested = Fassq (type, Vimage_type_cache);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (CONSP (tested))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return XCDR (tested);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (HAVE_XPM) || defined (MAC_OS)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (EQ (type, Qxpm))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return CHECK_LIB_AVAILABLE (&xpm_type, init_xpm_functions, libraries);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (HAVE_JPEG) || defined (MAC_OS)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (EQ (type, Qjpeg))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return CHECK_LIB_AVAILABLE (&jpeg_type, init_jpeg_functions, libraries);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (HAVE_TIFF) || defined (MAC_OS)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (EQ (type, Qtiff))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return CHECK_LIB_AVAILABLE (&tiff_type, init_tiff_functions, libraries);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (HAVE_GIF) || defined (MAC_OS)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (EQ (type, Qgif))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return CHECK_LIB_AVAILABLE (&gif_type, init_gif_functions, libraries);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (HAVE_PNG) || defined (MAC_OS)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (EQ (type, Qpng))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return CHECK_LIB_AVAILABLE (&png_type, init_png_functions, libraries);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (HAVE_RSVG)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (EQ (type, Qsvg))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return CHECK_LIB_AVAILABLE (&svg_type, init_svg_functions, libraries);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_GHOSTSCRIPT
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 if (EQ (type, Qpostscript))
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return CHECK_LIB_AVAILABLE (&gs_type, init_gs_functions, libraries);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* If the type is not recognized, avoid testing it ever again. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 CACHE_IMAGE_TYPE (type, Qnil);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 return Qnil;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 syms_of_image ()
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 extern Lisp_Object Qrisky_local_variable; /* Syms_of_xdisp has already run. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Initialize this only once, since that's what we do with Vimage_types
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 and they are supposed to be in sync. Initializing here gives correct
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 operation on GNU/Linux of calling dump-emacs after loading some images. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image_types = NULL;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* Must be defined now becase we're going to update it below, while
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 defining the supported image types. */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEFVAR_LISP ("image-types", &Vimage_types,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 doc: /* List of potentially supported image types.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Each element of the list is a symbol for a image type, like 'jpeg or 'png.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 To check whether it is really supported, use `image-type-available-p'. */);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Vimage_types = Qnil;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEFVAR_LISP ("image-library-alist", &Vimage_library_alist,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 doc: /* Alist of image types vs external libraries needed to display them.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Each element is a list (IMAGE-TYPE LIBRARY...), where the car is a symbol
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 representing a supported image type, and the rest are strings giving
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 alternate filenames for the corresponding external libraries.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Emacs tries to load the libraries in the order they appear on the
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 list; if none is loaded, the running session of Emacs won't
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 support the image type. Types 'pbm and 'xbm don't need to be
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 listed; they are always supported. */);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Vimage_library_alist = Qnil;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Fput (intern ("image-library-alist"), Qrisky_local_variable, Qt);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEFVAR_LISP ("max-image-size", &Vmax_image_size,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 doc: /* Maximum size of images.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Emacs will not load an image into memory if its pixel width or
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 pixel height exceeds this limit.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 If the value is an integer, it directly specifies the maximum
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 image height and width, measured in pixels. If it is a floating
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 point number, it specifies the maximum image height and width
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 as a ratio to the frame height and width. If the value is
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 non-numeric, there is no explicit limit on the size of images. */);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Vmax_image_size = make_float (MAX_IMAGE_SIZE);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Vimage_type_cache = Qnil;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&Vimage_type_cache);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Qpbm = intern ("pbm");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&Qpbm);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ADD_IMAGE_TYPE (Qpbm);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Qxbm = intern ("xbm");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&Qxbm);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ADD_IMAGE_TYPE (Qxbm);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 define_image_type (&xbm_type, 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 define_image_type (&pbm_type, 1);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 QCascent = intern (":ascent");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&QCascent);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 QCmargin = intern (":margin");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&QCmargin);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 QCrelief = intern (":relief");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&QCrelief);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 QCconversion = intern (":conversion");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&QCconversion);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 QCcolor_symbols = intern (":color-symbols");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&QCcolor_symbols);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 QCheuristic_mask = intern (":heuristic-mask");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&QCheuristic_mask);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 QCindex = intern (":index");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&QCindex);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 QCmatrix = intern (":matrix");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&QCmatrix);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 QCcolor_adjustment = intern (":color-adjustment");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&QCcolor_adjustment);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 QCmask = intern (":mask");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&QCmask);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Qlaplace = intern ("laplace");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&Qlaplace);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Qemboss = intern ("emboss");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&Qemboss);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Qedge_detection = intern ("edge-detection");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&Qedge_detection);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Qheuristic = intern ("heuristic");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&Qheuristic);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Qpostscript = intern ("postscript");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&Qpostscript);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_GHOSTSCRIPT
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ADD_IMAGE_TYPE (Qpostscript);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 QCloader = intern (":loader");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&QCloader);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 QCbounding_box = intern (":bounding-box");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&QCbounding_box);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 QCpt_width = intern (":pt-width");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&QCpt_width);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 QCpt_height = intern (":pt-height");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&QCpt_height);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_GHOSTSCRIPT */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (HAVE_XPM) || defined (MAC_OS)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Qxpm = intern ("xpm");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&Qxpm);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ADD_IMAGE_TYPE (Qxpm);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (HAVE_JPEG) || defined (MAC_OS)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Qjpeg = intern ("jpeg");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&Qjpeg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ADD_IMAGE_TYPE (Qjpeg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (HAVE_TIFF) || defined (MAC_OS)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Qtiff = intern ("tiff");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&Qtiff);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ADD_IMAGE_TYPE (Qtiff);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (HAVE_GIF) || defined (MAC_OS)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Qgif = intern ("gif");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&Qgif);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ADD_IMAGE_TYPE (Qgif);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (HAVE_PNG) || defined (MAC_OS)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Qpng = intern ("png");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&Qpng);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ADD_IMAGE_TYPE (Qpng);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (HAVE_RSVG)
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Qsvg = intern ("svg");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&Qsvg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 ADD_IMAGE_TYPE (Qsvg);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #ifdef HAVE_NTGUI
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Qgdk_pixbuf = intern ("gdk-pixbuf");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&Qgdk_pixbuf);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Qglib = intern ("glib");
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 staticpro (&Qglib);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_NTGUI */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif /* HAVE_RSVG */
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 defsubr (&Sinit_image_library);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 defsubr (&Sclear_image_cache);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 defsubr (&Simage_refresh);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 defsubr (&Simage_size);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 defsubr (&Simage_mask_p);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 defsubr (&Simage_extension_data);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if GLYPH_DEBUG
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 defsubr (&Simagep);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 defsubr (&Slookup_image);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEFVAR_BOOL ("cross-disabled-images", &cross_disabled_images,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 doc: /* Non-nil means always draw a cross over disabled images.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Disabled images are those having a `:conversion disabled' property.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 A cross is always drawn on black & white displays. */);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 cross_disabled_images = 0;
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEFVAR_LISP ("x-bitmap-file-path", &Vx_bitmap_file_path,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 doc: /* List of directories to search for window system bitmap files. */);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Vx_bitmap_file_path = decode_env_path ((char *) 0, PATH_BITMAPS);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 DEFVAR_LISP ("image-cache-eviction-delay", &Vimage_cache_eviction_delay,
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 doc: /* Time after which cached images are removed from the cache.
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 When an image has not been displayed this many seconds, remove it
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 from the image cache. Value must be an integer or nil with nil
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 meaning don't clear the cache. */);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 Vimage_cache_eviction_delay = make_number (30 * 60);
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 void
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 init_image ()
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 {
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #if defined (MAC_OSX) && TARGET_API_MAC_CARBON
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 init_image_func_pointer ();
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 #endif
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 }
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 /* arch-tag: 123c2a5e-14a8-4c53-ab95-af47d7db49b9
+ 鐃緒申��申鐃初姐�渇����鐃醇�鐃緒申��申鐃緒申 (do not change this comment) */