1 /* Copyright (C) 2007 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/quartz_surface.h>
20 #include <cairomm/private.h>
25 #ifdef CAIRO_HAS_QUARTZ_SURFACE
27 QuartzSurface::QuartzSurface(cairo_surface_t* cobject, bool has_reference) :
28 Surface(cobject, has_reference)
31 QuartzSurface::~QuartzSurface()
33 // surface is destroyed in base class
36 CGContextRef QuartzSurface::get_cg_context() const
38 return cairo_quartz_surface_get_cg_context(m_cobject);
41 RefPtr<QuartzSurface> QuartzSurface::create(CGContextRef cg_context, int width, int height)
43 cairo_surface_t* cobject = cairo_quartz_surface_create_for_cg_context(cg_context,
45 check_status_and_throw_exception(cairo_surface_status(cobject));
46 return RefPtr<QuartzSurface>(new QuartzSurface(cobject, true /* has reference */));
49 RefPtr<QuartzSurface> QuartzSurface::create(Format format, int width, int height)
51 cairo_surface_t* cobject = cairo_quartz_surface_create((cairo_format_t)format, width, height);
52 check_status_and_throw_exception(cairo_surface_status(cobject));
53 return RefPtr<QuartzSurface>(new QuartzSurface(cobject, true /* has reference */));
56 #endif // CAIRO_HAS_QUARTZ_SURFACE