themes: Workaround for bug where a background color of RGB 0,0,0 in Black color schem...
[ntk.git] / src / Fl_Cairo.cxx
blob6a99cdc04022c1c0979eeb40719ed8b7016bf21b
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.
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.
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.
23 // Please report all bugs and problems on the following page:
25 // http://www.fltk.org/str.php
28 #include <config.h>
30 #include <FL/Fl.H>
31 #include <FL/x.H>
32 #include <FL/Fl_Window.H>
33 #ifdef __APPLE__
34 #include <Carbon/Carbon.h>
35 #endif
37 /*
38 Creates transparently a cairo_surface_t object.
39 gc is an HDC context in WIN32, a CGContext* in Quartz, a display on X11
41 cairo_surface_t * cairo_create_surface(void * gc, Window w, int W, int H) {
42 # if defined(USE_X11)
43 return cairo_xlib_surface_create(fl_display, w, fl_visual->visual, W, H);
44 # elif defined(WIN32)
45 return cairo_win32_surface_create((HDC) gc);
46 # elif defined(__APPLE_QUARTZ__)
47 return cairo_quartz_surface_create_for_cg_context((CGContext*) gc, W, H);
48 # else
49 # error Cairo is not supported under this platform.
50 # endif
53 cairo_t *fl_cairo_context;
55 cairo_surface_t *
56 Fl::cairo_create_surface ( Window xid, int W, int H )
58 return ::cairo_create_surface( fl_gc, xid, W, H );
61 cairo_t *
62 Fl::cairo_make_current( cairo_t *cc )
64 fl_cairo_context = cc;
66 return cc;
70 // End of "$Id: Fl_Cairo.cxx 8198 2011-01-06 10:24:58Z manolo $" .