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.

72 lines
2.0KB

  1. //
  2. // "$Id: Fl_Cairo.cxx 8198 2011-01-06 10:24:58Z manolo $"
  3. //
  4. // Main header file for the Fast Light Tool Kit (FLTK).
  5. //
  6. // Copyright 1998-2010 by Bill Spitzak and others.
  7. //
  8. // This library is free software; you can redistribute it and/or
  9. // modify it under the terms of the GNU Library General Public
  10. // License as published by the Free Software Foundation; either
  11. // version 2 of the License, or (at your option) any later version.
  12. //
  13. // This library is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. // Library General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Library General Public
  19. // License along with this library; if not, write to the Free Software
  20. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  21. // USA.
  22. //
  23. // Please report all bugs and problems on the following page:
  24. //
  25. // http://www.fltk.org/str.php
  26. //
  27. #include <config.h>
  28. #include <FL/Fl.H>
  29. #include <FL/x.H>
  30. #include <FL/Fl_Window.H>
  31. #ifdef __APPLE__
  32. #include <Carbon/Carbon.h>
  33. #endif
  34. /*
  35. Creates transparently a cairo_surface_t object.
  36. gc is an HDC context in WIN32, a CGContext* in Quartz, a display on X11
  37. */
  38. cairo_surface_t * cairo_create_surface(void * gc, Window w, int W, int H) {
  39. # if defined(USE_X11)
  40. return cairo_xlib_surface_create(fl_display, w, fl_visual->visual, W, H);
  41. # elif defined(WIN32)
  42. return cairo_win32_surface_create((HDC) gc);
  43. # elif defined(__APPLE_QUARTZ__)
  44. return cairo_quartz_surface_create_for_cg_context((CGContext*) gc, W, H);
  45. # else
  46. # error Cairo is not supported under this platform.
  47. # endif
  48. }
  49. cairo_t *fl_cairo_context;
  50. cairo_surface_t *
  51. Fl::cairo_create_surface ( Window xid, int W, int H )
  52. {
  53. return ::cairo_create_surface( fl_gc, xid, W, H );
  54. }
  55. cairo_t *
  56. Fl::cairo_make_current( cairo_t *cc )
  57. {
  58. fl_cairo_context = cc;
  59. return cc;
  60. }
  61. //
  62. // End of "$Id: Fl_Cairo.cxx 8198 2011-01-06 10:24:58Z manolo $" .
  63. //