/* The symbol `postscript' identifying images of this type. */
-Lisp_Object Qpostscript;
+static Lisp_Object Qpostscript;
static void x_disable_image (struct frame *, struct image *);
static void x_edge_detection (struct frame *, struct image *, Lisp_Object,
static unsigned long *colors_in_color_table (int *n);
static unsigned long lookup_pixel_color (struct frame *f, unsigned long p);
#endif
+INFUN (Finit_image_library, 2);
/* Code to deal with bitmaps. Bitmaps are referenced by their bitmap
id, which is just an int that this section returns. Bitmaps are
/* The symbol `xbm' which is used as the type symbol for XBM images. */
-Lisp_Object Qxbm;
+static Lisp_Object Qxbm;
/* Keywords. */
-Lisp_Object QCascent, QCmargin, QCrelief, Qcount, Qextension_data;
-Lisp_Object QCconversion, QCcolor_symbols, QCheuristic_mask;
-Lisp_Object QCindex, QCmatrix, QCcolor_adjustment, QCmask, QCgeometry, QCcrop, QCrotation;
+Lisp_Object QCascent, QCmargin, QCrelief;
+static Lisp_Object Qcount, Qextension_data;
+Lisp_Object QCconversion;
+static Lisp_Object QCheuristic_mask;
+static Lisp_Object QCcolor_symbols;
+static Lisp_Object QCindex, QCmatrix, QCcolor_adjustment, QCmask, QCgeometry;
+static Lisp_Object QCcrop, QCrotation;
/* Other symbols. */
-Lisp_Object Qlaplace, Qemboss, Qedge_detection, Qheuristic;
+static Lisp_Object Qlaplace, Qemboss, Qedge_detection, Qheuristic;
/* Function prototypes. */
#if defined (HAVE_XPM) || defined (HAVE_NS)
/* The symbol `xpm' identifying XPM-format images. */
-Lisp_Object Qxpm;
+static Lisp_Object Qxpm;
/* Indices of image specification fields in xpm_format, below. */
size. */
#define XPM_COLOR_CACHE_BUCKETS 1001
-struct xpm_cached_color **xpm_color_cache;
+static struct xpm_cached_color **xpm_color_cache;
/* Initialize the color cache. */
#endif /* HAVE_XPM || HAVE_NS */
-#if defined (HAVE_XPM) && defined (HAVE_X_WINDOWS)
+#if defined HAVE_XPM && defined HAVE_X_WINDOWS && !defined USE_GTK
int
x_create_bitmap_from_xpm_data (struct frame *f, const char **bits)
{
/* The color hash table. */
-struct ct_color **ct_table;
+static struct ct_color **ct_table;
/* Number of entries in the color table. */
-int ct_colors_allocated;
+static int ct_colors_allocated;
/* Initialize the color table. */
/* The symbol `pbm' identifying images of this type. */
-Lisp_Object Qpbm;
+static Lisp_Object Qpbm;
/* Indices of image specification fields in gs_format, below. */
/* The symbol `png' identifying images of this type. */
-Lisp_Object Qpng;
+static Lisp_Object Qpng;
/* Indices of image specification fields in png_format, below. */
/* The symbol `jpeg' identifying images of this type. */
-Lisp_Object Qjpeg;
+static Lisp_Object Qjpeg;
/* Indices of image specification fields in gs_format, below. */
/* The symbol `tiff' identifying images of this type. */
-Lisp_Object Qtiff;
+static Lisp_Object Qtiff;
/* Indices of image specification fields in tiff_format, below. */
/* The symbol `gif' identifying images of this type. */
-Lisp_Object Qgif;
+static Lisp_Object Qgif;
/* Indices of image specification fields in gif_format, below. */
/***********************************************************************
- imagemagick
+ ImageMagick
***********************************************************************/
#if defined (HAVE_IMAGEMAGICK)
-/* The symbol `imagemagick' identifying images of this type. */
-
Lisp_Object Qimagemagick;
-/* Indices of image specification fields in imagemagick_format, below. */
+
+/* Indices of image specification fields in imagemagick_format. */
enum imagemagick_keyword_index
{
{":rotation", IMAGE_NUMBER_VALUE, 0},
{":crop", IMAGE_DONT_CHECK_VALUE_TYPE, 0}
};
+
/* Free X resources of imagemagick image IMG which is used on frame F. */
static void
x_clear_image (f, img);
}
-
-
/* Return non-zero if OBJECT is a valid IMAGEMAGICK image specification. Do
this by calling parse_image_spec and supplying the keywords that
identify the IMAGEMAGICK format. */
Uses librimagemagick to do most of the image processing.
- non-zero when successful.
+ Return non-zero if successful.
*/
static int
Image * im_image;
- /* Handle image index for image types who can contain more than one
- image. Interface :index is same as for GIF. First we "ping" the
- image to see how many sub-images it contains. Pinging is faster
- than loading the image to find out things about it. */
+ /* Handle image index for image types who can contain more than one image.
+ Interface :index is same as for GIF. First we "ping" the image to see how
+ many sub-images it contains. Pinging is faster than loading the image to
+ find out things about it. */
- /* `MagickWandGenesis' initializes the imagemagick environment. */
+ /* Initialize the imagemagick environment. */
MagickWandGenesis ();
image = image_spec_value (img->spec, QCindex, NULL);
ino = INTEGERP (image) ? XFASTINT (image) : 0;
DestroyMagickWand (ping_wand);
/* Now, after pinging, we know how many images are inside the
- file. If its not a bundle, just one. */
+ file. If it's not a bundle, the number is one. */
if (filename != NULL)
{
if (status == MagickFalse) goto imagemagick_error;
/* If width and/or height is set in the display spec assume we want
- to scale to those values. if either h or w is unspecified, the
+ to scale to those values. If either h or w is unspecified, the
unspecified should be calculated from the specified to preserve
aspect ratio. */
height = MagickGetImageHeight (image_wand);
width = MagickGetImageWidth (image_wand);
- if(desired_width != -1 && desired_height == -1)
- {
- /* w known, calculate h. */
- desired_height = (double) desired_width / width * height;
- }
- if(desired_width == -1 && desired_height != -1)
- {
- /* h known, calculate w. */
- desired_width = (double) desired_height / height * width;
- }
- if(desired_width != -1 && desired_height != -1)
+ if (desired_width != -1 && desired_height == -1)
+ /* w known, calculate h. */
+ desired_height = (double) desired_width / width * height;
+ if (desired_width == -1 && desired_height != -1)
+ /* h known, calculate w. */
+ desired_width = (double) desired_height / height * width;
+ if (desired_width != -1 && desired_height != -1)
{
status = MagickScaleImage (image_wand, desired_width, desired_height);
if (status == MagickFalse)
}
}
-
/* crop behaves similar to image slicing in Emacs but is more memory
efficient. */
crop = image_spec_value (img->spec, QCcrop, NULL);
if (CONSP (crop) && INTEGERP (XCAR (crop)))
{
- /* After some testing, it seems MagickCropImage is the fastest
- crop function in ImageMagick. This crop function seems to do
- less copying than the alternatives, but it still reads the
- entire image into memory before croping, which is aparently
- difficult to avoid when using imagemagick. */
-
+ /* After some testing, it seems MagickCropImage is the fastest crop
+ function in ImageMagick. This crop function seems to do less copying
+ than the alternatives, but it still reads the entire image into memory
+ before croping, which is aparently difficult to avoid when using
+ imagemagick. */
int w, h, x, y;
w = XFASTINT (XCAR (crop));
crop = XCDR (crop);
};
-
-
DEFUN ("imagemagick-types", Fimagemagick_types, Simagemagick_types, 0, 0, 0,
- doc: /* Return image file types supported by ImageMagick.
-Since ImageMagick recognizes a lot of file-types that clash with Emacs,
-such as .c, we want to be able to alter the list at the lisp level. */)
+ doc: /* Return the image types supported by ImageMagick.
+Note that ImageMagick recognizes many file-types that Emacs does not recognize
+as images, such as .c. */)
(void)
{
Lisp_Object typelist = Qnil;
/* Keyword symbols. */
-Lisp_Object QCloader, QCbounding_box, QCpt_width, QCpt_height;
+static Lisp_Object QCloader, QCbounding_box, QCpt_width, QCpt_height;
/* Indices of image specification fields in gs_format, below. */