1cairodriver(1) GRASS GIS User's Manual cairodriver(1)
2
3
4
6 Cairo display driver for bitmap or vector output using the Cairo graph‐
7 ics library.
8
10 The Cairo driver generates PNG, BMP, PPM, PS, PDF or SVG images by
11 GRASS display commands, using the Cairo graphics library. The image
12 format is selected from the extension of the output file. The Cairo
13 driver is used for GRASS display commands by default if available, oth‐
14 erwise PNG driver is used.
15
17 Environment variables
18 The Cairo driver can be enabled by setting GRASS_RENDER_IMMEDIATE vari‐
19 able, eg.
20 export GRASS_RENDER_IMMEDIATE=cairo
21 Several environment variables affect the operation of the Cairo driver:
22
23 · GRASS_RENDER_WIDTH=xxx
24 the width of the image map (default is 640).
25
26 · GRASS_RENDER_HEIGHT=yyy
27 the height of the image map (default is 480).
28
29 · GRASS_RENDER_BACKGROUNDCOLOR=RRGGBB
30 specifies the background color to use in RGB notation (hex or
31 R:G:B values). Named colors are also supported. Default is
32 FFFFFF (white).
33
34 · GRASS_RENDER_TRANSPARENT=[TRUE|FALSE]
35 sets transparent background on (TRUE) or off (FALSE, default).
36
37 · GRASS_RENDER_ANTIALIAS
38 can be default, none, gray, or subpixel, corresponding to
39 cairo_antialias_t
40
41 · GRASS_RENDER_FILE=filename
42 the name and format of the resulting image file, default is
43 map.png.
44 The image format is determined from the file extension.
45 Supported bitmap formats:
46
47 · .png - Portable Network Graphics (PNG)
48
49 · .bmp - Windows Bitmap (BMP, 32-bpp) (these are not readable
50 by some older viewers)
51
52 · .ppm - Portable Pixmap (PPM + PGM for alpha channel)
53 Supported vector formats:
54
55 · .pdf - Portable Document Format (PDF)
56
57 · .ps - PostScript (PS)
58
59 · .svg - Scalable Vector Graphics (SVG)
60 (Note: Some formats may not be available, depending on your plat‐
61 form and the Cairo library that GRASS was built with.)
62
63 · GRASS_RENDER_FILE_READ
64 if TRUE, the Cairo driver will initialize the image from the
65 contents of GRASS_RENDER_FILE.
66 (Note: This is only supported for bitmap formats)
67
68 · GRASS_RENDER_FILE_MAPPED
69 if TRUE, the Cairo driver will map GRASS_RENDER_FILE as its
70 framebuffer, rather than using memory.
71 (Note: This only works with BMP files.)
72
73 · GRASS_RENDER_CAIRO_SCREEN
74 defines Cairo screen
75
76 · GRASS_RENDER_CAIRO_VISUAL
77 defines Cairo visual
78
80 PNG Example
81 Example: using the driver to generate a PNG file (bash-syntax):
82 export GRASS_RENDER_IMMEDIATE=cairo
83 export GRASS_RENDER_FILE=nc_spm.png
84 export GRASS_RENDER_WIDTH=800
85 export GRASS_RENDER_HEIGHT=800
86 export GRASS_RENDER_FILE_READ=TRUE
87 g.region raster=elevation
88 d.rast map=elevation
89 d.vect map=streams width=1 color=blue fcolor=aqua type=area,line
90 d.vect map=roadsmajor width=2
91
92 PDF Examples
93 Example: using the driver to generate a PDF vector file with a vector
94 map (bash-syntax):
95 export GRASS_RENDER_IMMEDIATE=cairo
96 export GRASS_RENDER_FILE=nc_spm.pdf
97 export GRASS_RENDER_WIDTH=800
98 export GRASS_RENDER_HEIGHT=800
99 g.region vector=roadsmajor
100 # activate vector font
101 d.font Vera
102 d.vect map=roadsmajor layer=1 display=shape attrcolumn=ROAD_NAME lcolor=0:90:255
103
104 Example: using the driver to generate a PDF raster file with a raster
105 map (bash-syntax):
106 export GRASS_RENDER_IMMEDIATE=cairo
107 export GRASS_RENDER_FILE=nc_spm.pdf
108 export GRASS_RENDER_WIDTH=800
109 export GRASS_RENDER_HEIGHT=800
110 g.region raster=elevation
111 d.rast map=elevation
112
113 SVG Example
114 Example: using the driver to generate a SVG vector file with a vector
115 map (bash-syntax):
116 export GRASS_RENDER_IMMEDIATE=cairo
117 export GRASS_RENDER_FILE=vectormap.svg
118 g.region vector=roadsmajor
119 d.vect map=roadsmajor -c
120
122 The driver is still in development. Enable it by specifying
123 --with-cairo when configuring GRASS. This requires a reasonably recent
124 version of the Cairo libraries and a working pkg-config.
125
126 Antialiasing is enabled by default for bitmap formats. There is cur‐
127 rently no way of disabling this.
128
129 The resolution of the output images is defined by current region
130 extents. Use g.region -p to get the number of rows and cols and use the
131 environment variables to set the image size. If you would like a larger
132 image, multiply both rows and cols by the same whole number to preserve
133 the aspect ratio.
134
135 Cairo supports true vector format output whenever possible. However, if
136 the selected format doesn’t support a necessary feature, Cairo may fall
137 back on rendering a bitmap representation of the image wrapped in the
138 selected vector format.
139
141 PNG driver, PS driver, HTML driver, variables
142
143 d.rast, d.vect, d.mon, d.erase, d.redraw
144
146 Lars Ahlzen <lars (at) ahlzen.com>
147 and the GRASS Development Team.
148
149 Main index | Topics index | Keywords index | Graphical index | Full
150 index
151
152 © 2003-2020 GRASS Development Team, GRASS GIS 7.8.5 Reference Manual
153
154
155
156GRASS 7.8.5 cairodriver(1)