[GRASS-SVN] r32881 - in grass/trunk/lib: cairodriver pngdriver
psdriver
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Aug 19 06:14:07 EDT 2008
Author: glynn
Date: 2008-08-19 06:14:07 -0400 (Tue, 19 Aug 2008)
New Revision: 32881
Modified:
grass/trunk/lib/cairodriver/Graph.c
grass/trunk/lib/cairodriver/cairodriver.html
grass/trunk/lib/pngdriver/pngdriver.html
grass/trunk/lib/psdriver/psdriver.html
Log:
Add GRASS_ANTIALIAS to cairo driver
Update driver documention
Modified: grass/trunk/lib/cairodriver/Graph.c
===================================================================
--- grass/trunk/lib/cairodriver/Graph.c 2008-08-19 10:10:15 UTC (rev 32880)
+++ grass/trunk/lib/cairodriver/Graph.c 2008-08-19 10:14:07 UTC (rev 32881)
@@ -36,14 +36,15 @@
/* cairo objects */
cairo_surface_t *surface;
cairo_t *cairo;
+cairo_antialias_t antialias;
static void init_cairo(void);
static int ends_with(const char *string, const char *suffix);
static void map_file(void);
+static void init_xlib(void)
+{
#if defined(USE_X11) && CAIRO_HAS_XLIB_SURFACE
-static int init_xlib(void)
-{
Display *dpy;
Drawable win;
unsigned long xid;
@@ -92,12 +93,10 @@
screen_right = screen_left + width;
screen_bottom = screen_top + height;
-
- return 0;
+#endif
}
-#endif
-static int init_file(void)
+static void init_file(void)
{
int do_read = 0;
int do_map = 0;
@@ -188,8 +187,6 @@
map_file();
init_cairo();
}
-
- return 0;
}
int Cairo_Graph_set(void)
@@ -225,12 +222,26 @@
p = getenv("GRASS_PNG_AUTO_WRITE");
auto_write = p && strcmp(p, "TRUE") == 0;
-#if defined(USE_X11) && CAIRO_HAS_XLIB_SURFACE
+ antialias = CAIRO_ANTIALIAS_DEFAULT;
+ p = getenv("GRASS_ANTIALIAS");
+ if (p && G_strcasecmp(p, "default") == 0)
+ antialias = CAIRO_ANTIALIAS_DEFAULT;
+ if (p && G_strcasecmp(p, "none") == 0)
+ antialias = CAIRO_ANTIALIAS_NONE;
+ if (p && G_strcasecmp(p, "gray") == 0)
+ antialias = CAIRO_ANTIALIAS_GRAY;
+ if (p && G_strcasecmp(p, "subpixel") == 0)
+ antialias = CAIRO_ANTIALIAS_SUBPIXEL;
+
p = getenv("GRASS_CAIRO_DRAWABLE");
if (p)
- return init_xlib();
-#endif
- return init_file();
+ init_xlib();
+ else
+ init_file();
+
+ cairo_set_antialias(cairo, antialias);
+
+ return 0;
}
void Cairo_Graph_close(void)
Modified: grass/trunk/lib/cairodriver/cairodriver.html
===================================================================
--- grass/trunk/lib/cairodriver/cairodriver.html 2008-08-19 10:10:15 UTC (rev 32880)
+++ grass/trunk/lib/cairodriver/cairodriver.html 2008-08-19 10:14:07 UTC (rev 32881)
@@ -34,13 +34,16 @@
Several environment variables affect the operation of the Cairo driver:
<UL>
+ <LI><B>GRASS_RENDER_IMMEDIATE=[FALSE|TRUE|PNG|PS|HTML|cairo]</B><BR>
+ tells the raster library which driver to use. If
+ <tt>TRUE</tt>, the cairo driver is used if it is enabled, otherwise the PNG driver is used.
<LI><B>GRASS_WIDTH=xxx</B><BR>
the width of the image.
</LI>
<LI><B>GRASS_HEIGHT=yyy</B><BR>
the height of the image.
</LI>
- <LI><B>GRASS_CAIROFILE=filename</B><BR>
+ <LI><B>GRASS_PNGFILE=filename</B><BR>
the name and format of the resulting image file, default is
<tt>map.png</tt>.<BR>
The image format is determined from the file extension.<BR>
@@ -73,22 +76,35 @@
(Note: This only applies to bitmap formats - vector formats
are always written directly to file).
</LI>
- <LI><B>GRASS_CAIRO_READ</B><BR>
+ <LI><B>GRASS_PNG_READ</B><BR>
if <tt>TRUE</tt>, the Cairo driver will initialize the image from
- the contents of GRASS_CAIROFILE.<BR>
+ the contents of GRASS_PNGFILE.<BR>
(Note: This is only supported for bitmap formats)
</LI>
- <LI><B>GRASS_CAIRO_MAPPED</B><BR>
- if <tt>TRUE</tt>, the Cairo driver will map GRASS_CAIROFILE as its framebuffer,
+ <LI><B>GRASS_PNG_MAPPED</B><BR>
+ if <tt>TRUE</tt>, the Cairo driver will map GRASS_PNGFILE as its framebuffer,
rather than using memory. This only works with BMP files.
</LI>
+ <LI><B>GRASS_ANTIALIAS</B><BR> can be <em>default</em>,
+ <em>none</em>, <em>gray</em>, or <em>subpixel</em>, corresponding to
+ <a href="http://www.cairographics.org/manual/cairo-cairo-t.html#cairo-antialias-t">cairo_antialias_t</a>
+ </LI>
+ <LI><B>GRASS_LINE_WIDTH</B><BR>
+ the default line width.
+ </LI>
+ <LI><B>GRASS_TEXT_SIZE</B><BR>
+ the default text size.
+ </LI>
+ <LI><B>GRASS_FRAME</B><BR>
+ contains 4 coordinates, <em>top,bottom,left,right</em>, defining the initial frame.
+ </LI>
</UL>
<H3>Examples</H3>
Example using the driver directly (bash-syntax):
<div class="code"><PRE>
-export GRASS_CAIROFILE=spearfish.png
+export GRASS_PNGFILE=spearfish.png
export GRASS_WIDTH=800
export GRASS_HEIGHT=800
Modified: grass/trunk/lib/pngdriver/pngdriver.html
===================================================================
--- grass/trunk/lib/pngdriver/pngdriver.html 2008-08-19 10:10:15 UTC (rev 32880)
+++ grass/trunk/lib/pngdriver/pngdriver.html 2008-08-19 10:14:07 UTC (rev 32881)
@@ -53,10 +53,18 @@
<LI><B>GRASS_PNG_MAPPED</B><BR>
if <tt>TRUE</tt>, the PNG driver will map GRASS_PNGFILE as its framebuffer,
rather than using memory. This only works with BMP files.</LI>
- <LI><B>GRASS_RENDER_IMMEDIATE=[TRUE|FALSE]</B><BR>
- tells the raster library to use its built-in PNG driver rather
- than connecting to an external monitor process using sockets. If
- <tt>TRUE</tt>, there is no need to run <tt>d.mon start=PNG</tt>.
+ <LI><B>GRASS_RENDER_IMMEDIATE=[FALSE|TRUE|PNG|PS|HTML|cairo]</B><BR>
+ tells the raster library which driver to use. If
+ <tt>TRUE</tt>, the cairo driver is used if it is enabled, otherwise the PNG driver is used.
+ <LI><B>GRASS_LINE_WIDTH</B><BR>
+ the default line width.
+ </LI>
+ <LI><B>GRASS_TEXT_SIZE</B><BR>
+ the default text size.
+ </LI>
+ <LI><B>GRASS_FRAME</B><BR>
+ contains 4 coordinates, <em>top,bottom,left,right</em>, defining the initial frame.
+ </LI>
</UL>
<H3>Example</H3>
Modified: grass/trunk/lib/psdriver/psdriver.html
===================================================================
--- grass/trunk/lib/psdriver/psdriver.html 2008-08-19 10:10:15 UTC (rev 32880)
+++ grass/trunk/lib/psdriver/psdriver.html 2008-08-19 10:14:07 UTC (rev 32881)
@@ -26,6 +26,9 @@
of the PS driver:
<UL>
+ <LI><B>GRASS_RENDER_IMMEDIATE=[FALSE|TRUE|PNG|PS|HTML|cairo]</B><BR>
+ tells the raster library which driver to use. If
+ <tt>TRUE</tt>, the cairo driver is used if it is enabled, otherwise the PNG driver is used.
<LI><B>GRASS_PSFILE</B><BR>
name of output file. If it ends with ".eps" an EPS file
will be created.</LI>
@@ -48,6 +51,15 @@
and no prolog or setup sections are generated.</LI>
<LI><B>GRASS_PS_TRAILER</B><BR>
if <tt>FALSE</tt>, no trailer section is generated.</LI>
+ <LI><B>GRASS_LINE_WIDTH</B><BR>
+ the default line width.
+ </LI>
+ <LI><B>GRASS_TEXT_SIZE</B><BR>
+ the default text size.
+ </LI>
+ <LI><B>GRASS_FRAME</B><BR>
+ contains 4 coordinates, <em>top,bottom,left,right</em>, defining the initial frame.
+ </LI>
</UL>
<H3>Example</H3>
More information about the grass-commit
mailing list