1 /* Copyright (C) 2005 The cairomm Development Team
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Library General Public
5 * License as published by the Free Software Foundation; either
6 * version 2 of the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Library General Public License for more details.
13 * You should have received a copy of the GNU Library General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 #include <cairomm/win32_surface.h>
20 #include <cairomm/private.h>
25 #ifdef CAIRO_HAS_WIN32_SURFACE
27 Win32Surface::Win32Surface(cairo_surface_t* cobject, bool has_reference) :
28 Surface(cobject, has_reference)
31 Win32Surface::~Win32Surface()
33 // surface is destroyed in base class
36 HDC Win32Surface::get_dc() const
38 return cairo_win32_surface_get_dc(m_cobject);
41 RefPtr<Win32Surface> Win32Surface::create(HDC hdc)
43 cairo_surface_t* cobject = cairo_win32_surface_create(hdc);
44 check_status_and_throw_exception(cairo_surface_status(cobject));
45 return RefPtr<Win32Surface>(new Win32Surface(cobject, true /* has reference */));
48 RefPtr<Win32Surface> Win32Surface::create(Format format, int width, int height)
50 cairo_surface_t* cobject = cairo_win32_surface_create_with_dib((cairo_format_t)format, width, height);
51 check_status_and_throw_exception(cairo_surface_status(cobject));
52 return RefPtr<Win32Surface>(new Win32Surface(cobject, true /* has reference */));
55 #endif // CAIRO_HAS_WIN32_SURFACE