set_window.c 748 B

123456789101112131415161718192021222324252627282930
  1. /*!
  2. \file lib/pngdriver/set_window.c
  3. \brief GRASS png display driver - set window
  4. (C) 2007-2014 by Glynn Clements 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 Per Henrik Johansen (original contributor)
  8. \author Glynn Clements
  9. */
  10. #include <math.h>
  11. #include "pngdriver.h"
  12. /*!
  13. \brief Set window
  14. \param t,b,l,r top, bottom, left, right
  15. */
  16. void PNG_Set_window(double t, double b, double l, double r)
  17. {
  18. png.clip_top = t > 0 ? t : 0;
  19. png.clip_bot = b < png.height ? b : png.height;
  20. png.clip_left = l > 0 ? l : 0;
  21. png.clip_rite = r < png.width ? r : png.width;
  22. }