/[emacs]/emacs/lisp/image.el
ViewVC logotype

Diff of /emacs/lisp/image.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.31 by pj, Mon Mar 11 13:32:22 2002 UTC revision 1.31.2.1 by miles, Fri Apr 4 06:20:08 2003 UTC
# Line 46  When the first bytes of an image file ma Line 46  When the first bytes of an image file ma
46  be of image type IMAGE-TYPE if IMAGE-TYPE is a symbol.  If not a symbol,  be of image type IMAGE-TYPE if IMAGE-TYPE is a symbol.  If not a symbol,
47  IMAGE-TYPE must be a pair (PREDICATE . TYPE).  PREDICATE is called  IMAGE-TYPE must be a pair (PREDICATE . TYPE).  PREDICATE is called
48  with one argument, a string containing the image data.  If PREDICATE returns  with one argument, a string containing the image data.  If PREDICATE returns
49  a non-nil value, TYPE is the image's type ")  a non-nil value, TYPE is the image's type.")
50    
51    
52  (defun image-jpeg-p (data)  (defun image-jpeg-p (data)
53    "Value is non-nil if DATA, a string, consists of JFIF image data."    "Value is non-nil if DATA, a string, consists of JFIF image data.
54    We accept the tag Exif because that is the same format."
55    (when (string-match "\\`\xff\xd8" data)    (when (string-match "\\`\xff\xd8" data)
56      (catch 'jfif      (catch 'jfif
57        (let ((len (length data)) (i 2))        (let ((len (length data)) (i 2))
# Line 65  a non-nil value, TYPE is the image's typ Line 66  a non-nil value, TYPE is the image's typ
66                  (code (aref data i)))                  (code (aref data i)))
67              (when (and (>= code #xe0) (<= code #xef))              (when (and (>= code #xe0) (<= code #xef))
68                ;; APP0 LEN1 LEN2 "JFIF\0"                ;; APP0 LEN1 LEN2 "JFIF\0"
69                (throw 'jfif                (throw 'jfif
70                       (string-match "JFIF" (substring data i (+ i nbytes)))))                       (string-match "JFIF\\|Exif" (substring data i (+ i nbytes)))))
71              (setq i (+ i 1 nbytes))))))))              (setq i (+ i 1 nbytes))))))))
72    
73    
# Line 202  means display it in the right marginal a Line 203  means display it in the right marginal a
203    (let ((start (point)))    (let ((start (point)))
204      (insert string)      (insert string)
205      (add-text-properties start (point)      (add-text-properties start (point)
206                           (list 'display image                           `(display ,image rear-nonsticky (display)))))
                                ;; `image' has the right properties to  
                                ;; mark an intangible field.  
                                'intangible image  
                                'rear-nonsticky (list 'display)))))  
207    
208    
209  ;;;###autoload  ;;;###autoload

Legend:
Removed from v.1.31  
changed lines
  Added in v.1.31.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26