[GRASS-SVN] r33047 - in grass/trunk/lib: . cairodriver

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Aug 24 07:40:01 EDT 2008


Author: martinl
Date: 2008-08-24 07:39:59 -0400 (Sun, 24 Aug 2008)
New Revision: 33047

Added:
   grass/trunk/lib/cairodriver/cairodriver.dox
Modified:
   grass/trunk/lib/cairodriver/Box.c
   grass/trunk/lib/cairodriver/Color.c
   grass/trunk/lib/cairodriver/Draw_bitmap.c
   grass/trunk/lib/cairodriver/Draw_line.c
   grass/trunk/lib/cairodriver/Draw_point.c
   grass/trunk/lib/cairodriver/Driver.c
   grass/trunk/lib/cairodriver/Erase.c
   grass/trunk/lib/cairodriver/Graph.c
   grass/trunk/lib/cairodriver/Line_width.c
   grass/trunk/lib/cairodriver/Poly.c
   grass/trunk/lib/cairodriver/Raster.c
   grass/trunk/lib/cairodriver/Respond.c
   grass/trunk/lib/cairodriver/Set_window.c
   grass/trunk/lib/cairodriver/Text.c
   grass/trunk/lib/cairodriver/cairodriver.h
   grass/trunk/lib/cairodriver/read.c
   grass/trunk/lib/cairodriver/read_bmp.c
   grass/trunk/lib/cairodriver/read_ppm.c
   grass/trunk/lib/cairodriver/write.c
   grass/trunk/lib/cairodriver/write_bmp.c
   grass/trunk/lib/cairodriver/write_ppm.c
   grass/trunk/lib/grasslib.dox
Log:
cairodriver: initial doxygenization, i18n, messages standardized


Modified: grass/trunk/lib/cairodriver/Box.c
===================================================================
--- grass/trunk/lib/cairodriver/Box.c	2008-08-24 02:20:30 UTC (rev 33046)
+++ grass/trunk/lib/cairodriver/Box.c	2008-08-24 11:39:59 UTC (rev 33047)
@@ -1,7 +1,24 @@
+/*!
+  \file cairodriver/Box.c
+
+  \brief GRASS cairo display driver - draw box
+
+  (C) 2007-2008 by Lars Ahlzen and the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Lars Ahlzen <lars ahlzen.com> (original contibutor)
+  \author Glynn Clements  
+*/
+
 #include "cairodriver.h"
 
-/* Box_abs: Draw a (filled) rectangle */
+/*!
+  \brief Draw a (filled) rectangle
 
+  \param x1,y1,x2,y2 rectangle coordinates
+*/
 void Cairo_Box(double x1, double y1, double x2, double y2)
 {
     G_debug(3, "Cairo_Box %f %f %f %f\n", x1, y1, x2, y2);
@@ -9,4 +26,6 @@
     cairo_rectangle(cairo, x1, y1, x2 - x1, y2 - y1);
     cairo_fill(cairo);
     ca.modified = 1;
+
+    return;
 }

Modified: grass/trunk/lib/cairodriver/Color.c
===================================================================
--- grass/trunk/lib/cairodriver/Color.c	2008-08-24 02:20:30 UTC (rev 33046)
+++ grass/trunk/lib/cairodriver/Color.c	2008-08-24 11:39:59 UTC (rev 33047)
@@ -1,3 +1,17 @@
+/*!
+  \file cairodriver/Color.c
+
+  \brief GRASS cairo display driver - colors management
+
+  (C) 2007-2008 by Lars Ahlzen and the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Lars Ahlzen <lars ahlzen.com> (original contibutor)
+  \author Glynn Clements 
+*/  
+
 #include "cairodriver.h"
 
 /* "cached" color (to avoid more color change calls than necessary) */
@@ -4,6 +18,14 @@
 /* TODO: find a proper solution for initialization */
 int previous_color = 0x7FFFFFFF;
 
+/*!
+  \brief Set source color (opaque)
+  
+  This color will then be used for any subsequent drawing operation
+  until a new source pattern is set.
+  
+  \param color value
+*/
 void Cairo_color(int color)
 {
     G_debug(3, "Cairo_color: %d", color);
@@ -22,6 +44,13 @@
     }
 }
 
+/*!
+  \brief Get color value
+  
+  \param r,g,b red,green,blue
+
+  \return value
+*/
 int Cairo_lookup_color(int r, int g, int b)
 {
     G_debug(3, "Cairo_lookup_color: %d %d %d", r, g, b);

Modified: grass/trunk/lib/cairodriver/Draw_bitmap.c
===================================================================
--- grass/trunk/lib/cairodriver/Draw_bitmap.c	2008-08-24 02:20:30 UTC (rev 33046)
+++ grass/trunk/lib/cairodriver/Draw_bitmap.c	2008-08-24 11:39:59 UTC (rev 33047)
@@ -1,3 +1,19 @@
+/*!
+  \file cairodriver/Draw_bitmap.c
+
+  \brief GRASS cairo display driver - draw bitmap
+
+  (C) 2007-2008 by Lars Ahlzen and the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Lars Ahlzen <lars ahlzen.com> (original contibutor)
+  \author Glynn Clements  
+*/
+
+#include <grass/glocale.h>
+
 #include "cairodriver.h"
 
 static cairo_surface_t *fix_surface(cairo_surface_t * src)
@@ -24,6 +40,13 @@
     return dst;
 }
 
+/*!
+  \brief Draw bitmap
+
+  \param ncols,nrows number of columns and rows
+  \param threshold threshold value
+  \param buf data buffer
+*/
 void Cairo_draw_bitmap(int ncols, int nrows, int threshold,
 		       const unsigned char *buf)
 {
@@ -36,7 +59,7 @@
 					       ncols);
 
     if (cairo_surface_status(surf) != CAIRO_STATUS_SUCCESS)
-	G_fatal_error("Cairo_draw_bitmap: Failed to create source");
+	G_fatal_error(_("Cairo_draw_bitmap: Failed to create source"));
 
     surf = fix_surface(surf);
 
@@ -44,4 +67,6 @@
 
     cairo_surface_destroy(surf);
     ca.modified = 1;
+
+    return;
 }

Modified: grass/trunk/lib/cairodriver/Draw_line.c
===================================================================
--- grass/trunk/lib/cairodriver/Draw_line.c	2008-08-24 02:20:30 UTC (rev 33046)
+++ grass/trunk/lib/cairodriver/Draw_line.c	2008-08-24 11:39:59 UTC (rev 33047)
@@ -1,5 +1,24 @@
+/*!
+  \file cairodriver/Draw_line.c
+
+  \brief GRASS cairo display driver - colors management
+
+  (C) 2007-2008 by Lars Ahlzen and the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Lars Ahlzen <lars ahlzen.com> (original contibutor)
+  \author Glynn Clements  
+*/
+
 #include "cairodriver.h"
 
+/*!
+  \brief Draw line
+
+  \param x1,y1,x2,y2 line nodes
+*/
 void Cairo_draw_line(double x1, double y1, double x2, double y2)
 {
     G_debug(3, "Cairo_draw_line: %f %f %f %f", x1, y1, x2, y2);
@@ -14,4 +33,6 @@
     cairo_line_to(cairo, x2, y2);
     cairo_stroke(cairo);
     ca.modified = 1;
+
+    return;
 }

Modified: grass/trunk/lib/cairodriver/Draw_point.c
===================================================================
--- grass/trunk/lib/cairodriver/Draw_point.c	2008-08-24 02:20:30 UTC (rev 33046)
+++ grass/trunk/lib/cairodriver/Draw_point.c	2008-08-24 11:39:59 UTC (rev 33047)
@@ -1,3 +1,17 @@
+/*!
+  \file cairodriver/Draw_point.c
+
+  \brief GRASS cairo display driver - draw point
+
+  (C) 2007-2008 by Lars Ahlzen and the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Lars Ahlzen <lars ahlzen.com> (original contibutor)
+  \author Glynn Clements  
+*/
+
 #include "cairodriver.h"
 
 #define POINTSIZE 1.0
@@ -3,4 +17,9 @@
 #define HALFPOINTSIZE (0.5*POINTSIZE)
 
+/*!
+  \brief Draw point
+
+  \param x,y point coordinates
+*/
 void Cairo_draw_point(double x, double y)
 {
@@ -12,4 +31,6 @@
 		    POINTSIZE, POINTSIZE);
     cairo_fill(cairo);
     ca.modified = 1;
+
+    return;
 }

Modified: grass/trunk/lib/cairodriver/Driver.c
===================================================================
--- grass/trunk/lib/cairodriver/Driver.c	2008-08-24 02:20:30 UTC (rev 33046)
+++ grass/trunk/lib/cairodriver/Driver.c	2008-08-24 11:39:59 UTC (rev 33047)
@@ -1,24 +1,24 @@
+/*!
+  \file cairodriver/Driver.c
 
-/****************************************************************************
- *
- * MODULE:       Cairo driver
- * AUTHOR(S):    Lars Ahlzen <lars at ahlzen.com>
- * COPYRIGHT:    (C) 2007 Lars Ahlzen
- *
- *  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.
- *
- *****************************************************************************/
+  \brief GRASS cairo display driver - driver initialization
 
+  (C) 2007-2008 by Lars Ahlzen and the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Lars Ahlzen <lars ahlzen.com> (original contibutor)
+  \author Glynn Clements  
+*/
+
 #include "cairodriver.h"
 
+/*!
+  \brief Initialize display driver
+
+  \return pointer driver structure
+*/
 const struct driver *Cairo_Driver(void)
 {
     static struct driver drv;

Modified: grass/trunk/lib/cairodriver/Erase.c
===================================================================
--- grass/trunk/lib/cairodriver/Erase.c	2008-08-24 02:20:30 UTC (rev 33046)
+++ grass/trunk/lib/cairodriver/Erase.c	2008-08-24 11:39:59 UTC (rev 33047)
@@ -1,5 +1,22 @@
+/*!
+  \file cairodriver/Erase.c
+
+  \brief GRASS cairo display driver - erase screen
+
+  (C) 2007-2008 by Lars Ahlzen and the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Lars Ahlzen <lars ahlzen.com> (original contibutor)
+  \author Glynn Clements  
+*/
+
 #include "cairodriver.h"
 
+/*!
+  \brief Erase screen
+*/
 void Cairo_Erase(void)
 {
     G_debug(1, "Cairo_Erase");
@@ -11,4 +28,6 @@
     cairo_restore(cairo);
 
     ca.modified = 1;
+
+    return;
 }

Modified: grass/trunk/lib/cairodriver/Graph.c
===================================================================
--- grass/trunk/lib/cairodriver/Graph.c	2008-08-24 02:20:30 UTC (rev 33046)
+++ grass/trunk/lib/cairodriver/Graph.c	2008-08-24 11:39:59 UTC (rev 33047)
@@ -1,3 +1,17 @@
+/*!
+  \file cairodriver/Graph.c
+
+  \brief GRASS cairo display driver - driver settings
+
+  (C) 2007-2008 by Lars Ahlzen and the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Lars Ahlzen <lars ahlzen.com> (original contibutor)
+  \author Glynn Clements  
+*/
+
 #include "cairodriver.h"
 #include <cairo-ps.h>
 #include <cairo-pdf.h>
@@ -20,6 +34,8 @@
 #include <X11/Xutil.h>
 #endif
 
+#include <grass/glocale.h>
+
 struct cairo_state ca;
 
 /* cairo objects */
@@ -48,31 +64,31 @@
 
     p = getenv("GRASS_CAIRO_DRAWABLE");
     if (!p || sscanf(p, "%li", &xid) != 1)
-	G_fatal_error("invalid Drawable XID: %s", p);
+	G_fatal_error(_("Invalid Drawable XID: %s"), p);
     win = xid;
 
     dpy = XOpenDisplay(NULL);
     if (!dpy)
-	G_fatal_error("Unable to open display");
+	G_fatal_error(_("Unable to open display"));
 
     p = getenv("GRASS_CAIRO_VISUAL");
     if (!p || sscanf(p, "%li", &xid) != 1)
-	G_fatal_error("invalid Visual XID: %s", p);
+	G_fatal_error(_("invalid Visual XID: %s"), p);
     templ.visualid = xid;
 
     vinfo = XGetVisualInfo(dpy, VisualIDMask, &templ, &count);
     if (!vinfo || !count)
-	G_fatal_error("Unable to obtain visual");
+	G_fatal_error(_("Unable to obtain visual"));
     visual = vinfo[0].visual;
 
     if (!XGetGeometry
 	(dpy, win, &root, &si, &si, &width, &height, &ui, &depth))
-	G_fatal_error("Unable to query drawable");
+	G_fatal_error(_("Unable to query drawable"));
 
     surface = cairo_xlib_surface_create(dpy, win, visual, width, height);
 
     if (cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS)
-	G_fatal_error("Failed to initialize Xlib surface");
+	G_fatal_error(_("Failed to initialize Xlib surface"));
 
     cairo = cairo_create(surface);
 
@@ -126,7 +142,7 @@
 	ca.file_type = FTYPE_SVG;
 #endif
     else
-	G_fatal_error("Unknown file extension: %s", p);
+	G_fatal_error(_("Unknown file extension: %s"), p);
     G_debug(1, "File type: %s (%d)", ca.file_name, ca.file_type);
 
     switch (ca.file_type) {
@@ -151,10 +167,11 @@
     if (do_read && access(ca.file_name, 0) != 0)
 	do_read = 0;
 
-    G_message
-	("cairo: collecting to file: %s,\n     GRASS_WIDTH=%d, GRASS_HEIGHT=%d",
-	 ca.file_name, ca.width, ca.height);
-
+    G_message(_("cairo: collecting to file: %s"),
+	      ca.file_name);
+    G_message(_("GRASS_WIDTH=%d, GRASS_HEIGHT=%d"),
+	     ca.width, ca.height);
+    
     if (do_read && do_map)
 	map_file();
 
@@ -178,6 +195,13 @@
     }
 }
 
+/*!
+  \brief Initialize driver
+
+  Set background color, transparency, drawable, antialias mode, etc.
+
+  \return 0
+*/
 int Cairo_Graph_set(void)
 {
     cairo_antialias_t antialias;
@@ -234,6 +258,9 @@
     return 0;
 }
 
+/*!
+  \brief Close driver
+*/
 void Cairo_Graph_close(void)
 {
     G_debug(1, "Cairo_Graph_close");
@@ -285,12 +312,12 @@
 	break;
 #endif
     default:
-	G_fatal_error("Unknown Cairo surface type");
+	G_fatal_error(_("Unknown Cairo surface type"));
 	break;
     }
 
     if (cairo_surface_status(surface) != CAIRO_STATUS_SUCCESS)
-	G_fatal_error("Failed to initialize Cairo surface");
+	G_fatal_error(_("Failed to initialize Cairo surface"));
 
     cairo = cairo_create(surface);
 }

Modified: grass/trunk/lib/cairodriver/Line_width.c
===================================================================
--- grass/trunk/lib/cairodriver/Line_width.c	2008-08-24 02:20:30 UTC (rev 33046)
+++ grass/trunk/lib/cairodriver/Line_width.c	2008-08-24 11:39:59 UTC (rev 33047)
@@ -1,3 +1,17 @@
+/*!
+  \file cairodriver/Line_width.c
+
+  \brief GRASS cairo display driver - set line width
+
+  (C) 2007-2008 by Lars Ahlzen and the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Lars Ahlzen <lars ahlzen.com> (original contibutor)
+  \author Glynn Clements  
+*/
+
 #include "cairodriver.h"
 
 #define MIN_WIDTH 1
@@ -8,6 +22,11 @@
 
 static double previous_width = -1;
 
+/*!
+  \brief Set line width
+
+  \param width line width (double precision)
+*/
 void Cairo_Line_width(double width)
 {
     G_debug(1, "Cairo_Line_width: %f", width);
@@ -15,4 +34,6 @@
     width = MAX(MIN_WIDTH, width);
     if (width != previous_width)
 	cairo_set_line_width(cairo, width);
+
+    return;
 }

Modified: grass/trunk/lib/cairodriver/Poly.c
===================================================================
--- grass/trunk/lib/cairodriver/Poly.c	2008-08-24 02:20:30 UTC (rev 33046)
+++ grass/trunk/lib/cairodriver/Poly.c	2008-08-24 11:39:59 UTC (rev 33047)
@@ -1,3 +1,17 @@
+/*!
+  \file cairodriver/Poly.c
+
+  \brief GRASS cairo display driver - draw polygon/polyline
+
+  (C) 2007-2008 by Lars Ahlzen and the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Lars Ahlzen <lars ahlzen.com> (original contibutor)
+  \author Glynn Clements  
+*/
+
 #include "cairodriver.h"
 
 void do_polygon(const double *xarray, const double *yarray, int count)
@@ -9,22 +23,44 @@
 	cairo_line_to(cairo, xarray[i], yarray[i]);
 }
 
+/*!
+  \brief Draw polygon (filled)
+
+  \param xarray,yarray array of x/y coordinates
+  \param count number of points
+*/
 void Cairo_Polygon(const double *xarray, const double *yarray, int count)
 {
     G_debug(3, "Cairo_Polygon (%d points)", count);
     do_polygon(xarray, yarray, count);
     cairo_fill(cairo);
     ca.modified = 1;
+
+    return;
 }
 
+/*!
+  \brief Draw polyline
+
+  \param xarray,yarray array of x/y coordinates
+  \param count number of points
+*/
 void Cairo_Polyline(const double *xarray, const double *yarray, int count)
 {
     G_debug(3, "Cairo_Polyline (%d points)", count);
     do_polygon(xarray, yarray, count);
     cairo_stroke(cairo);
     ca.modified = 1;
+
+    return;
 }
 
+/*!
+  \brief Draw polyline points
+
+  \param xarray,yarray array of x/y coordinates
+  \param count number of points
+*/
 void Cairo_Polydots(const double *xarray, const double *yarray, int count)
 {
     int i;
@@ -33,5 +69,6 @@
     for (i = 1; i < count; i++)
 	Cairo_draw_point(xarray[0], yarray[0]);
     ca.modified = 1;
+
+    return;
 }
-

Modified: grass/trunk/lib/cairodriver/Raster.c
===================================================================
--- grass/trunk/lib/cairodriver/Raster.c	2008-08-24 02:20:30 UTC (rev 33046)
+++ grass/trunk/lib/cairodriver/Raster.c	2008-08-24 11:39:59 UTC (rev 33047)
@@ -1,3 +1,19 @@
+/*!
+  \file cairodriver/Raster.c
+
+  \brief GRASS cairo display driver - draw raster
+
+  (C) 2007-2008 by Lars Ahlzen and the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Lars Ahlzen <lars ahlzen.com> (original contibutor)
+  \author Glynn Clements  
+*/
+
+#include <grass/glocale.h>
+
 #include "cairodriver.h"
 
 static int src_t, src_b, src_l, src_r, src_w, src_h;
@@ -9,6 +25,13 @@
 
 static int masked;
 
+/*!
+  \brief Start drawing raster
+
+  \param mask
+  \param s
+  \param d
+*/
 void Cairo_begin_scaled_raster(int mask, int s[2][2], double d[2][2])
 {
     G_debug(1, "Cairo_begin_scaled_raster: %d, %d %d %d %d, %f %f %f %f",
@@ -42,12 +65,23 @@
     /* create source surface */
     src_surf = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, src_w, src_h);
     if (cairo_surface_status(src_surf) != CAIRO_STATUS_SUCCESS)
-	G_fatal_error("Cairo_begin_scaled_raster: Failed to create surface");
+	G_fatal_error(_("Cairo_begin_scaled_raster: Failed to create surface"));
 
     src_data = cairo_image_surface_get_data(src_surf);
     src_stride = cairo_image_surface_get_stride(src_surf);
+
+    return;
 }
 
+/*!
+  \brief Draw raster row
+
+  \param n number of cell
+  \param row raster row
+  \param red,grn,blu,nul red,green,blue and null value
+
+  \return next row
+*/
 int Cairo_scaled_raster(int n, int row,
 			const unsigned char *red, const unsigned char *grn,
 			const unsigned char *blu, const unsigned char *nul)
@@ -71,6 +105,9 @@
     return row + 1;
 }
 
+/*!
+  \brief Finish drawing raster
+*/
 void Cairo_end_scaled_raster(void)
 {
     G_debug(1, "Cairo_end_scaled_raster");
@@ -86,4 +123,6 @@
     /* cleanup */
     cairo_surface_destroy(src_surf);
     ca.modified = 1;
+
+    return;
 }

Modified: grass/trunk/lib/cairodriver/Respond.c
===================================================================
--- grass/trunk/lib/cairodriver/Respond.c	2008-08-24 02:20:30 UTC (rev 33046)
+++ grass/trunk/lib/cairodriver/Respond.c	2008-08-24 11:39:59 UTC (rev 33047)
@@ -1,6 +1,22 @@
+/*!
+  \file cairodriver/Respond.c
 
+  \brief GRASS cairo display driver - write image
+
+  (C) 2007-2008 by Lars Ahlzen and the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Lars Ahlzen <lars ahlzen.com> (original contibutor)
+  \author Glynn Clements  
+*/
+
 #include "cairodriver.h"
 
+/*!
+  \brief Write image
+*/
 void Cairo_Respond(void)
 {
     if (ca.auto_write)

Modified: grass/trunk/lib/cairodriver/Set_window.c
===================================================================
--- grass/trunk/lib/cairodriver/Set_window.c	2008-08-24 02:20:30 UTC (rev 33046)
+++ grass/trunk/lib/cairodriver/Set_window.c	2008-08-24 11:39:59 UTC (rev 33047)
@@ -1,5 +1,24 @@
+/*!
+  \file cairodriver/Set_window.c
+
+  \brief GRASS cairo display driver - set window
+
+  (C) 2007-2008 by Lars Ahlzen and the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Lars Ahlzen <lars ahlzen.com> (original contibutor)
+  \author Glynn Clements  
+*/
+
 #include "cairodriver.h"
 
+/*!
+  \brief Set window
+  
+  \param t,b,l,r top, bottom, left, right
+*/
 void Cairo_Set_window(double t, double b, double l, double r)
 {
     G_debug(1, "Cairo_Set_window: %f %f %f %f", t, b, l, r);
@@ -7,4 +26,6 @@
     cairo_reset_clip(cairo);
     cairo_rectangle(cairo, l, t, r - l, b - t);
     cairo_clip(cairo);
+
+    return;
 }

Modified: grass/trunk/lib/cairodriver/Text.c
===================================================================
--- grass/trunk/lib/cairodriver/Text.c	2008-08-24 02:20:30 UTC (rev 33046)
+++ grass/trunk/lib/cairodriver/Text.c	2008-08-24 11:39:59 UTC (rev 33047)
@@ -1,3 +1,17 @@
+/*!
+  \file cairodriver/Text.c
+
+  \brief GRASS cairo display driver - text subroutines
+
+  (C) 2007-2008 by Lars Ahlzen and the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Lars Ahlzen <lars ahlzen.com> (original contibutor)
+  \author Glynn Clements  
+*/
+
 #include <grass/glocale.h>
 #include "cairodriver.h"
 
@@ -31,7 +45,8 @@
 	    encoding = G_store("US-ASCII");
 
 	if ((cd = iconv_open("UTF-8", encoding)) < 0)
-	    G_fatal_error(_("Unable to convert from <%s> to UTF-8"));
+	    G_fatal_error(_("Unable to convert from <%s> to UTF-8"),
+			  encoding);
 
 	ret = iconv(cd, &p1, &ilen, &p2, &olen);
 
@@ -81,6 +96,11 @@
     matrix_valid = 1;
 }
 
+/*!
+  \brief Draw text
+  
+  \param str string to be drawn
+*/
 void Cairo_draw_text(const char *str)
 {
     char *utf8 = convert(str);
@@ -96,8 +116,16 @@
     G_free(utf8);
 
     ca.modified = 1;
+
+    return;
 }
 
+/*
+  \brief Get text bounding box
+
+  \param str string
+  \param[out] t,b,l,r top, bottom, left, right corner
+*/
 void Cairo_text_box(const char *str, double *t, double *b, double *l, double *r)
 {
     char *utf8 = convert(str);
@@ -116,6 +144,8 @@
     *r = cur_x + ext.x_bearing + ext.width;
     *t = cur_x + ext.y_bearing;
     *b = cur_x + ext.y_bearing + ext.height;
+
+    return;
 }
 
 static void set_font_toy(const char *name)
@@ -202,6 +232,11 @@
     return 0;
 }
 
+/*!
+  \brief Set font
+
+  \param name font name
+*/
 void Cairo_set_font(const char *name)
 {
 #if CAIRO_HAS_FT_FONT
@@ -212,14 +247,23 @@
 #else
     set_font_toy(name);
 #endif
+
+    return;
 }
 
+/*!
+  \brief Set font encoding
+
+  \param enc encoding name
+*/
 void Cairo_set_encoding(const char *enc)
 {
     if (encoding)
 	G_free(encoding);
 
     encoding = G_store(enc);
+
+    return;
 }
 
 static void font_list_toy(char ***list, int *count, int verbose)
@@ -242,15 +286,31 @@
     *count = num_fonts;
 }
 
+/*!
+  \brief Get list of fonts
+
+  \param[out] list font list
+  \param[out] number of items in the list
+*/
 void Cairo_font_list(char ***list, int *count)
 {
     font_list(list, count, 0);
     font_list_toy(list, count, 0);
+
+    return;
 }
 
+/*!
+  \brief Get fonts into
+
+  \param[out] list font list
+  \param[out] number of items in the list
+*/
 void Cairo_font_info(char ***list, int *count)
 {
     font_list(list, count, 1);
     font_list_toy(list, count, 1);
+
+    return;
 }
 

Added: grass/trunk/lib/cairodriver/cairodriver.dox
===================================================================
--- grass/trunk/lib/cairodriver/cairodriver.dox	                        (rev 0)
+++ grass/trunk/lib/cairodriver/cairodriver.dox	2008-08-24 11:39:59 UTC (rev 33047)
@@ -0,0 +1,70 @@
+/*! \page cairodriver GRASS Cairo Display Driver
+
+by GRASS Development Team
+
+http://grass.osgeo.org
+
+\section cairointro Introduction to Cairo display driver
+
+Cairo is a 2D graphics library with support for multiple output
+devices. Currently supported output targets include the X Window
+System, Quartz, Win32, image buffers, PostScript, PDF, and SVG file
+output, see <a href="http://cairographics.org">Cairo website</a> for
+details.
+
+GRASS Cairo display %driver was originally written by Lars Ahlzen (<a
+href="http://lists.osgeo.org/pipermail/grass-dev/2007-October/033524.html">announcement</a>).
+
+\section cairofunctions List of functions
+
+ - Cairo_Box()
+
+ - Cairo_Driver()
+
+ - Cairo_Erase()
+ 
+ - Cairo_Graph_close()
+
+ - Cairo_Graph_set()
+
+ - Cairo_Line_width()
+
+ - Cairo_Polydots()
+ 
+ - Cairo_Polygon()
+
+ - Cairo_Polyline()
+
+ - Cairo_Respond()
+
+ - Cairo_Set_window()
+
+ - Cairo_begin_scaled_raster()
+ 
+ - Cairo_color()
+
+ - Cairo_draw_bitmap()
+
+ - Cairo_draw_line()
+
+ - Cairo_draw_point()
+
+ - Cairo_draw_text()
+
+ - Cairo_end_scaled_raster()
+ 
+ - Cairo_font_info()
+
+ - Cairo_font_list()
+
+ - Cairo_lookup_color()
+
+ - Cairo_scaled_raster()
+
+ - Cairo_set_encoding()
+
+ - Cairo_set_font()
+
+ - Cairo_text_box()
+
+*/


Property changes on: grass/trunk/lib/cairodriver/cairodriver.dox
___________________________________________________________________
Name: svn:mime-type
   + text/x-plain
Name: svn:keywords
   + Author Date Id
Name: svn:eol-style
   + native

Modified: grass/trunk/lib/cairodriver/cairodriver.h
===================================================================
--- grass/trunk/lib/cairodriver/cairodriver.h	2008-08-24 02:20:30 UTC (rev 33046)
+++ grass/trunk/lib/cairodriver/cairodriver.h	2008-08-24 11:39:59 UTC (rev 33047)
@@ -1,3 +1,17 @@
+/*!
+  \file cairodriver/cairodriver.h
+
+  \brief GRASS cairo display driver - header file
+
+  (C) 2007-2008 by Lars Ahlzen and the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Lars Ahlzen <lars ahlzen.com> (original contibutor)
+  \author Glynn Clements  
+*/
+
 #ifndef __CAIRODRIVER_H__
 #define __CAIRODRIVER_H__
 

Modified: grass/trunk/lib/cairodriver/read.c
===================================================================
--- grass/trunk/lib/cairodriver/read.c	2008-08-24 02:20:30 UTC (rev 33046)
+++ grass/trunk/lib/cairodriver/read.c	2008-08-24 11:39:59 UTC (rev 33047)
@@ -1,3 +1,17 @@
+/*!
+  \file cairodriver/read.c
+
+  \brief GRASS cairo display driver - read image (lower level functions)
+
+  (C) 2007-2008 by Lars Ahlzen and the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Lars Ahlzen <lars ahlzen.com> (original contibutor)
+  \author Glynn Clements  
+*/
+
 #include "cairodriver.h"
 
 void cairo_read_image(void)

Modified: grass/trunk/lib/cairodriver/read_bmp.c
===================================================================
--- grass/trunk/lib/cairodriver/read_bmp.c	2008-08-24 02:20:30 UTC (rev 33046)
+++ grass/trunk/lib/cairodriver/read_bmp.c	2008-08-24 11:39:59 UTC (rev 33047)
@@ -1,9 +1,23 @@
+/*!
+  \file cairodriver/read_bmp.c
 
+  \brief GRASS cairo display driver - read bitmap (lower level functions)
+
+  (C) 2007-2008 by Lars Ahlzen and the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Lars Ahlzen <lars ahlzen.com> (original contibutor)
+  \author Glynn Clements  
+*/
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
 #include <grass/gis.h>
+#include <grass/glocale.h>
 #include "cairodriver.h"
 
 static unsigned int get_2(const unsigned char **q)
@@ -71,13 +85,16 @@
 
     input = fopen(ca.file_name, "rb");
     if (!input)
-	G_fatal_error("cairo:: couldn't open input file %s", ca.file_name);
+	G_fatal_error(_("Cairo: unable to open input file <%s>"),
+		      ca.file_name);
 
     if (fread(header, sizeof(header), 1, input) != 1)
-	G_fatal_error("cairo:: invalid input file %s", ca.file_name);
+	G_fatal_error(_("Cairo: invalid input file <%s>"),
+		      ca.file_name);
 
     if (!read_bmp_header(header))
-	G_fatal_error("cairo:: invalid BMP header for %s", ca.file_name);
+	G_fatal_error(_("Cairo: Invalid BMP header for <%s>"),
+		      ca.file_name);
 
     fread(ca.grid, ca.stride, ca.height, input);
 

Modified: grass/trunk/lib/cairodriver/read_ppm.c
===================================================================
--- grass/trunk/lib/cairodriver/read_ppm.c	2008-08-24 02:20:30 UTC (rev 33046)
+++ grass/trunk/lib/cairodriver/read_ppm.c	2008-08-24 11:39:59 UTC (rev 33047)
@@ -1,3 +1,19 @@
+/*!
+  \file cairodriver/read_ppm.c
+
+  \brief GRASS cairo display driver - read PPM image (lower level functions)
+
+  (C) 2007-2008 by Lars Ahlzen and the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Lars Ahlzen <lars ahlzen.com> (original contibutor)
+  \author Glynn Clements  
+*/
+
+#include <grass/glocale.h>
+
 #include "cairodriver.h"
 
 void cairo_read_ppm(void)
@@ -9,33 +25,37 @@
 
     input = fopen(ca.file_name, "rb");
     if (!input)
-	G_fatal_error("cairo: couldn't open input file %s", ca.file_name);
+	G_fatal_error(_("Cairo: unable to open input file <%s>"),
+		      ca.file_name);
 
     if (fscanf(input, "P6 %d %d %d", &i_width, &i_height, &maxval) != 3)
-	G_fatal_error("cairo: invalid input file %s", ca.file_name);
+	G_fatal_error(_("Cairo: invalid input file <%s>"),
+		      ca.file_name);
 
     fgetc(input);
 
     if (i_width != ca.width || i_height != ca.height)
-	G_fatal_error
-	    ("cairo: input file has incorrect dimensions: expected: %dx%d got: %dx%d",
-	     ca.width, ca.height, i_width, i_height);
+	G_fatal_error(_("Cairo: input file has incorrect dimensions: "
+			"expected: %dx%d got: %dx%d"),
+		      ca.width, ca.height, i_width, i_height);
 
     mask_name[strlen(mask_name) - 2] = 'g';
 
     input = fopen(mask_name, "rb");
     if (!input)
-	G_fatal_error("cairo: couldn't open input mask file %s", mask_name);
+	G_fatal_error(_("Cairo: unable to open input mask file <%s>"),
+		      mask_name);
 
     if (fscanf(input, "P5 %d %d %d", &i_width, &i_height, &maxval) != 3)
-	G_fatal_error("cairo: invalid input mask file %s", mask_name);
+	G_fatal_error(_("Cairo: invalid input mask file <%s>"),
+		      mask_name);
 
     fgetc(input);
 
     if (i_width != ca.width || i_height != ca.height)
-	G_fatal_error
-	    ("cairo: input mask file has incorrect dimensions: expected: %dx%d got: %dx%d",
-	     ca.width, ca.height, i_width, i_height);
+	G_fatal_error(_("Cairo: input mask file has incorrect dimensions: "
+			"expected: %dx%d got: %dx%d"),
+		      ca.width, ca.height, i_width, i_height);
 
     G_free(mask_name);
 

Modified: grass/trunk/lib/cairodriver/write.c
===================================================================
--- grass/trunk/lib/cairodriver/write.c	2008-08-24 02:20:30 UTC (rev 33046)
+++ grass/trunk/lib/cairodriver/write.c	2008-08-24 11:39:59 UTC (rev 33047)
@@ -1,3 +1,17 @@
+/*!
+  \file cairodriver/write.c
+
+  \brief GRASS cairo display driver - write image (lower level functions)
+
+  (C) 2007-2008 by Lars Ahlzen and the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Lars Ahlzen <lars ahlzen.com> (original contibutor)
+  \author Glynn Clements  
+*/
+
 #include "cairodriver.h"
 
 #if CAIRO_HAS_XLIB_SURFACE

Modified: grass/trunk/lib/cairodriver/write_bmp.c
===================================================================
--- grass/trunk/lib/cairodriver/write_bmp.c	2008-08-24 02:20:30 UTC (rev 33046)
+++ grass/trunk/lib/cairodriver/write_bmp.c	2008-08-24 11:39:59 UTC (rev 33047)
@@ -1,9 +1,23 @@
+/*!
+  \file cairodriver/write_bmp.c
 
+  \brief GRASS cairo display driver - write bitmap (lower level functions)
+
+  (C) 2007-2008 by Lars Ahlzen and the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Lars Ahlzen <lars ahlzen.com> (original contibutor)
+  \author Glynn Clements  
+*/
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
 #include <grass/gis.h>
+#include <grass/glocale.h>
 #include "cairodriver.h"
 
 static unsigned char *put_2(unsigned char *p, unsigned int n)
@@ -55,7 +69,8 @@
 
     output = fopen(ca.file_name, "wb");
     if (!output)
-	G_fatal_error("cairo: couldn't open output file %s", ca.file_name);
+	G_fatal_error(_("Cairo: unable to open output file <%s>"),
+		      ca.file_name);
 
     make_bmp_header(header);
     fwrite(header, sizeof(header), 1, output);

Modified: grass/trunk/lib/cairodriver/write_ppm.c
===================================================================
--- grass/trunk/lib/cairodriver/write_ppm.c	2008-08-24 02:20:30 UTC (rev 33046)
+++ grass/trunk/lib/cairodriver/write_ppm.c	2008-08-24 11:39:59 UTC (rev 33047)
@@ -1,3 +1,19 @@
+/*!
+  \file cairodriver/write_ppm.c
+
+  \brief GRASS cairo display driver - write PPM image (lower level functions)
+
+  (C) 2007-2008 by Lars Ahlzen and the GRASS Development Team
+  
+  This program is free software under the GNU General Public License
+  (>=v2). Read the file COPYING that comes with GRASS for details.
+  
+  \author Lars Ahlzen <lars ahlzen.com> (original contibutor)
+  \author Glynn Clements  
+*/
+
+#include <grass/glocale.h>
+
 #include "cairodriver.h"
 
 void cairo_write_ppm(void)
@@ -8,13 +24,15 @@
 
     output = fopen(ca.file_name, "wb");
     if (!output)
-	G_fatal_error("cairo: couldn't open output file %s", ca.file_name);
+	G_fatal_error(_("Cairo: unable to open output file <%s>"),
+			ca.file_name);
 
     mask_name[strlen(mask_name) - 2] = 'g';
 
     mask = fopen(mask_name, "wb");
     if (!mask)
-	G_fatal_error("cairo: couldn't open mask file %s", mask_name);
+	G_fatal_error(_("Cairo: unable to open mask file <%s>"),
+		      mask_name);
 
     G_free(mask_name);
 

Modified: grass/trunk/lib/grasslib.dox
===================================================================
--- grass/trunk/lib/grasslib.dox	2008-08-24 02:20:30 UTC (rev 33046)
+++ grass/trunk/lib/grasslib.dox	2008-08-24 11:39:59 UTC (rev 33047)
@@ -63,7 +63,7 @@
 <li>arraystats: Library of statistics for arrays of doubles - \ref arraystats (new, under development)
 <li>bitmap:	Bitmap library for X Window Bitmaps - \ref bitmap
 <li>btree:	Binary tree library - \ref btree
-<li>cairodriver: <a href="http://cairographics.org">Cairo</a> display driver library - \ref cairodriver
+<li>cairodriver: \ref cairodriver
 <li>cdhc:	Library for testing normality and exponentiality - \ref cdhc 
 <li>cluster:    Library for cluster analysis (image processing) - \ref cluster
 <li>datetime:	DateTime library - \ref datetime



More information about the grass-commit mailing list