driver.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * File : driver.h
  3. * This file is part of RTGUI in RT-Thread RTOS
  4. * COPYRIGHT (C) 2006 - 2009, RT-Thread Development Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://www.rt-thread.org/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2009-10-04 Bernard first version
  13. */
  14. #ifndef __RTGUI_DRIVER_H__
  15. #define __RTGUI_DRIVER_H__
  16. #include <rtgui/list.h>
  17. #include <rtgui/color.h>
  18. struct rtgui_graphic_driver
  19. {
  20. /* driver name */
  21. char* name;
  22. /* byte per pixel */
  23. rt_uint16_t byte_per_pixel;
  24. /* screen width and height */
  25. rt_uint16_t width;
  26. rt_uint16_t height;
  27. /* screen update */
  28. void (*screen_update)(rtgui_rect_t* rect);
  29. /* get video frame buffer */
  30. rt_uint8_t* (*get_framebuffer)(void);
  31. /* set and get pixel in (x, y) */
  32. void (*set_pixel) (rtgui_color_t *c, rt_base_t x, rt_base_t y);
  33. void (*get_pixel) (rtgui_color_t *c, rt_base_t x, rt_base_t y);
  34. void (*draw_hline)(rtgui_color_t *c, rt_base_t x1, rt_base_t x2, rt_base_t y);
  35. void (*draw_vline)(rtgui_color_t *c, rt_base_t x , rt_base_t y1, rt_base_t y2);
  36. /* draw raw hline */
  37. void (*draw_raw_hline)(rt_uint8_t *pixels, rt_base_t x1, rt_base_t x2, rt_base_t y);
  38. /* the driver list */
  39. rtgui_list_t list;
  40. };
  41. #ifdef RTGUI_USING_GRAPHIC_DRIVER_LIST
  42. void rtgui_graphic_driver_add(struct rtgui_graphic_driver* driver);
  43. void rtgui_graphic_driver_remove(struct rtgui_graphic_driver* driver);
  44. struct rtgui_graphic_driver* rtgui_graphic_driver_find(char* name);
  45. #else
  46. void rtgui_graphic_driver_add(const struct rtgui_graphic_driver* driver);
  47. #endif
  48. const struct rtgui_graphic_driver* rtgui_graphic_driver_get_default(void);
  49. void rtgui_graphic_driver_get_rect(const struct rtgui_graphic_driver *driver, rtgui_rect_t *rect);
  50. void rtgui_graphic_driver_get_default_rect(rtgui_rect_t *rect);
  51. #endif