init.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /****************************************************************************
  2. *
  3. * MODULE: driver
  4. * AUTHOR(S): Glynn Clements <glynn gclements.plus.com> (original contributor)
  5. * Huidae Cho <grass4u gmail.com>
  6. * PURPOSE:
  7. * COPYRIGHT: (C) 2006-2006 by the GRASS Development Team
  8. *
  9. * This program is free software under the GNU General Public
  10. * License (>=v2). Read the file COPYING that comes with GRASS
  11. * for details.
  12. *
  13. *****************************************************************************/
  14. #include <grass/config.h>
  15. #include <stdio.h>
  16. #include <stdlib.h>
  17. #include <grass/gis.h>
  18. #include <grass/fontcap.h>
  19. #include "driverlib.h"
  20. #include "driver.h"
  21. const struct driver *driver;
  22. struct GFONT_CAP *ftcap;
  23. int screen_width;
  24. int screen_height;
  25. double cur_x;
  26. double cur_y;
  27. double text_size_x;
  28. double text_size_y;
  29. double text_rotation;
  30. double text_sinrot;
  31. double text_cosrot;
  32. int matrix_valid;
  33. void LIB_init(const struct driver *drv)
  34. {
  35. const char *p;
  36. driver = drv;
  37. ftcap = parse_fontcap();
  38. /* initialize graphics */
  39. p = getenv("GRASS_WIDTH");
  40. screen_width = (p && atoi(p)) ? atoi(p) : DEF_WIDTH;
  41. p = getenv("GRASS_HEIGHT");
  42. screen_height = (p && atoi(p)) ? atoi(p) : DEF_HEIGHT;
  43. if (COM_Graph_set() < 0)
  44. exit(1);
  45. COM_Set_window(0, screen_height, 0, screen_width);
  46. }