cairodriver.html 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  4. <TITLE>Cairo driver</TITLE>
  5. <META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
  6. <link rel="stylesheet" href="grassdocs.css" type="text/css">
  7. </HEAD>
  8. <BODY bgColor=white>
  9. <img src="grass_logo.png" alt="GRASS logo"><hr align=center size=6 noshade>
  10. <H2>NAME</H2>
  11. <EM><B>Cairo driver</B></EM> - driver for bitmap or vector output using
  12. the Cairo graphics library.
  13. <BR>
  14. <EM>(drivers)</EM>
  15. <H2>DESCRIPTION</H2>
  16. The Cairo driver generates PNG, BMP, PPM, PS, PDF or SVG images from GRASS
  17. display commands, using the
  18. <A HREF="http://www.cairographics.org/">Cairo graphics library</A>.
  19. The image format is selected from the extension of the output file.
  20. <P>
  21. It is started as 'pseudo' monitor (output to an image file) and when
  22. stopped, all output from previously used display commands are written to
  23. the output file.
  24. <H2>USAGE</H2>
  25. <H3>Environment variables</H3>
  26. Several environment variables affect the operation of the Cairo driver:
  27. <UL>
  28. <LI><B>GRASS_RENDER_IMMEDIATE=[FALSE|TRUE|PNG|PS|HTML|cairo]</B><BR>
  29. tells the raster library which driver to use. If
  30. <tt>TRUE</tt>, the cairo driver is used if it is enabled, otherwise the PNG driver is used.
  31. <LI><B>GRASS_WIDTH=xxx</B><BR>
  32. the width of the image.
  33. </LI>
  34. <LI><B>GRASS_HEIGHT=yyy</B><BR>
  35. the height of the image.
  36. </LI>
  37. <LI><B>GRASS_PNGFILE=filename</B><BR>
  38. the name and format of the resulting image file, default is
  39. <tt>map.png</tt>.<BR>
  40. The image format is determined from the file extension.<BR>
  41. Supported bitmap formats:
  42. <UL>
  43. <LI><B>.png</B> - Portable Network Graphics (PNG)</LI>
  44. <LI><B>.bmp</B> - Windows Bitmap (BMP, 32-bpp)
  45. (these are not readable by some older viewers)</LI>
  46. <LI><B>.ppm</B> - Portable Pixmap (PPM + PGM for alpha channel)</LI>
  47. </UL>
  48. Supported vector formats:
  49. <UL>
  50. <LI><B>.pdf</B> - Portable Document Format (PDF)</LI>
  51. <LI><B>.ps</B> - PostScript (PS)</LI>
  52. <LI><B>.svg</B> - Scalable Vector Graphics (SVG)</LI>
  53. </UL>
  54. (Note: Some formats may not be available, depending on your platform and
  55. the Cairo library that GRASS was built with.)
  56. </LI>
  57. <LI><B>GRASS_BACKGROUNDCOLOR=RRGGBB</B><BR>
  58. specifies the background color to use in RGB
  59. notation (hex values). Default is <b>FFFFFF</b> (white).
  60. </LI>
  61. <LI><B>GRASS_TRANSPARENT=[TRUE|FALSE]</B><BR>
  62. sets transparent background on (TRUE) or off (FALSE, default).
  63. </LI>
  64. <LI><B>GRASS_PNG_READ</B><BR>
  65. if <tt>TRUE</tt>, the Cairo driver will initialize the image from
  66. the contents of GRASS_PNGFILE.<BR>
  67. (Note: This is only supported for bitmap formats)
  68. </LI>
  69. <LI><B>GRASS_PNG_MAPPED</B><BR>
  70. if <tt>TRUE</tt>, the Cairo driver will map GRASS_PNGFILE as its framebuffer,
  71. rather than using memory. This only works with BMP files.
  72. </LI>
  73. <LI><B>GRASS_ANTIALIAS</B><BR> can be <em>default</em>,
  74. <em>none</em>, <em>gray</em>, or <em>subpixel</em>, corresponding to
  75. <a href="http://www.cairographics.org/manual/cairo-cairo-t.html#cairo-antialias-t">cairo_antialias_t</a>
  76. </LI>
  77. <LI><B>GRASS_LINE_WIDTH</B><BR>
  78. the default line width.
  79. </LI>
  80. <LI><B>GRASS_TEXT_SIZE</B><BR>
  81. the default text size.
  82. </LI>
  83. <LI><B>GRASS_FRAME</B><BR>
  84. contains 4 coordinates, <em>top,bottom,left,right</em>, defining the initial frame.
  85. </LI>
  86. </UL>
  87. <H3>Examples</H3>
  88. Example using the driver to generate a PNG file (bash-syntax):
  89. <div class="code"><PRE>
  90. export GRASS_PNGFILE=spearfish.png
  91. export GRASS_WIDTH=800
  92. export GRASS_HEIGHT=800
  93. export GRASS_RENDER_IMMEDIATE=CAIRO
  94. d.rast map=elevation.10m
  95. d.vect map=streams width=1 color=blue fcolor=aqua type=area,line
  96. d.vect map=roads width=2
  97. </PRE></div>
  98. Example using the driver to generate a PDF file (bash-syntax):
  99. <div class="code"><PRE>
  100. export GRASS_PNGFILE=spearfish.pdf
  101. export GRASS_WIDTH=800
  102. export GRASS_HEIGHT=800
  103. export GRASS_RENDER_IMMEDIATE=CAIRO
  104. d.rast map=elevation.10m
  105. d.vect map=streams width=1 color=blue fcolor=aqua type=area,line
  106. d.vect map=roads width=2
  107. </PRE></div>
  108. <H2>NOTES</H2>
  109. The driver is still in development. Enable it by specifying
  110. <CODE>--with-cairo</CODE> when configuring GRASS. This
  111. requires a reasonably recent version of the Cairo libraries
  112. and a working pkg-config.
  113. <P>
  114. Antialiasing is enabled by default for bitmap formats. There is
  115. currently no way of disabling this.
  116. <P>
  117. Cairo supports true vector format output whenever possible. However,
  118. if the selected format doesn't support a necessary feature, Cairo may
  119. fall back on rendering a bitmap representation of the image wrapped in
  120. the selected vector format.
  121. <h2>SEE ALSO</h2>
  122. <EM>
  123. <a href="displaydrivers.html">Display drivers</a>
  124. <br>
  125. <A HREF="pngdriver.html">PNG driver</A>,
  126. <A HREF="psdriver.html">PostScript driver</A>,
  127. <BR>
  128. <A href="d.rast.html">d.rast</A>,
  129. <A href="d.vect.html">d.vect</A>
  130. </EM>
  131. <H2>AUTHOR</H2>
  132. Lars Ahlzen &lt;<I>lars (at) ahlzen.com</I>&gt;<BR>
  133. and the GRASS Development Team.