summaryrefslogtreecommitdiff
path: root/doc/user/image.skb
blob: f21388c9bc2c807dd769d9636697f49b058b4142 (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
91
92
93
94
95
96
97
98
99
100
101
102
;;; image.skb  --  Images.
;;; -*- coding: iso-8859-1 -*-
;;;
;;; Copyright 2008  Ludovic Courtès <ludo@gnu.org>
;;; 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 "Images" :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 "*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 '(*image-path* convert-image))

(example-produce
 (example :legend "The image markup" (prgm :file "src/api16.skb"))
 (disp (include "src/api16.skb")))
   
(mark "*image-path*")
(p [Files passed as a ,(tt [:file]) argument to ,(markup-ref "image")
are searched in the current ,(emph [image path]), which is defined by
the ,(tt [*image-path*]) ,(srfi-ref 39) parameter.  This parameter
contains a list of directories and its value can be obtained using
,(code [(*image-path*)]).  Its value can be altered using the ,(tt [-P])
command-line option of the ,(tt [skribilo]) compiler (see ,(numref :text
[Chapter] :ident "compiler") for details).])


;*--- 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 "*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 '(*image-path*)
	       :idx *function-index*)))