line_width.c 814 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*!
  2. \file lib/cairodriver/line_width.c
  3. \brief GRASS cairo display driver - set line width
  4. (C) 2007-2008 by Lars Ahlzen and the GRASS Development Team
  5. This program is free software under the GNU General Public License
  6. (>=v2). Read the file COPYING that comes with GRASS for details.
  7. \author Lars Ahlzen <lars ahlzen.com> (original contibutor)
  8. \author Glynn Clements
  9. */
  10. #include "cairodriver.h"
  11. #define MIN_WIDTH 1
  12. #ifndef MAX
  13. #define MAX(a,b) ((a)>(b)?(a):(b))
  14. #endif
  15. static double previous_width = -1;
  16. /*!
  17. \brief Set line width
  18. \param width line width (double precision)
  19. */
  20. void Cairo_Line_width(double width)
  21. {
  22. G_debug(1, "Cairo_Line_width: %f", width);
  23. width = MAX(MIN_WIDTH, width);
  24. if (width != previous_width)
  25. cairo_set_line_width(cairo, width);
  26. return;
  27. }