Mirror of Awesome WM window manager
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

draw.h 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * draw.h - draw functions header
  3. *
  4. * Copyright © 2007-2009 Julien Danjou <julien@danjou.info>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program; if not, write to the Free Software Foundation, Inc.,
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  19. *
  20. */
  21. #ifndef AWESOME_COMMON_DRAW_H
  22. #define AWESOME_COMMON_DRAW_H
  23. #include <xcb/xcb.h>
  24. #include <cairo.h>
  25. #include <lua.h>
  26. #include <glib.h> /* for GError */
  27. #include "common/array.h"
  28. #include "common/util.h"
  29. /* Forward definition */
  30. typedef struct _GdkPixbuf GdkPixbuf;
  31. typedef struct area_t area_t;
  32. struct area_t
  33. {
  34. /** Co-ords of upper left corner */
  35. int16_t x;
  36. int16_t y;
  37. uint16_t width;
  38. uint16_t height;
  39. };
  40. #define AREA_LEFT(a) ((a).x)
  41. #define AREA_TOP(a) ((a).y)
  42. #define AREA_RIGHT(a) ((a).x + (a).width)
  43. #define AREA_BOTTOM(a) ((a).y + (a).height)
  44. #define AREA_EQUAL(a, b) ((a).x == (b).x && (a).y == (b).y && \
  45. (a).width == (b).width && (a).height == (b).height)
  46. static inline void
  47. cairo_surface_array_destroy_surface(cairo_surface_t **s)
  48. {
  49. cairo_surface_destroy(*s);
  50. }
  51. DO_ARRAY(cairo_surface_t *, cairo_surface, cairo_surface_array_destroy_surface)
  52. cairo_surface_t *draw_surface_from_data(int width, int height, uint32_t *data);
  53. cairo_surface_t *draw_dup_image_surface(cairo_surface_t *surface);
  54. cairo_surface_t *draw_load_image(lua_State *L, const char *path, GError **error);
  55. cairo_surface_t *draw_surface_from_pixbuf(GdkPixbuf *buf);
  56. xcb_visualtype_t *draw_find_visual(const xcb_screen_t *s, xcb_visualid_t visual);
  57. xcb_visualtype_t *draw_default_visual(const xcb_screen_t *s);
  58. xcb_visualtype_t *draw_argb_visual(const xcb_screen_t *s);
  59. uint8_t draw_visual_depth(const xcb_screen_t *s, xcb_visualid_t vis);
  60. void draw_test_cairo_xcb(void);
  61. #endif
  62. // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80