aboutsummaryrefslogtreecommitdiff
path: root/doc/user/image.skb
blob: f74da22202ace51e0484240b24636d3fddd8f6c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
;;; image.skb  --  Skribe images
;;;
;;; Copyright 2003, 2004  Manuel Serrano
;;;
;;;
;;; This program is free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 2 of the License, or
;;; (at your option) any later version.
;;;
;;; This program is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with this program; if not, write to the Free Software
;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
;;; USA.

;*---------------------------------------------------------------------*/
;*    Image ...  @label image@                                         */
;*---------------------------------------------------------------------*/
(section :title "Image" :file #t

(p [Images are defined by the means of the ,(code "image") function])

(doc-markup 'image
	    `((:file ,[The file where the image is stored on the disk
                       (see ,(ref :mark "skribe-image-path" 
				:text "image path")).
                       The image is converted 
                       (see ,(markup-ref "convert-image")) into a format 
                       supported by the engine. This option is exclusive 
                       with the ,(param :url) option.])
	      (:url [The URL of the file. This option is exclusive with the
                     ,(param :file) option.])
	      (:width [The width of the image. It may be an integer for a pixel
                       size or a floating point number for a percentage.])
	      (:height [The height of the image. It may be an integer for a 
                        pixel size or a floating point number for a 
                        percentage.])
	      (:zoom [A zoom factor.])
	      (#!rest comment [A text describing the image.]))
	    :see-also '(skribe-image-path convert-image))

(example-produce
 (example :legend "The image markup" (prgm :file "src/api16.skb"))
 (disp (include "src/api16.skb")))

;*--- Image format ----------------------------------------------------*/
(subsection :title "Image formats"
   (index "image" :note "conversion")

   (p [
Images are unfortunately ,(emph "unportable"). The various Skribe output 
formats support different image formats. For instance, HTML supports 
,(code "gif") and ,(code "jpeg") while the LaTeX back-end only supports 
,(code "ps"). Skribe tries, only when needed, to automatically 
,(emph "convert") images to a format supported by the target
to be produced. For this, it uses external tools. The default Skribe
translation scheme is:])
(itemize (item [Do not translate an image that needs no conversion.])
	 (item [Uses the ,(code "fig2dev") external tool to translate 
                ,(code "Xfig") images.])
	 (item [Uses the ,(code "convert") external tools to translate all 
                other formats.]))
   
   (p [,(ref :chapter "Engines" :text "Engines") support different image
formats. Each engine may specify a converter to be applied to an image.
The engine custom ,(code "image-format") specifies the list of supported
image formats. This list is composed of a suffix such as ,(code "jpeg") or 
,(code "gif").])
   
   (p [The function ,(code "convert-image") tries to convert an
image according to a list of formats. All the specified formats are 
successively tried. On the first success, the function ,(code "convert-image")
returns the name of the new converted image. On failure, it returns 
,(code "#f").]) 
   (doc-markup 'convert-image 
	       `((file [The image file to be converted. The file is
searched in the ,(ref :mark "skribe-image-path" :text "image path").])
		 (formats [A list of formats into which images are converted to.]))
	       :common-args '()
               :skribe-source? #f
	       :source #f ;;"skribilo/runtime.scm"
               :def '(define-markup (convert-image file formats) ...)
	       :see-also '(skribe-image-path)
	       :idx *function-index*)))