aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Verona2010-07-10 22:35:42 +0200
committerJoakim Verona2010-07-10 22:35:42 +0200
commitfe72c5b4651334677326104ec138e7cdd50f2ffe (patch)
treead0ce60cec882f6d25b0edf5d3249e3fa508757c
parent788489aa741e8cefdccf881459eac789c7041e92 (diff)
downloademacs-fe72c5b4651334677326104ec138e7cdd50f2ffe.tar.gz
emacs-fe72c5b4651334677326104ec138e7cdd50f2ffe.zip
some more docs and polish
-rw-r--r--README.imagemagick89
-rw-r--r--lisp/image-mode.el34
2 files changed, 71 insertions, 52 deletions
diff --git a/README.imagemagick b/README.imagemagick
index d297c76675a..600fb393632 100644
--- a/README.imagemagick
+++ b/README.imagemagick
@@ -1,3 +1,5 @@
1* README for the ImageMagick Emacs branch
2
1This is the imagemagick branch of Emacs. Imagemagick can now be used 3This is the imagemagick branch of Emacs. Imagemagick can now be used
2to load many new image formats, and also do useful transforms like 4to load many new image formats, and also do useful transforms like
3scaling and rotation. 5scaling and rotation.
@@ -13,14 +15,15 @@ autoconf
13./configure --with-imagemagick 15./configure --with-imagemagick
14 16
15 17
16* TODO 18* TODO image-type-header-regexps priorities the jpeg loader over the
17
18- image-type-header-regexps priorities the jpeg loader over the
19imagemagick one. This is not wrong, but how should a user go about 19imagemagick one. This is not wrong, but how should a user go about
20prefering the imagemagick loader? The user might like zooming etc in 20prefering the imagemagick loader? The user might like zooming etc in
21jpegs. 21jpegs.
22
23try (setq image-type-header-regexps nil) for a quick hack to prefer
24imagemagick over the jpg loader.
22 25
23#B _ For some reason its unbearably slow to look at a page in a large 26* TODO For some reason its unbearably slow to look at a page in a large
24 image bundle using the :index feature. The imagemagick "display" 27 image bundle using the :index feature. The imagemagick "display"
25 command is also a bit slow, but nowhere near as slow as the emacs 28 command is also a bit slow, but nowhere near as slow as the emacs
26 code. It seems imagemagick tries to unpack every page when loading 29 code. It seems imagemagick tries to unpack every page when loading
@@ -31,60 +34,72 @@ jpegs.
31 It is now way faster to use the :index feature, but its still not 34 It is now way faster to use the :index feature, but its still not
32 very fast. 35 very fast.
33 36
34#B X optimize number of pages calculation for bundles as suggested by 37** DONE optimize number of pages calculation for bundles as suggested by
35 imagemagick forum: "set the density to something low like 2 and use 38 imagemagick forum: "set the density to something low like 2 and use
36 MagickPingImage()" 39 MagickPingImage()"
37 40
38 41** TODO try to cache the num pages calculation. it can take a while to
39#B _ zooming the image like what is done for fonts in face-remap.el would 42 calculate the number of pages, and if you need to do it for each
40 be a useful and demo friendly addition. Some work has been done on 43 page view, page-flipping becomes uselessly slow.
41 image-mode.el to acihieve this.
42 44
43#B _ look for optimizations for handling images with low depth 45* TODO integrate with image-dired
44 46
47* TODO integrate with docview.
45 48
46* TODO 49* TODO integrate with image-mode
50Some work has been done, M-x image-transform-fit-to-height will fit
51the image to the height of the Emacs window for instance.
47 52
48#B _ complete documentation drafts below 53* TODO look for optimizations for handling images with low depth
54Currently the code seems to default to 24 bit RGB which is costly for
55images with lower bit depth.
49 56
50#B X fix inconsistencys with spelling of imagemagick in the src 57* TODO complete documentation drafts below
51#B X report number of images in image bundle types somehow 58
59* DONE fix inconsistencys with spelling of imagemagick in the src
60* DONE report number of images in image bundle types somehow
52Works like for "gif" support. Thanks to Juri Linkov. 61Works like for "gif" support. Thanks to Juri Linkov.
53#B X probably add pdf to inhibited types 62* DONE probably add pdf to inhibited types
54#B X inhibit types is defconst should probably be defcustom 63* DONE inhibit types is defconst should probably be defcustom
55#B _ decide what to do with some uncommitted imagemagick support 64* TODO decide what to do with some uncommitted imagemagick support
56 functions for image size etc. 65 functions for image size etc.
57#B _ Test with more systems 66* TODO Test with more systems
58Tested on Fedora 12 so far, and the libmagick that ships with it. 67Tested on Fedora 12 so far, and the libmagick that ships with it.
59Ubuntu 8.04 was also tested, but it seems it ships a broken ImageMagick. 68Ubuntu 8.04 was also tested, but it seems it ships a broken
60#B X Also need some way to handle render methods that only work on newer ImageMagicks 69ImageMagick.
70
71I also tried using an imagemagick compiled from their SVN, in
72parallell with the one packaged by Fedora, it worked well.
73
74* DONE Also need some way to handle render methods that only work on newer ImageMagicks
61Is handled by configure now 75Is handled by configure now
62 76
63* Some nits from Stefan Monnier 77* Some nits from Stefan Monnier
64I just took a quick look at the code and I see the following nits to fix: 78I just took a quick look at the code and I see the following nits to fix:
65#B _ obviously a merge will have to come with a good ChangeLog. 79
66#B X also the merge will need to come with documentation. Maybe not in the 80** TODO obviously a merge will have to come with a good ChangeLog.
81** DONE also the merge will need to come with documentation. Maybe not in the
67 Texinfo form yet, but at least in the etc/NEWS with enough info that 82 Texinfo form yet, but at least in the etc/NEWS with enough info that
68 describes the `scale' and other such arguments that someone can start 83 describes the `scale' and other such arguments that someone can start
69 using them. 84 using them.
70#B X the README talks about naming inconsistencies, I think these should be 85** DONE the README talks about naming inconsistencies, I think these should be
71 fixed before a first commit (should be straightforward). 86 fixed before a first commit (should be straightforward).
72 87
73#B X the "let" in image.el should not be followed by a line break and the while 88** DONE the "let" in image.el should not be followed by a line break and the while
74 should be replaced by a dolist. 89 should be replaced by a dolist.
75 90
76#B X the prototype of imagemagick_load_image has some odd indentation in ([[2010.06.14]]) 91** DONE the prototype of imagemagick_load_image has some odd indentation in ([[2010.06.14]])
77 its args, not sure what happened. 92 its args, not sure what happened.
78#B X a few lines in the C code break the 80columns limit. 93** DONE a few lines in the C code break the 80columns limit.
79#B X please use ANSI style function declarations rather than K&R for new code. ([[2010.06.14]]) 94** DONE please use ANSI style function declarations rather than K&R for new code. ([[2010.06.14]])
80#B X you can get rid of the prototypes by reordering the code. ([[2010.06.14]]) 95** DONE you can get rid of the prototypes by reordering the code. ([[2010.06.14]])
81#B X the docstrings in DEFUN should not be indented (they'll display ([[2010.06.14]]) 96** DONE the docstrings in DEFUN should not be indented (they'll display ([[2010.06.14]])
82 weirdly otherwise in C-h f). 97 weirdly otherwise in C-h f).
83#B X Some "{" are at the end of a for/if rather than on their own line. ([[2010.06.14]]) 98** DONE Some "{" are at the end of a for/if rather than on their own line. ([[2010.06.14]])
84#B X why use "*( imtypes + i)" rather than "imtypes[i]"? ([[2010.06.14]]) 99** DONE why use "*( imtypes + i)" rather than "imtypes[i]"? ([[2010.06.14]])
85#B X some "," lack a space after them. ([[2010.06.14]]) 100** DONE some "," lack a space after them. ([[2010.06.14]])
86#B X several "=" and "==" lack spaces around them. ([[2010.06.14]]) 101** DONE several "=" and "==" lack spaces around them. ([[2010.06.14]])
87 102
88 103
89* NEWS entry 104* NEWS entry
90** ImageMagick support 105** ImageMagick support
@@ -147,4 +162,4 @@ of images in an image bundle. This is simmilar to how GIF files work.
147 * config.in, Makefile.in, configure.in 162 * config.in, Makefile.in, configure.in
148 163
149* Manual entry 164* Manual entry
150nothing yet, but the NEWS entry could be adapted. \ No newline at end of file 165nothing yet, but the NEWS entry could be adapted.
diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index 78ec4772d16..9bd5a76d5da 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -543,8 +543,8 @@ the image file and `image-mode' showing the image as an image."
543; (define-key map [(control ?+)] 'image-scale-in) 543; (define-key map [(control ?+)] 'image-scale-in)
544; (define-key map [(control ?-)] 'image-scale-out) 544; (define-key map [(control ?-)] 'image-scale-out)
545; (define-key map [(control ?=)] 'image-scale-none) 545; (define-key map [(control ?=)] 'image-scale-none)
546;; (define-key map "c f h" 'image-scale-fit-height) 546;; (define-key map "c f h" 'image-scale-fit-height)
547;; (define-key map "c ]" 'image-rotate-right) 547;; (define-key map "c ]" 'image-rotate-right)
548 map) 548 map)
549 "Minor mode keymap for transforming the view of images Image mode.") 549 "Minor mode keymap for transforming the view of images Image mode.")
550 550
@@ -553,23 +553,16 @@ the image file and `image-mode' showing the image as an image."
553 nil "image-transform" 553 nil "image-transform"
554 image-transform-minor-mode-map) 554 image-transform-minor-mode-map)
555 555
556;;these are supposed to be buffer local 556(defvar image-transform-resize nil
557;(defvar image-transform-height 100);;nil should mean 100% 557 "The image resize operation. See the command
558;;the interface could rather be: 558 `image-transform-set-scale' for more information." )
559(defvar image-transform-resize
560 nil
561 "values: fit-height number=scale nil=scale100% TODO fit-width fit-page"
562 )
563 559
564;;TODO 0 90 180 270 degrees are the only reasonable angles here
565;;otherwise combining with rescaling will get very awkward
566(defvar image-transform-rotation 0.0) 560(defvar image-transform-rotation 0.0)
567 561
568;;then it would be nice with a bunch of globals like:
569;; image-transform-always-resize values: 'fit-height nil=100% number=scale TODO 'fit-width 'fit-page
570;; image-transform-always-rotate value: angle
571 562
572(defun image-transform-properties (display) 563(defun image-transform-properties (display)
564 "Calculate the display properties for transformations; scaling
565and rotation. "
573 (let* 566 (let*
574 ((size (image-size display t)) 567 ((size (image-size display t))
575 (height 568 (height
@@ -588,28 +581,39 @@ the image file and `image-mode' showing the image as an image."
588 ,@(if width (list :width width)) 581 ,@(if width (list :width width))
589 ,@(if (not (equal 0.0 image-transform-rotation)) 582 ,@(if (not (equal 0.0 image-transform-rotation))
590 (list :rotation image-transform-rotation)) 583 (list :rotation image-transform-rotation))
584 ;;TODO fit-to-* should consider the rotation angle
591 ))) 585 )))
592 586
593(defun image-transform-set-scale (scale) 587(defun image-transform-set-scale (scale)
588 "SCALE sets the scaling for images. "
594 (interactive "nscale:") 589 (interactive "nscale:")
595 (image-transform-set-resize (float scale))) 590 (image-transform-set-resize (float scale)))
596 591
597(defun image-transform-fit-to-height () 592(defun image-transform-fit-to-height ()
593 "Fit image height to window height. "
598 (interactive) 594 (interactive)
599 (image-transform-set-resize 'fit-height)) 595 (image-transform-set-resize 'fit-height))
600 596
601(defun image-transform-fit-to-width () 597(defun image-transform-fit-to-width ()
598 "Fit image width to window width. "
602 (interactive) 599 (interactive)
603 (image-transform-set-resize 'fit-width)) 600 (image-transform-set-resize 'fit-width))
604 601
605(defun image-transform-set-resize (resize) 602(defun image-transform-set-resize (resize)
603 "Set the resize mode for images. The RESIZE value can be the
604symbol fit-height which fits the image to the window height. The
605symbol fit-width fits the image to the window width. A number
606indicates a scaling factor. nil indicates scale to 100%. "
606 (setq image-transform-resize resize) 607 (setq image-transform-resize resize)
607 (if (eq 'image-mode major-mode) (image-toggle-display-image))) 608 (if (eq 'image-mode major-mode) (image-toggle-display-image)))
608 609
609(defun image-transform-set-rotation (rotation) 610(defun image-transform-set-rotation (rotation)
611 "Set the image ROTATION angle. "
610 (interactive "nrotation:") 612 (interactive "nrotation:")
613 ;;TODO 0 90 180 270 degrees are the only reasonable angles here
614 ;;otherwise combining with rescaling will get very awkward
611 (setq image-transform-rotation (float rotation)) 615 (setq image-transform-rotation (float rotation))
612 (image-toggle-display-image)) 616 (if (eq major-mode 'image-mode) (image-toggle-display-image)))
613 617
614(provide 'image-mode) 618(provide 'image-mode)
615 619