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 int x_build_heuristic_mask P_ ((struct frame *, Lisp_Object,
- struct image *, Lisp_Object));
+static int x_build_heuristic_mask P_ ((struct frame *, struct image *,
+ Lisp_Object));
/* Define a new image type from TYPE. This adds a copy of TYPE to
/* Should we built a mask heuristically? */
heuristic_mask = image_spec_value (spec, QCheuristic_mask, NULL);
if (img->pixmap && !img->mask && !NILP (heuristic_mask))
- {
- file = image_spec_value (spec, QCfile, NULL);
- x_build_heuristic_mask (f, file, img, heuristic_mask);
- }
+ x_build_heuristic_mask (f, img, heuristic_mask);
}
}
X support code
***********************************************************************/
-static int x_create_x_image_and_pixmap P_ ((struct frame *, Lisp_Object,
- int, int, int, XImage **,
- Pixmap *));
+static int x_create_x_image_and_pixmap P_ ((struct frame *, int, int, int,
+ XImage **, Pixmap *));
static void x_destroy_x_image P_ ((XImage *));
static void x_put_x_image P_ ((struct frame *, XImage *, Pixmap, int, int));
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. FILE is the name of an image file being processed, for
- error messages. Value is non-zero if successful. */
+ occurs. Value is non-zero if successful. */
static int
-x_create_x_image_and_pixmap (f, file, width, height, depth, ximg, pixmap)
+x_create_x_image_and_pixmap (f, width, height, depth, ximg, pixmap)
struct frame *f;
- Lisp_Object file;
int width, height, depth;
XImage **ximg;
Pixmap *pixmap;
depth > 16 ? 32 : depth > 8 ? 16 : 8, 0);
if (*ximg == NULL)
{
- image_error ("Unable to allocate X image for %s", file, Qnil);
+ image_error ("Unable to allocate X image", Qnil, Qnil);
return 0;
}
{
x_destroy_x_image (*ximg);
*ximg = NULL;
- image_error ("Unable to create pixmap for `%s'", file, Qnil);
+ image_error ("Unable to create X pixmap", Qnil, Qnil);
return 0;
}
file = x_find_image_file (specified_file);
if (!STRINGP (file))
{
- image_error ("Cannot find image file %s", specified_file, Qnil);
+ image_error ("Cannot find image file `%s'", specified_file, Qnil);
UNGCPRO;
return 0;
}
UNBLOCK_INPUT;
}
else
- image_error ("Error loading XBM image %s", img->spec, Qnil);
+ image_error ("Error loading XBM image `%s'", img->spec, Qnil);
UNGCPRO;
return success_p;
success_p = 1;
else
{
- image_error ("Unable to create pixmap for XBM image", Qnil, Qnil);
+ image_error ("Unable to create pixmap for XBM image `%s'",
+ img->spec, Qnil);
x_clear_image (f, img);
}
Lisp_Object file = x_find_image_file (specified_file);
if (!STRINGP (file))
{
- image_error ("Cannot find image file %s", specified_file, Qnil);
+ image_error ("Cannot find image file `%s'", specified_file, Qnil);
UNBLOCK_INPUT;
return 0;
}
out = (long *) alloca (img->width * sizeof (long));
/* Create an X image for output. */
- rc = x_create_x_image_and_pixmap (f, Qnil, img->width, img->height, 0,
+ rc = x_create_x_image_and_pixmap (f, img->width, img->height, 0,
&oimg, &pixmap);
/* Fill first two rows. */
heuristically. Value is non-zero if successful. */
static int
-x_build_heuristic_mask (f, file, img, how)
+x_build_heuristic_mask (f, img, how)
struct frame *f;
- Lisp_Object file;
struct image *img;
Lisp_Object how;
{
BLOCK_INPUT;
/* Create an image and pixmap serving as mask. */
- rc = x_create_x_image_and_pixmap (f, file, img->width, img->height, 1,
+ rc = x_create_x_image_and_pixmap (f, img->width, img->height, 1,
&mask_img, &img->mask);
if (!rc)
{
/* Check magic number. */
if (end - p < 2 || *p++ != 'P')
{
- image_error ("Not a PBM image: %s", file, Qnil);
+ image_error ("Not a PBM image: `%s'", img->spec, Qnil);
error:
xfree (contents);
UNGCPRO;
break;
default:
- image_error ("Not a PBM image: %s", file, Qnil);
+ image_error ("Not a PBM image: `%s'", img->spec, Qnil);
goto error;
}
goto error;
BLOCK_INPUT;
- if (!x_create_x_image_and_pixmap (f, file, width, height, 0,
+ if (!x_create_x_image_and_pixmap (f, width, height, 0,
&ximg, &img->pixmap))
{
UNBLOCK_INPUT;
ximg->data = NULL;
XDestroyImage (ximg);
UNBLOCK_INPUT;
- image_error ("Invalid pixel value in file `%s'",
- file, Qnil);
+ image_error ("Invalid pixel value in image `%s'",
+ img->spec, Qnil);
goto error;
}
file = x_find_image_file (specified_file);
if (!STRINGP (file))
{
- image_error ("Cannot find image file %s", specified_file, Qnil);
+ image_error ("Cannot find image file `%s'", specified_file, Qnil);
UNGCPRO;
return 0;
}
fp = fopen (XSTRING (file)->data, "rb");
if (!fp)
{
- image_error ("Cannot open image file %s", file, Qnil);
+ image_error ("Cannot open image file `%s'", file, Qnil);
UNGCPRO;
fclose (fp);
return 0;
if (fread (sig, 1, sizeof sig, fp) != sizeof sig
|| !png_check_sig (sig, sizeof sig))
{
- image_error ("Not a PNG file: %s", file, Qnil);
+ image_error ("Not a PNG file: `%s'", file, Qnil);
UNGCPRO;
fclose (fp);
return 0;
if (tbr.len < sizeof sig
|| !png_check_sig (tbr.bytes, sizeof sig))
{
- image_error ("Not a PNG file: %s", file, Qnil);
+ image_error ("Not a PNG image: `%s'", img->spec, Qnil);
UNGCPRO;
return 0;
}
BLOCK_INPUT;
/* Create the X image and pixmap. */
- if (!x_create_x_image_and_pixmap (f, file, width, height, 0, &ximg,
+ if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg,
&img->pixmap))
{
UNBLOCK_INPUT;
contains an alpha channel. */
if (channels == 4
&& !transparent_p
- && !x_create_x_image_and_pixmap (f, file, width, height, 1,
+ && !x_create_x_image_and_pixmap (f, width, height, 1,
&mask_img, &img->mask))
{
x_destroy_x_image (ximg);
file = Qnil;
GCPRO1 (file);
- /* Reading from :data takes precedence. */
if (NILP (specified_data))
{
file = x_find_image_file (specified_file);
if (!STRINGP (file))
{
- image_error ("Cannot find image file %s", specified_file, Qnil);
+ image_error ("Cannot find image file `%s'", specified_file, Qnil);
UNGCPRO;
return 0;
}
/* 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 file `%s': %s", file,
+ image_error ("Error reading JPEG image `%s': %s", img->spec,
build_string (buffer));
}
BLOCK_INPUT;
/* Create X image and pixmap. */
- if (!x_create_x_image_and_pixmap (f, file, width, height, 0, &ximg,
- &img->pixmap))
+ if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
{
UNBLOCK_INPUT;
longjmp (mgr.setjmp_buffer, 2);
file = x_find_image_file (specified_file);
if (!STRINGP (file))
{
- image_error ("Cannot find image file %s", file, Qnil);
+ image_error ("Cannot find image file `%s'", file, Qnil);
UNGCPRO;
return 0;
}
if (!tiff)
{
- image_error ("Cannot open memory source `%s'. ",
- specified_data, Qnil);
+ image_error ("Cannot open memory source for `%s'", img->spec, Qnil);
UNGCPRO;
return 0;
}
TIFFClose (tiff);
if (!rc)
{
- image_error ("Error reading `%s'", file, Qnil);
+ image_error ("Error reading TIFF image `%s'", img->spec, Qnil);
xfree (buf);
UNGCPRO;
return 0;
BLOCK_INPUT;
/* Create the X image and pixmap. */
- if (!x_create_x_image_and_pixmap (f, file, width, height, 0, &ximg,
- &img->pixmap))
+ if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
{
UNBLOCK_INPUT;
xfree (buf);
file = x_find_image_file (specified_file);
if (!STRINGP (file))
{
- image_error ("Cannot find image file %s", specified_file, Qnil);
+ image_error ("Cannot find image file `%s'", specified_file, Qnil);
UNGCPRO;
return 0;
}
gif = DGifOpen(&memsrc, gif_read_from_memory);
if (!gif)
{
- image_error ("Cannot open memory source `%s'",specified_data, Qnil);
+ image_error ("Cannot open memory source `%s'", img->spec, Qnil);
UNGCPRO;
return 0;
}
rc = DGifSlurp (gif);
if (rc == GIF_ERROR)
{
- image_error ("Error reading `%s'", file, Qnil);
+ image_error ("Error reading `%s'", img->spec, Qnil);
DGifCloseFile (gif);
UNGCPRO;
return 0;
ino = INTEGERP (image) ? XFASTINT (image) : 0;
if (ino >= gif->ImageCount)
{
- image_error ("Invalid image number `%s'", image, Qnil);
+ image_error ("Invalid image number `%s' in image `%s'",
+ image, img->spec);
DGifCloseFile (gif);
UNGCPRO;
return 0;
BLOCK_INPUT;
/* Create the X image and pixmap. */
- if (!x_create_x_image_and_pixmap (f, file, width, height, 0, &ximg,
- &img->pixmap))
+ if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
{
UNBLOCK_INPUT;
DGifCloseFile (gif);
if (!img->pixmap)
{
- image_error ("Unable to create pixmap for `%s'",
- image_spec_value (img->spec, QCfile, NULL), Qnil);
+ image_error ("Unable to create pixmap for `%s'", img->spec, Qnil);
return 0;
}
}
else
image_error ("Cannot get X image of `%s'; colors will not be freed",
- image_spec_value (img->spec, QCfile, NULL), Qnil);
+ img->spec, Qnil);
UNBLOCK_INPUT;
}