driver.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #ifndef _DRIVER_H
  2. #define _DRIVER_H
  3. #include <grass/fontcap.h>
  4. extern int screen_width;
  5. extern int screen_height;
  6. extern double cur_x;
  7. extern double cur_y;
  8. extern double text_size_x;
  9. extern double text_size_y;
  10. extern double text_rotation;
  11. extern double text_sinrot;
  12. extern double text_cosrot;
  13. extern int matrix_valid;
  14. extern struct GFONT_CAP *ftcap;
  15. struct driver
  16. {
  17. char *name;
  18. void (*Box)(double, double, double, double);
  19. void (*Erase)(void);
  20. int (*Graph_set)(void);
  21. void (*Graph_close)(void);
  22. void (*Line_width)(double);
  23. void (*Set_window)(double, double, double, double);
  24. void (*Begin_raster)(int, int[2][2], double[2][2]);
  25. int (*Raster)(int, int,
  26. const unsigned char *,
  27. const unsigned char *,
  28. const unsigned char *,
  29. const unsigned char *);
  30. void (*End_raster)(void);
  31. void (*Begin)(void);
  32. void (*Move)(double, double);
  33. void (*Cont)(double, double);
  34. void (*Close)(void);
  35. void (*Stroke)(void);
  36. void (*Fill)(void);
  37. void (*Point)(double, double);
  38. void (*Color)(int, int, int);
  39. void (*Bitmap)(int, int, int, const unsigned char *);
  40. void (*Text)(const char *);
  41. void (*Text_box)(const char *, double *, double *, double *, double *);
  42. void (*Set_font)(const char *);
  43. void (*Font_list)(char ***, int *);
  44. void (*Font_info)(char ***, int *);
  45. };
  46. /* Library Functions */
  47. /* init.c */
  48. extern void LIB_init(const struct driver *drv);
  49. /* Commands */
  50. /* Box.c */
  51. extern void COM_Box_abs(double, double, double, double);
  52. /* Color.c */
  53. extern void COM_Color_RGB(unsigned char, unsigned char, unsigned char);
  54. extern void COM_Standard_color(int);
  55. /* Erase.c */
  56. extern void COM_Erase(void);
  57. /* Font.c */
  58. extern void COM_Set_font(const char *);
  59. extern void COM_Set_encoding(const char *);
  60. extern void COM_Font_list(char ***, int *);
  61. extern void COM_Font_info(char ***, int *);
  62. /* Get_t_box.c */
  63. extern void COM_Get_text_box(const char *, double *, double *, double *, double *);
  64. /* Graph.c */
  65. extern int COM_Graph_set(void);
  66. extern void COM_Graph_close(void);
  67. /* Line_width.c */
  68. extern void COM_Line_width(double);
  69. /* Move.c */
  70. extern void COM_Pos_abs(double, double);
  71. /* Raster.c */
  72. extern void COM_begin_raster(int, int[2][2], double[2][2]);
  73. extern int COM_raster(int, int, const unsigned char *,
  74. const unsigned char *, const unsigned char *,
  75. const unsigned char *);
  76. extern void COM_end_raster(void);
  77. /* Set_window.c */
  78. extern void COM_Set_window(double, double, double, double);
  79. extern void COM_Get_window(double *, double *, double *, double *);
  80. /* Text.c */
  81. extern void COM_Text(const char *);
  82. /* Text_size.c */
  83. extern void COM_Text_size(double, double);
  84. extern void COM_Text_rotation(double);
  85. /* Driver Operations */
  86. /* Draw.c */
  87. extern void COM_Bitmap(int, int, int, const unsigned char *);
  88. extern void COM_Begin(void);
  89. extern void COM_Move(double, double);
  90. extern void COM_Cont(double, double);
  91. extern void COM_Close(void);
  92. extern void COM_Stroke(void);
  93. extern void COM_Fill(void);
  94. extern void COM_Point(double, double);
  95. #endif /* _DRIVER_H */