Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
42677916
Commit
42677916
authored
Jun 26, 2000
by
Gerd Moellmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(Fimage_size): New function.
(syms_of_xfns): Defsubr it.
parent
9ef3882f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
1 deletion
+34
-1
src/xfns.c
src/xfns.c
+34
-1
No files found.
src/xfns.c
View file @
42677916
/* Functions for the X window system.
Copyright (C) 1989, 92, 93, 94, 95, 96, 1997, 1998, 1999
Copyright (C) 1989, 92, 93, 94, 95, 96, 1997, 1998, 1999
, 2000
Free Software Foundation.
This file is part of GNU Emacs.
...
...
@@ -5214,6 +5214,38 @@ image_spec_value (spec, key, found)
}
DEFUN ("image-size", Fimage_size, Simage_size, 1, 3, 0,
"Return the size of image SPEC as pair (WIDTH . HEIGHT).\n\
PIXELS non-nil means return the size in pixels, otherwise return the\n\
size in canonical character units.\n\
FRAME is the frame on which the image will be displayed. FRAME nil\n\
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->margin;
int height = img->height + 2 * img->margin;
if (NILP (pixels))
size = Fcons (make_float ((double) width / CANON_X_UNIT (f)),
make_float ((double) height / CANON_Y_UNIT (f)));
else
size = Fcons (make_number (width), make_number (height));
}
else
error ("Invalid image specification");
return size;
}
/***********************************************************************
...
...
@@ -10457,6 +10489,7 @@ meaning don't clear the cache.");
#endif
defsubr (&Sclear_image_cache);
defsubr (&Simage_size);
busy_cursor_atimer = NULL;
busy_cursor_shown_p = 0;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment