summaryrefslogtreecommitdiff
path: root/src/image.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/image.c')
-rw-r--r--src/image.c321
1 files changed, 165 insertions, 156 deletions
diff --git a/src/image.c b/src/image.c
index 8e3a9a4930a..1cf90c88c5c 100644
--- a/src/image.c
+++ b/src/image.c
@@ -111,9 +111,9 @@ typedef struct ns_bitmap_record Bitmap_Record;
# define COLOR_TABLE_SUPPORT 1
#endif
-static void x_disable_image (struct frame *, struct image *);
-static void x_edge_detection (struct frame *, struct image *, Lisp_Object,
- Lisp_Object);
+static void image_disable_image (struct frame *, struct image *);
+static void image_edge_detection (struct frame *, struct image *, Lisp_Object,
+ Lisp_Object);
static void init_color_table (void);
static unsigned long lookup_rgb_color (struct frame *f, int r, int g, int b);
@@ -129,8 +129,8 @@ static unsigned long *colors_in_color_table (int *n);
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
+ If you use image_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 HAVE_NS
@@ -169,7 +169,7 @@ x_bitmap_width (struct frame *f, ptrdiff_t id)
#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI)
ptrdiff_t
-x_bitmap_pixmap (struct frame *f, ptrdiff_t id)
+image_bitmap_pixmap (struct frame *f, ptrdiff_t id)
{
/* HAVE_NTGUI needs the explicit cast here. */
return (ptrdiff_t) FRAME_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap;
@@ -187,7 +187,7 @@ x_bitmap_mask (struct frame *f, ptrdiff_t id)
/* Allocate a new bitmap record. Returns index of new record. */
static ptrdiff_t
-x_allocate_bitmap_record (struct frame *f)
+image_allocate_bitmap_record (struct frame *f)
{
Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f);
ptrdiff_t i;
@@ -208,7 +208,7 @@ x_allocate_bitmap_record (struct frame *f)
/* Add one reference to the reference count of the bitmap with id ID. */
void
-x_reference_bitmap (struct frame *f, ptrdiff_t id)
+image_reference_bitmap (struct frame *f, ptrdiff_t id)
{
++FRAME_DISPLAY_INFO (f)->bitmaps[id - 1].refcount;
}
@@ -216,7 +216,8 @@ x_reference_bitmap (struct frame *f, ptrdiff_t id)
/* Create a bitmap for frame F from a HEIGHT x WIDTH array of bits at BITS. */
ptrdiff_t
-x_create_bitmap_from_data (struct frame *f, char *bits, unsigned int width, unsigned int height)
+image_create_bitmap_from_data (struct frame *f, char *bits,
+ unsigned int width, unsigned int height)
{
Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f);
ptrdiff_t id;
@@ -246,7 +247,7 @@ x_create_bitmap_from_data (struct frame *f, char *bits, unsigned int width, unsi
return -1;
#endif
- id = x_allocate_bitmap_record (f);
+ id = image_allocate_bitmap_record (f);
#ifdef HAVE_NS
dpyinfo->bitmaps[id - 1].img = bitmap;
@@ -276,7 +277,7 @@ x_create_bitmap_from_data (struct frame *f, char *bits, unsigned int width, unsi
/* Create bitmap from file FILE for frame F. */
ptrdiff_t
-x_create_bitmap_from_file (struct frame *f, Lisp_Object file)
+image_create_bitmap_from_file (struct frame *f, Lisp_Object file)
{
#ifdef HAVE_NTGUI
return -1; /* W32_TODO : bitmap support */
@@ -292,7 +293,7 @@ x_create_bitmap_from_file (struct frame *f, Lisp_Object file)
return -1;
- id = x_allocate_bitmap_record (f);
+ id = image_allocate_bitmap_record (f);
dpyinfo->bitmaps[id - 1].img = bitmap;
dpyinfo->bitmaps[id - 1].refcount = 1;
dpyinfo->bitmaps[id - 1].file = xlispstrdup (file);
@@ -335,7 +336,7 @@ x_create_bitmap_from_file (struct frame *f, Lisp_Object file)
if (result != BitmapSuccess)
return -1;
- id = x_allocate_bitmap_record (f);
+ id = image_allocate_bitmap_record (f);
dpyinfo->bitmaps[id - 1].pixmap = bitmap;
dpyinfo->bitmaps[id - 1].have_mask = false;
dpyinfo->bitmaps[id - 1].refcount = 1;
@@ -377,7 +378,7 @@ free_bitmap_record (Display_Info *dpyinfo, Bitmap_Record *bm)
/* Remove reference to bitmap with id number ID. */
void
-x_destroy_bitmap (struct frame *f, ptrdiff_t id)
+image_destroy_bitmap (struct frame *f, ptrdiff_t id)
{
Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f);
@@ -397,7 +398,7 @@ x_destroy_bitmap (struct frame *f, ptrdiff_t id)
/* Free all the bitmaps for the display specified by DPYINFO. */
void
-x_destroy_all_bitmaps (Display_Info *dpyinfo)
+image_destroy_all_bitmaps (Display_Info *dpyinfo)
{
ptrdiff_t i;
Bitmap_Record *bm = dpyinfo->bitmaps;
@@ -410,13 +411,13 @@ x_destroy_all_bitmaps (Display_Info *dpyinfo)
}
#ifndef HAVE_XRENDER
-/* Required for the definition of x_create_x_image_and_pixmap below. */
+/* Required for the definition of image_create_x_image_and_pixmap_1 below. */
typedef void Picture;
#endif
-static bool x_create_x_image_and_pixmap (struct frame *, int, int, int,
- XImagePtr *, Pixmap *, Picture *);
-static void x_destroy_x_image (XImagePtr ximg);
+static bool image_create_x_image_and_pixmap_1 (struct frame *, int, int, int,
+ XImagePtr *, Pixmap *, Picture *);
+static void image_destroy_x_image (XImagePtr ximg);
#ifdef HAVE_NTGUI
static XImagePtr_or_DC image_get_x_image_or_dc (struct frame *, struct image *,
@@ -464,7 +465,7 @@ x_create_bitmap_mask (struct frame *f, ptrdiff_t id)
if (!(id > 0))
return;
- pixmap = x_bitmap_pixmap (f, id);
+ pixmap = image_bitmap_pixmap (f, id);
width = x_bitmap_width (f, id);
height = x_bitmap_height (f, id);
@@ -478,8 +479,8 @@ x_create_bitmap_mask (struct frame *f, ptrdiff_t id)
return;
}
- result = x_create_x_image_and_pixmap (f, width, height, 1,
- &mask_img, &mask, NULL);
+ result = image_create_x_image_and_pixmap_1 (f, width, height, 1,
+ &mask_img, &mask, NULL);
unblock_input ();
if (!result)
@@ -523,7 +524,7 @@ x_create_bitmap_mask (struct frame *f, ptrdiff_t id)
dpyinfo->bitmaps[id - 1].mask = mask;
XDestroyImage (ximg);
- x_destroy_x_image (mask_img);
+ image_destroy_x_image (mask_img);
}
#endif /* HAVE_X_WINDOWS */
@@ -567,9 +568,9 @@ static struct image_type *image_types;
/* Forward function prototypes. */
static struct image_type *lookup_image_type (Lisp_Object);
-static void x_laplace (struct frame *, struct image *);
-static void x_emboss (struct frame *, struct image *);
-static void x_build_heuristic_mask (struct frame *, struct image *,
+static void image_laplace (struct frame *, struct image *);
+static void image_emboss (struct frame *, struct image *);
+static void image_build_heuristic_mask (struct frame *, struct image *,
Lisp_Object);
#ifdef WINDOWSNT
#define CACHE_IMAGE_TYPE(type, status) \
@@ -1313,7 +1314,7 @@ image_background_transparent (struct image *img, struct frame *f, XImagePtr_or_D
/* Store F's background color into *BGCOLOR. */
static void
-x_query_frame_background_color (struct frame *f, XColor *bgcolor)
+image_query_frame_background_color (struct frame *f, XColor *bgcolor)
{
#ifndef HAVE_NS
bgcolor->pixel = FRAME_BACKGROUND_PIXEL (f);
@@ -1341,7 +1342,7 @@ x_query_frame_background_color (struct frame *f, XColor *bgcolor)
#define CLEAR_IMAGE_COLORS (1 << 2)
static void
-x_clear_image_1 (struct frame *f, struct image *img, int flags)
+image_clear_image_1 (struct frame *f, struct image *img, int flags)
{
if (flags & CLEAR_IMAGE_PIXMAP)
{
@@ -1355,7 +1356,7 @@ x_clear_image_1 (struct frame *f, struct image *img, int flags)
#ifdef HAVE_X_WINDOWS
if (img->ximg)
{
- x_destroy_x_image (img->ximg);
+ image_destroy_x_image (img->ximg);
img->ximg = NULL;
img->background_valid = 0;
}
@@ -1373,7 +1374,7 @@ x_clear_image_1 (struct frame *f, struct image *img, int flags)
#ifdef HAVE_X_WINDOWS
if (img->mask_img)
{
- x_destroy_x_image (img->mask_img);
+ image_destroy_x_image (img->mask_img);
img->mask_img = NULL;
img->background_transparent_valid = 0;
}
@@ -1396,14 +1397,14 @@ x_clear_image_1 (struct frame *f, struct image *img, int flags)
/* Free X resources of image IMG which is used on frame F. */
static void
-x_clear_image (struct frame *f, struct image *img)
+image_clear_image (struct frame *f, struct image *img)
{
block_input ();
#ifdef USE_CAIRO
if (img->cr_data)
cairo_surface_destroy ((cairo_surface_t *)img->cr_data);
#endif
- x_clear_image_1 (f, img,
+ image_clear_image_1 (f, img,
CLEAR_IMAGE_PIXMAP | CLEAR_IMAGE_MASK | CLEAR_IMAGE_COLORS);
unblock_input ();
}
@@ -1415,8 +1416,8 @@ x_clear_image (struct frame *f, struct image *img)
color. */
static unsigned long
-x_alloc_image_color (struct frame *f, struct image *img, Lisp_Object color_name,
- unsigned long dflt)
+image_alloc_image_color (struct frame *f, struct image *img,
+ Lisp_Object color_name, unsigned long dflt)
{
XColor color;
unsigned long result;
@@ -1715,7 +1716,7 @@ postprocess_image (struct frame *f, struct image *img)
mask = image_spec_value (spec, QCheuristic_mask, NULL);
if (!NILP (mask))
- x_build_heuristic_mask (f, img, mask);
+ image_build_heuristic_mask (f, img, mask);
else
{
bool found_p;
@@ -1723,37 +1724,37 @@ postprocess_image (struct frame *f, struct image *img)
mask = image_spec_value (spec, QCmask, &found_p);
if (EQ (mask, Qheuristic))
- x_build_heuristic_mask (f, img, Qt);
+ image_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)));
+ image_build_heuristic_mask (f, img, XCAR (XCDR (mask)));
else
- x_build_heuristic_mask (f, img, XCDR (mask));
+ image_build_heuristic_mask (f, img, XCDR (mask));
}
else if (NILP (mask) && found_p && img->mask)
- x_clear_image_1 (f, img, CLEAR_IMAGE_MASK);
+ image_clear_image_1 (f, img, CLEAR_IMAGE_MASK);
}
/* Should we apply an image transformation algorithm? */
conversion = image_spec_value (spec, QCconversion, NULL);
if (EQ (conversion, Qdisabled))
- x_disable_image (f, img);
+ image_disable_image (f, img);
else if (EQ (conversion, Qlaplace))
- x_laplace (f, img);
+ image_laplace (f, img);
else if (EQ (conversion, Qemboss))
- x_emboss (f, img);
+ image_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));
+ image_edge_detection (f, img,
+ Fplist_get (tem, QCmatrix),
+ Fplist_get (tem, QCcolor_adjustment));
}
}
}
@@ -1860,7 +1861,7 @@ compute_image_size (size_t width, size_t height,
#endif /* HAVE_IMAGEMAGICK || HAVE_NATIVE_SCALING */
static void
-x_set_image_size (struct frame *f, struct image *img)
+image_set_image_size (struct frame *f, struct image *img)
{
#ifdef HAVE_NATIVE_SCALING
# ifdef HAVE_IMAGEMAGICK
@@ -1964,7 +1965,7 @@ lookup_image (struct frame *f, Lisp_Object spec)
`:background COLOR'. */
Lisp_Object ascent, margin, relief, bg;
int relief_bound;
- x_set_image_size (f, img);
+ image_set_image_size (f, img);
ascent = image_spec_value (spec, QCascent, NULL);
if (FIXNUMP (ascent))
@@ -1996,8 +1997,8 @@ lookup_image (struct frame *f, Lisp_Object spec)
if (!NILP (bg))
{
img->background
- = x_alloc_image_color (f, img, bg,
- FRAME_BACKGROUND_PIXEL (f));
+ = image_alloc_image_color (f, img, bg,
+ FRAME_BACKGROUND_PIXEL (f));
img->background_valid = 1;
}
}
@@ -2094,7 +2095,7 @@ mark_image_cache (struct image_cache *c)
WIDTH and HEIGHT must both be positive.
If XIMG is null, assume it is a bitmap. */
static bool
-x_check_image_size (XImagePtr ximg, int width, int height)
+image_check_image_size (XImagePtr ximg, int width, int height)
{
#ifdef HAVE_X_WINDOWS
/* Respect Xlib's limits: it cannot deal with images that have more
@@ -2138,8 +2139,8 @@ x_check_image_size (XImagePtr ximg, int width, int height)
should indicate the bit depth of the image. */
static bool
-x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth,
- XImagePtr *ximg, Pixmap *pixmap, Picture *picture)
+image_create_x_image_and_pixmap_1 (struct frame *f, int width, int height, int depth,
+ XImagePtr *ximg, Pixmap *pixmap, Picture *picture)
{
#ifdef HAVE_X_WINDOWS
Display *display = FRAME_X_DISPLAY (f);
@@ -2159,9 +2160,9 @@ x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth,
return 0;
}
- if (! x_check_image_size (*ximg, width, height))
+ if (! image_check_image_size (*ximg, width, height))
{
- x_destroy_x_image (*ximg);
+ image_destroy_x_image (*ximg);
*ximg = NULL;
image_error ("Image too large (%dx%d)",
make_fixnum (width), make_fixnum (height));
@@ -2175,7 +2176,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth,
*pixmap = XCreatePixmap (display, drawable, width, height, depth);
if (*pixmap == NO_PIXMAP)
{
- x_destroy_x_image (*ximg);
+ image_destroy_x_image (*ximg);
*ximg = NULL;
image_error ("Unable to create X pixmap");
return 0;
@@ -2297,7 +2298,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth,
/* All system errors are < 10000, so the following is safe. */
XSETINT (errcode, err);
image_error ("Unable to create bitmap, error code %d", errcode);
- x_destroy_x_image (*ximg);
+ image_destroy_x_image (*ximg);
*ximg = NULL;
return 0;
}
@@ -2323,7 +2324,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth,
/* Destroy XImage XIMG. Free XIMG->data. */
static void
-x_destroy_x_image (XImagePtr ximg)
+image_destroy_x_image (XImagePtr ximg)
{
eassert (input_blocked_p ());
if (ximg)
@@ -2349,7 +2350,8 @@ x_destroy_x_image (XImagePtr ximg)
are width and height of both the image and pixmap. */
static void
-x_put_x_image (struct frame *f, XImagePtr ximg, Pixmap pixmap, int width, int height)
+gui_put_x_image (struct frame *f, XImagePtr ximg, Pixmap pixmap,
+ int width, int height)
{
#ifdef HAVE_X_WINDOWS
GC gc;
@@ -2375,7 +2377,7 @@ x_put_x_image (struct frame *f, XImagePtr ximg, Pixmap pixmap, int width, int he
#endif
}
-/* Thin wrapper for x_create_x_image_and_pixmap, so that it matches
+/* Thin wrapper for image_create_x_image_and_pixmap_1, so that it matches
with image_put_x_image. */
static bool
@@ -2389,9 +2391,9 @@ image_create_x_image_and_pixmap (struct frame *f, struct image *img,
#ifdef HAVE_XRENDER
picture = !mask_p ? &img->picture : &img->mask_picture;
#endif
- return x_create_x_image_and_pixmap (f, width, height, depth, ximg,
- !mask_p ? &img->pixmap : &img->mask,
- picture);
+ return image_create_x_image_and_pixmap_1 (f, width, height, depth, ximg,
+ !mask_p ? &img->pixmap : &img->mask,
+ picture);
}
/* Put X image XIMG into image IMG on frame F, as a mask if and only
@@ -2416,9 +2418,9 @@ image_put_x_image (struct frame *f, struct image *img, XImagePtr ximg,
img->mask_img = ximg;
}
#else
- x_put_x_image (f, ximg, !mask_p ? img->pixmap : img->mask,
- img->width, img->height);
- x_destroy_x_image (ximg);
+ gui_put_x_image (f, ximg, !mask_p ? img->pixmap : img->mask,
+ img->width, img->height);
+ image_destroy_x_image (ximg);
#endif
}
@@ -2431,14 +2433,14 @@ image_sync_to_pixmaps (struct frame *f, struct image *img)
{
if (img->ximg)
{
- x_put_x_image (f, img->ximg, img->pixmap, img->width, img->height);
- x_destroy_x_image (img->ximg);
+ gui_put_x_image (f, img->ximg, img->pixmap, img->width, img->height);
+ image_destroy_x_image (img->ximg);
img->ximg = NULL;
}
if (img->mask_img)
{
- x_put_x_image (f, img->mask_img, img->mask, img->width, img->height);
- x_destroy_x_image (img->mask_img);
+ gui_put_x_image (f, img->mask_img, img->mask, img->width, img->height);
+ image_destroy_x_image (img->mask_img);
img->mask_img = NULL;
}
}
@@ -2520,7 +2522,7 @@ image_unget_x_image (struct image *img, bool mask_p, XImagePtr ximg)
PFD is null, do not open the file. */
static Lisp_Object
-x_find_image_fd (Lisp_Object file, int *pfd)
+image_find_image_fd (Lisp_Object file, int *pfd)
{
Lisp_Object file_found, search_path;
int fd;
@@ -2558,9 +2560,9 @@ x_find_image_fd (Lisp_Object file, int *pfd)
found, or nil if not found. */
Lisp_Object
-x_find_image_file (Lisp_Object file)
+image_find_image_file (Lisp_Object file)
{
- return x_find_image_fd (file, 0);
+ return image_find_image_fd (file, 0);
}
/* Read FILE into memory. Value is a pointer to a buffer allocated
@@ -2661,7 +2663,7 @@ static struct image_type xbm_type =
SYMBOL_INDEX (Qxbm),
xbm_image_p,
xbm_load,
- x_clear_image,
+ image_clear_image,
NULL,
NULL
};
@@ -2981,7 +2983,7 @@ Create_Pixmap_From_Bitmap_Data (struct frame *f, struct image *img, char *data,
#else
img->pixmap =
- (x_check_image_size (0, img->width, img->height)
+ (image_check_image_size (0, img->width, img->height)
? XCreatePixmapFromBitmapData (FRAME_X_DISPLAY (f),
FRAME_X_DRAWABLE (f),
data,
@@ -3098,7 +3100,7 @@ xbm_read_bitmap_data (struct frame *f, char *contents, char *end,
expect ('=');
expect ('{');
- if (! x_check_image_size (0, *width, *height))
+ if (! image_check_image_size (0, *width, *height))
{
if (!inhibit_image_error)
image_error ("Image too large (%dx%d)",
@@ -3186,13 +3188,13 @@ xbm_load_image (struct frame *f, struct image *img, char *contents, char *end)
value = image_spec_value (img->spec, QCforeground, NULL);
if (!NILP (value))
{
- foreground = x_alloc_image_color (f, img, value, foreground);
+ foreground = image_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);
+ background = image_alloc_image_color (f, img, value, background);
img->background = background;
img->background_valid = 1;
non_default_colors = 1;
@@ -3205,7 +3207,7 @@ xbm_load_image (struct frame *f, struct image *img, char *contents, char *end)
if (img->pixmap == NO_PIXMAP)
{
- x_clear_image (f, img);
+ image_clear_image (f, img);
image_error ("Unable to create X pixmap for `%s'", img->spec);
}
else
@@ -3247,7 +3249,7 @@ xbm_load (struct frame *f, struct image *img)
if (STRINGP (file_name))
{
int fd;
- Lisp_Object file = x_find_image_fd (file_name, &fd);
+ Lisp_Object file = image_find_image_fd (file_name, &fd);
if (!STRINGP (file))
{
image_error ("Cannot find image file `%s'", file_name);
@@ -3302,16 +3304,20 @@ xbm_load (struct frame *f, struct image *img)
if (fmt[XBM_FOREGROUND].count
&& STRINGP (fmt[XBM_FOREGROUND].value))
{
- foreground = x_alloc_image_color (f, img, fmt[XBM_FOREGROUND].value,
- foreground);
+ foreground = image_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);
+ background = image_alloc_image_color (f,
+ img,
+ fmt[XBM_BACKGROUND].value,
+ background);
non_default_colors = 1;
}
@@ -3358,7 +3364,7 @@ xbm_load (struct frame *f, struct image *img)
#endif
/* Create the pixmap. */
- if (x_check_image_size (0, img->width, img->height))
+ if (image_check_image_size (0, img->width, img->height))
Create_Pixmap_From_Bitmap_Data (f, img, bits,
foreground, background,
non_default_colors);
@@ -3371,7 +3377,7 @@ xbm_load (struct frame *f, struct image *img)
{
image_error ("Unable to create pixmap for XBM image `%s'",
img->spec);
- x_clear_image (f, img);
+ image_clear_image (f, img);
}
SAFE_FREE ();
@@ -3468,7 +3474,7 @@ static struct image_type xpm_type =
SYMBOL_INDEX (Qxpm),
xpm_image_p,
xpm_load,
- x_clear_image,
+ image_clear_image,
init_xpm_functions,
NULL
};
@@ -3769,7 +3775,7 @@ x_create_bitmap_from_xpm_data (struct frame *f, const char **bits)
return -1;
}
- id = x_allocate_bitmap_record (f);
+ id = image_allocate_bitmap_record (f);
dpyinfo->bitmaps[id - 1].pixmap = bitmap;
dpyinfo->bitmaps[id - 1].have_mask = true;
dpyinfo->bitmaps[id - 1].mask = mask;
@@ -3903,7 +3909,7 @@ xpm_load (struct frame *f, struct image *img)
if (STRINGP (specified_file))
{
- Lisp_Object file = x_find_image_file (specified_file);
+ Lisp_Object file = image_find_image_file (specified_file);
if (!STRINGP (file))
{
image_error ("Cannot find image file `%s'", specified_file);
@@ -3993,7 +3999,7 @@ xpm_load (struct frame *f, struct image *img)
else
{
rc = XpmFileInvalid;
- x_clear_image (f, img);
+ image_clear_image (f, img);
}
#else
#ifdef HAVE_X_WINDOWS
@@ -4004,7 +4010,7 @@ xpm_load (struct frame *f, struct image *img)
img->ximg->depth);
if (img->pixmap == NO_PIXMAP)
{
- x_clear_image (f, img);
+ image_clear_image (f, img);
rc = XpmNoMemory;
}
else if (img->mask_img)
@@ -4015,7 +4021,7 @@ xpm_load (struct frame *f, struct image *img)
img->mask_img->depth);
if (img->mask == NO_PIXMAP)
{
- x_clear_image (f, img);
+ image_clear_image (f, img);
rc = XpmNoMemory;
}
}
@@ -4528,17 +4534,17 @@ xpm_load_image (struct frame *f,
}
else
{
- x_destroy_x_image (mask_img);
- x_clear_image_1 (f, img, CLEAR_IMAGE_MASK);
+ image_destroy_x_image (mask_img);
+ image_clear_image_1 (f, img, CLEAR_IMAGE_MASK);
}
#endif
return 1;
failure:
image_error ("Invalid XPM3 file (%s)", img->spec);
- x_destroy_x_image (ximg);
- x_destroy_x_image (mask_img);
- x_clear_image (f, img);
+ image_destroy_x_image (ximg);
+ image_destroy_x_image (mask_img);
+ image_clear_image (f, img);
return 0;
#undef match
@@ -4558,7 +4564,7 @@ xpm_load (struct frame *f,
if (STRINGP (file_name))
{
int fd;
- Lisp_Object file = x_find_image_fd (file_name, &fd);
+ Lisp_Object file = image_find_image_fd (file_name, &fd);
if (!STRINGP (file))
{
image_error ("Cannot find image file `%s'", file_name);
@@ -4789,7 +4795,7 @@ lookup_pixel_color (struct frame *f, unsigned long pixel)
#ifdef HAVE_X_WINDOWS
cmap = FRAME_X_COLORMAP (f);
color.pixel = pixel;
- x_query_color (f, &color);
+ x_query_colors (f, &color, 1);
rc = x_alloc_nearest_color (f, cmap, &color);
#else
block_input ();
@@ -4905,7 +4911,7 @@ static int laplace_matrix[9] = {
allocated with xmalloc; it must be freed by the caller. */
static XColor *
-x_to_xcolors (struct frame *f, struct image *img, bool rgb_p)
+image_to_xcolors (struct frame *f, struct image *img, bool rgb_p)
{
int x, y;
XColor *colors, *p;
@@ -4934,8 +4940,9 @@ x_to_xcolors (struct frame *f, struct image *img, bool rgb_p)
for (x = 0; x < img->width; ++x, ++p)
p->pixel = GET_PIXEL (ximg, x, y);
if (rgb_p)
- x_query_colors (f, row, img->width);
-
+ {
+ FRAME_TERMINAL (f)->query_colors (f, row, img->width);
+ }
#else
for (x = 0; x < img->width; ++x, ++p)
@@ -5008,7 +5015,7 @@ XPutPixel (XImagePtr ximg, int x, int y, COLORREF color)
COLORS will be freed; an existing IMG->pixmap will be freed, too. */
static void
-x_from_xcolors (struct frame *f, struct image *img, XColor *colors)
+image_from_xcolors (struct frame *f, struct image *img, XColor *colors)
{
int x, y;
XImagePtr oimg = NULL;
@@ -5016,7 +5023,7 @@ x_from_xcolors (struct frame *f, struct image *img, XColor *colors)
init_color_table ();
- x_clear_image_1 (f, img, CLEAR_IMAGE_PIXMAP | CLEAR_IMAGE_COLORS);
+ image_clear_image_1 (f, img, CLEAR_IMAGE_PIXMAP | CLEAR_IMAGE_COLORS);
image_create_x_image_and_pixmap (f, img, img->width, img->height, 0,
&oimg, 0);
p = colors;
@@ -5047,9 +5054,10 @@ x_from_xcolors (struct frame *f, struct image *img, XColor *colors)
outgoing image. */
static void
-x_detect_edges (struct frame *f, struct image *img, int *matrix, int color_adjust)
+image_detect_edges (struct frame *f, struct image *img,
+ int *matrix, int color_adjust)
{
- XColor *colors = x_to_xcolors (f, img, 1);
+ XColor *colors = image_to_xcolors (f, img, 1);
XColor *new, *p;
int x, y, i, sum;
ptrdiff_t nbytes;
@@ -5107,7 +5115,7 @@ x_detect_edges (struct frame *f, struct image *img, int *matrix, int color_adjus
}
xfree (colors);
- x_from_xcolors (f, img, new);
+ image_from_xcolors (f, img, new);
#undef COLOR
}
@@ -5117,9 +5125,9 @@ x_detect_edges (struct frame *f, struct image *img, int *matrix, int color_adjus
on frame F. */
static void
-x_emboss (struct frame *f, struct image *img)
+image_emboss (struct frame *f, struct image *img)
{
- x_detect_edges (f, img, emboss_matrix, 0xffff / 2);
+ image_detect_edges (f, img, emboss_matrix, 0xffff / 2);
}
@@ -5128,9 +5136,9 @@ x_emboss (struct frame *f, struct image *img)
to draw disabled buttons, for example. */
static void
-x_laplace (struct frame *f, struct image *img)
+image_laplace (struct frame *f, struct image *img)
{
- x_detect_edges (f, img, laplace_matrix, 45000);
+ image_detect_edges (f, img, laplace_matrix, 45000);
}
@@ -5146,8 +5154,8 @@ x_laplace (struct frame *f, struct image *img)
number. */
static void
-x_edge_detection (struct frame *f, struct image *img, Lisp_Object matrix,
- Lisp_Object color_adjust)
+image_edge_detection (struct frame *f, struct image *img,
+ Lisp_Object matrix, Lisp_Object color_adjust)
{
int i = 0;
int trans[9];
@@ -5169,14 +5177,14 @@ x_edge_detection (struct frame *f, struct image *img, Lisp_Object matrix,
color_adjust = make_fixnum (0xffff / 2);
if (i == 9 && NUMBERP (color_adjust))
- x_detect_edges (f, img, trans, XFLOATINT (color_adjust));
+ image_detect_edges (f, img, trans, XFLOATINT (color_adjust));
}
/* Transform image IMG on frame F so that it looks disabled. */
static void
-x_disable_image (struct frame *f, struct image *img)
+image_disable_image (struct frame *f, struct image *img)
{
Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f);
#ifdef HAVE_NTGUI
@@ -5190,7 +5198,7 @@ x_disable_image (struct frame *f, struct image *img)
/* 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 *colors = image_to_xcolors (f, img, 1);
XColor *p, *end;
const int h = 15000;
const int l = 30000;
@@ -5204,7 +5212,7 @@ x_disable_image (struct frame *f, struct image *img)
p->red = p->green = p->blue = i2;
}
- x_from_xcolors (f, img, colors);
+ image_from_xcolors (f, img, colors);
}
/* Draw a cross over the disabled image, if we must or if we
@@ -5279,7 +5287,8 @@ x_disable_image (struct frame *f, struct image *img)
heuristically. */
static void
-x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how)
+image_build_heuristic_mask (struct frame *f, struct image *img,
+ Lisp_Object how)
{
XImagePtr_or_DC ximg;
#ifdef HAVE_NTGUI
@@ -5294,7 +5303,7 @@ x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how)
unsigned long bg = 0;
if (img->mask)
- x_clear_image_1 (f, img, CLEAR_IMAGE_MASK);
+ image_clear_image_1 (f, img, CLEAR_IMAGE_MASK);
#ifndef HAVE_NTGUI
#ifndef HAVE_NS
@@ -5335,7 +5344,7 @@ x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how)
#ifdef HAVE_NTGUI
0x00ffffff & /* Filter out palette info. */
#endif /* HAVE_NTGUI */
- x_alloc_image_color (f, img, build_string (color_name), 0));
+ image_alloc_image_color (f, img, build_string (color_name), 0));
use_img_background = 0;
}
}
@@ -5378,7 +5387,7 @@ x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how)
SelectObject (ximg, img->mask);
image_background_transparent (img, f, ximg);
- /* Was: x_destroy_x_image ((XImagePtr )mask_img); which seems bogus ++kfs */
+ /* Was: image_destroy_x_image ((XImagePtr )mask_img); which seems bogus ++kfs */
xfree (mask_img);
#endif /* HAVE_NTGUI */
@@ -5436,7 +5445,7 @@ static struct image_type pbm_type =
SYMBOL_INDEX (Qpbm),
pbm_image_p,
pbm_load,
- x_clear_image,
+ image_clear_image,
NULL,
NULL
};
@@ -5547,7 +5556,7 @@ pbm_load (struct frame *f, struct image *img)
if (STRINGP (specified_file))
{
int fd;
- Lisp_Object file = x_find_image_fd (specified_file, &fd);
+ Lisp_Object file = image_find_image_fd (specified_file, &fd);
if (!STRINGP (file))
{
image_error ("Cannot find image file `%s'", specified_file);
@@ -5675,7 +5684,7 @@ pbm_load (struct frame *f, struct image *img)
|| ! x_defined_color (f, SSDATA (fmt[PBM_FOREGROUND].value), &xfg, 0))
{
xfg.pixel = fg;
- x_query_color (f, &xfg);
+ x_query_colors (f, &xfg, 1);
}
fga32 = xcolor_to_argb32 (xfg);
@@ -5684,17 +5693,17 @@ pbm_load (struct frame *f, struct image *img)
|| ! x_defined_color (f, SSDATA (fmt[PBM_BACKGROUND].value), &xbg, 0))
{
xbg.pixel = bg;
- x_query_color (f, &xbg);
+ x_query_colors (f, &xbg, 1);
}
bga32 = xcolor_to_argb32 (xbg);
#else
if (fmt[PBM_FOREGROUND].count
&& STRINGP (fmt[PBM_FOREGROUND].value))
- fg = x_alloc_image_color (f, img, fmt[PBM_FOREGROUND].value, fg);
+ fg = image_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);
+ bg = image_alloc_image_color (f, img, fmt[PBM_BACKGROUND].value, bg);
img->background = bg;
img->background_valid = 1;
}
@@ -5712,9 +5721,9 @@ pbm_load (struct frame *f, struct image *img)
#ifdef USE_CAIRO
cairo_surface_destroy (surface);
#else
- x_destroy_x_image (ximg);
+ image_destroy_x_image (ximg);
#endif
- x_clear_image (f, img);
+ image_clear_image (f, img);
image_error ("Invalid image size in image `%s'",
img->spec);
goto error;
@@ -5758,9 +5767,9 @@ pbm_load (struct frame *f, struct image *img)
#ifdef USE_CAIRO
cairo_surface_destroy (surface);
#else
- x_destroy_x_image (ximg);
+ image_destroy_x_image (ximg);
#endif
- x_clear_image (f, img);
+ image_clear_image (f, img);
image_error ("Invalid image size in image `%s'", img->spec);
goto error;
}
@@ -5792,7 +5801,7 @@ pbm_load (struct frame *f, struct image *img)
#ifdef USE_CAIRO
cairo_surface_destroy (surface);
#else
- x_destroy_x_image (ximg);
+ image_destroy_x_image (ximg);
#endif
image_error ("Invalid pixel value in image `%s'", img->spec);
goto error;
@@ -5904,7 +5913,7 @@ static struct image_type png_type =
SYMBOL_INDEX (Qpng),
png_image_p,
png_load,
- x_clear_image,
+ image_clear_image,
init_png_functions,
NULL
};
@@ -6186,7 +6195,7 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
if (NILP (specified_data))
{
int fd;
- Lisp_Object file = x_find_image_fd (specified_file, &fd);
+ Lisp_Object file = image_find_image_fd (specified_file, &fd);
if (!STRINGP (file))
{
image_error ("Cannot find image file `%s'", specified_file);
@@ -6341,7 +6350,7 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
color set by the image. */
if (STRINGP (specified_bg)
? x_defined_color (f, SSDATA (specified_bg), &color, false)
- : (x_query_frame_background_color (f, &color), true))
+ : (image_query_frame_background_color (f, &color), true))
/* The user specified `:background', use that. */
{
int shift = bit_depth == 16 ? 0 : 8;
@@ -6398,8 +6407,8 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
&& !image_create_x_image_and_pixmap (f, img, width, height, 1,
&mask_img, 1))
{
- x_destroy_x_image (ximg);
- x_clear_image_1 (f, img, CLEAR_IMAGE_PIXMAP);
+ image_destroy_x_image (ximg);
+ image_clear_image_1 (f, img, CLEAR_IMAGE_PIXMAP);
goto error;
}
#endif
@@ -6581,7 +6590,7 @@ static struct image_type jpeg_type =
SYMBOL_INDEX (Qjpeg),
jpeg_image_p,
jpeg_load,
- x_clear_image,
+ image_clear_image,
init_jpeg_functions,
NULL
};
@@ -6945,7 +6954,7 @@ jpeg_load_body (struct frame *f, struct image *img,
if (NILP (specified_data))
{
int fd;
- Lisp_Object file = x_find_image_fd (specified_file, &fd);
+ Lisp_Object file = image_find_image_fd (specified_file, &fd);
if (!STRINGP (file))
{
image_error ("Cannot find image file `%s'", specified_file);
@@ -6997,10 +7006,10 @@ jpeg_load_body (struct frame *f, struct image *img,
/* If we already have an XImage, free that. */
#ifndef USE_CAIRO
- x_destroy_x_image (ximg);
+ image_destroy_x_image (ximg);
#endif
/* Free pixmap and colors. */
- x_clear_image (f, img);
+ image_clear_image (f, img);
return 0;
}
@@ -7215,7 +7224,7 @@ static struct image_type tiff_type =
SYMBOL_INDEX (Qtiff),
tiff_image_p,
tiff_load,
- x_clear_image,
+ image_clear_image,
init_tiff_functions,
NULL
};
@@ -7459,7 +7468,7 @@ tiff_load (struct frame *f, struct image *img)
if (NILP (specified_data))
{
/* Read from a file */
- Lisp_Object file = x_find_image_file (specified_file);
+ Lisp_Object file = image_find_image_file (specified_file);
if (!STRINGP (file))
{
image_error ("Cannot find image file `%s'", specified_file);
@@ -7711,7 +7720,7 @@ static void
gif_clear_image (struct frame *f, struct image *img)
{
img->lisp_data = Qnil;
- x_clear_image (f, img);
+ image_clear_image (f, img);
}
/* Return true if OBJECT is a valid GIF image specification. */
@@ -7895,7 +7904,7 @@ gif_load (struct frame *f, struct image *img)
if (NILP (specified_data))
{
- Lisp_Object file = x_find_image_file (specified_file);
+ Lisp_Object file = image_find_image_file (specified_file);
if (!STRINGP (file))
{
image_error ("Cannot find image file `%s'", specified_file);
@@ -8081,8 +8090,8 @@ gif_load (struct frame *f, struct image *img)
#ifndef USE_CAIRO
unsigned long bgcolor UNINIT;
if (STRINGP (specified_bg))
- bgcolor = x_alloc_image_color (f, img, specified_bg,
- FRAME_BACKGROUND_PIXEL (f));
+ bgcolor = image_alloc_image_color (f, img, specified_bg,
+ FRAME_BACKGROUND_PIXEL (f));
#endif
for (j = 0; j <= idx; ++j)
@@ -8378,7 +8387,7 @@ static void
imagemagick_clear_image (struct frame *f,
struct image *img)
{
- x_clear_image (f, img);
+ image_clear_image (f, img);
}
/* Return true if OBJECT is a valid IMAGEMAGICK image specification. Do
@@ -8789,7 +8798,7 @@ imagemagick_load_image (struct frame *f, struct image *img,
specified_bg = image_spec_value (img->spec, QCbackground, NULL);
if (!STRINGP (specified_bg)
|| !x_defined_color (f, SSDATA (specified_bg), &bgcolor, 0))
- x_query_frame_background_color (f, &bgcolor);
+ image_query_frame_background_color (f, &bgcolor);
bg_wand = NewPixelWand ();
PixelSetRed (bg_wand, (double) bgcolor.red / 65535);
@@ -8983,7 +8992,7 @@ imagemagick_load_image (struct frame *f, struct image *img,
free_color_table ();
#endif
#ifndef USE_CAIRO
- x_destroy_x_image (ximg);
+ image_destroy_x_image (ximg);
#endif
image_error ("Imagemagick pixel iterator creation failed");
goto imagemagick_error;
@@ -9069,7 +9078,7 @@ imagemagick_load (struct frame *f, struct image *img)
file_name = image_spec_value (img->spec, QCfile, NULL);
if (STRINGP (file_name))
{
- Lisp_Object file = x_find_image_file (file_name);
+ Lisp_Object file = image_find_image_file (file_name);
if (!STRINGP (file))
{
image_error ("Cannot find image file `%s'", file_name);
@@ -9200,7 +9209,7 @@ static struct image_type svg_type =
SYMBOL_INDEX (Qsvg),
svg_image_p,
svg_load,
- x_clear_image,
+ image_clear_image,
init_svg_functions,
NULL
};
@@ -9370,7 +9379,7 @@ svg_load (struct frame *f, struct image *img)
if (STRINGP (file_name))
{
int fd;
- Lisp_Object file = x_find_image_fd (file_name, &fd);
+ Lisp_Object file = image_find_image_fd (file_name, &fd);
if (!STRINGP (file))
{
image_error ("Cannot find image file `%s'", file_name);
@@ -9524,7 +9533,7 @@ svg_load_image (struct frame *f, struct image *img, char *contents,
Lisp_Object specified_bg = image_spec_value (img->spec, QCbackground, NULL);
if (!STRINGP (specified_bg)
|| !x_defined_color (f, SSDATA (specified_bg), &background, 0))
- x_query_frame_background_color (f, &background);
+ image_query_frame_background_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
@@ -9667,7 +9676,7 @@ static struct image_type gs_type =
static void
gs_clear_image (struct frame *f, struct image *img)
{
- x_clear_image (f, img);
+ image_clear_image (f, img);
}
@@ -9747,7 +9756,7 @@ gs_load (struct frame *f, struct image *img)
/* Create the pixmap. */
eassert (img->pixmap == NO_PIXMAP);
- if (x_check_image_size (0, img->width, img->height))
+ if (image_check_image_size (0, img->width, img->height))
{
/* Only W32 version did BLOCK_INPUT here. ++kfs */
block_input ();
@@ -9857,7 +9866,7 @@ x_kill_gs_process (Pixmap pixmap, struct frame *f)
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
+ here, we get a BadAccess later in image_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