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/freetypecap.h>
  19. #include "driverlib.h"
  20. #include "driver.h"
  21. const struct driver *driver;
  22. struct GFONT_CAP *ftcap;
  23. int NCOLORS;
  24. int screen_width;
  25. int screen_height;
  26. double cur_x;
  27. double cur_y;
  28. double text_size_x;
  29. double text_size_y;
  30. double text_rotation;
  31. int matrix_valid;
  32. void LIB_init(const struct driver *drv)
  33. {
  34. const char *p;
  35. driver = drv;
  36. ftcap = parse_freetypecap();
  37. /* initialize graphics */
  38. p = getenv("GRASS_WIDTH");
  39. screen_width = (p && atoi(p)) ? atoi(p) : DEF_WIDTH;
  40. p = getenv("GRASS_HEIGHT");
  41. screen_height = (p && atoi(p)) ? atoi(p) : DEF_HEIGHT;
  42. if (COM_Graph_set() < 0)
  43. exit(1);
  44. COM_Set_window(0, screen_height, 0, screen_width);
  45. }