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
e7968373
Commit
e7968373
authored
Apr 21, 2006
by
Kim F. Storm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(image-type): New defun split out of create-image.
(create-image): Use it.
parent
15855f8f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
16 deletions
+28
-16
lisp/image.el
lisp/image.el
+28
-16
No files found.
lisp/image.el
View file @
e7968373
...
...
@@ -280,27 +280,14 @@ be determined."
;;;###autoload
(
defun
image-type-available-p
(
type
)
"Return non-nil if image type TYPE is available.
Image types are symbols like `xbm' or `jpeg'."
(
and
(
fboundp
'init-image-library
)
(
init-image-library
type
image-library-alist
)))
;;;###autoload
(
defun
create-image
(
file-or-data
&optional
type
data-p
&rest
props
)
"Create an image.
(
defun
image-type
(
file-or-data
&optional
type
data-p
)
"Determine and return image type.
FILE-OR-DATA is an image file name or image data.
Optional TYPE is a symbol describing the image type. If TYPE is omitted
or nil, try to determine the image type from its first few bytes
of image data. If that doesn't work, and FILE-OR-DATA is a file name,
use its file extension as image type.
Optional DATA-P non-nil means FILE-OR-DATA is a string containing image data.
Optional PROPS are additional image attributes to assign to the image,
like, e.g. `:mask MASK'.
Value is the image created, or nil if images of type TYPE are not supported.
Images should not be larger than specified by `max-image-size'."
Optional DATA-P non-nil means FILE-OR-DATA is a string containing image data."
(
when
(
and
(
not
data-p
)
(
not
(
stringp
file-or-data
)))
(
error
"Invalid image file name `%s'"
file-or-data
))
(
cond
((
null
data-p
)
...
...
@@ -319,6 +306,31 @@ Images should not be larger than specified by `max-image-size'."
(
error
"Cannot determine image type"
))
(
unless
(
symbolp
type
)
(
error
"Invalid image type `%s'"
type
))
type
)
;;;###autoload
(
defun
image-type-available-p
(
type
)
"Return non-nil if image type TYPE is available.
Image types are symbols like `xbm' or `jpeg'."
(
and
(
fboundp
'init-image-library
)
(
init-image-library
type
image-library-alist
)))
;;;###autoload
(
defun
create-image
(
file-or-data
&optional
type
data-p
&rest
props
)
"Create an image.
FILE-OR-DATA is an image file name or image data.
Optional TYPE is a symbol describing the image type. If TYPE is omitted
or nil, try to determine the image type from its first few bytes
of image data. If that doesn't work, and FILE-OR-DATA is a file name,
use its file extension as image type.
Optional DATA-P non-nil means FILE-OR-DATA is a string containing image data.
Optional PROPS are additional image attributes to assign to the image,
like, e.g. `:mask MASK'.
Value is the image created, or nil if images of type TYPE are not supported.
Images should not be larger than specified by `max-image-size'."
(
setq
type
(
image-type
file-or-data
type
data-p
))
(
when
(
image-type-available-p
type
)
(
append
(
list
'image
:type
type
(
if
data-p
:data
:file
)
file-or-data
)
props
)))
...
...
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