|
Packit |
908522 |
/* Copyright (C) 2005 The cairomm Development Team
|
|
Packit |
908522 |
*
|
|
Packit |
908522 |
* This library is free software; you can redistribute it and/or
|
|
Packit |
908522 |
* modify it under the terms of the GNU Library General Public
|
|
Packit |
908522 |
* License as published by the Free Software Foundation; either
|
|
Packit |
908522 |
* version 2 of the License, or (at your option) any later version.
|
|
Packit |
908522 |
*
|
|
Packit |
908522 |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
908522 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
908522 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
908522 |
* Library General Public License for more details.
|
|
Packit |
908522 |
*
|
|
Packit |
908522 |
* You should have received a copy of the GNU Library General Public
|
|
Packit |
908522 |
* License along with this library; if not, write to the Free Software
|
|
Packit |
908522 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
Packit |
908522 |
* 02110-1301, USA.
|
|
Packit |
908522 |
*/
|
|
Packit |
908522 |
|
|
Packit |
908522 |
#include <cairomm/win32_surface.h>
|
|
Packit |
908522 |
#include <cairomm/private.h>
|
|
Packit |
908522 |
|
|
Packit |
908522 |
namespace Cairo
|
|
Packit |
908522 |
{
|
|
Packit |
908522 |
|
|
Packit |
908522 |
#ifdef CAIRO_HAS_WIN32_SURFACE
|
|
Packit |
908522 |
|
|
Packit |
908522 |
Win32Surface::Win32Surface(cairo_surface_t* cobject, bool has_reference) :
|
|
Packit |
908522 |
Surface(cobject, has_reference)
|
|
Packit |
908522 |
{}
|
|
Packit |
908522 |
|
|
Packit |
908522 |
Win32Surface::~Win32Surface()
|
|
Packit |
908522 |
{
|
|
Packit |
908522 |
// surface is destroyed in base class
|
|
Packit |
908522 |
}
|
|
Packit |
908522 |
|
|
Packit |
908522 |
HDC Win32Surface::get_dc() const
|
|
Packit |
908522 |
{
|
|
Packit |
908522 |
return cairo_win32_surface_get_dc(m_cobject);
|
|
Packit |
908522 |
}
|
|
Packit |
908522 |
|
|
Packit |
908522 |
RefPtr<ImageSurface> Win32Surface::get_image()
|
|
Packit |
908522 |
{
|
|
Packit |
908522 |
RefPtr<ImageSurface> surface(new ImageSurface(cairo_win32_surface_get_image(cobj()),
|
|
Packit |
908522 |
false /* no reference, owned by this win32surface*/));
|
|
Packit |
908522 |
check_object_status_and_throw_exception(*this);
|
|
Packit |
908522 |
return surface;
|
|
Packit |
908522 |
}
|
|
Packit |
908522 |
|
|
Packit |
908522 |
RefPtr<Win32Surface> Win32Surface::create(HDC hdc)
|
|
Packit |
908522 |
{
|
|
Packit |
908522 |
auto cobject = cairo_win32_surface_create(hdc);
|
|
Packit |
908522 |
check_status_and_throw_exception(cairo_surface_status(cobject));
|
|
Packit |
908522 |
return RefPtr<Win32Surface>(new Win32Surface(cobject, true /* has reference */));
|
|
Packit |
908522 |
}
|
|
Packit |
908522 |
|
|
Packit |
908522 |
RefPtr<Win32Surface> Win32Surface::create(Format format, int width, int height)
|
|
Packit |
908522 |
{
|
|
Packit |
908522 |
return create_with_dib(format, width, height);
|
|
Packit |
908522 |
}
|
|
Packit |
908522 |
|
|
Packit |
908522 |
RefPtr<Win32Surface> Win32Surface::create_with_dib(Format format, int width, int height)
|
|
Packit |
908522 |
{
|
|
Packit |
908522 |
auto cobject = cairo_win32_surface_create_with_dib((cairo_format_t)format, width, height);
|
|
Packit |
908522 |
check_status_and_throw_exception(cairo_surface_status(cobject));
|
|
Packit |
908522 |
return RefPtr<Win32Surface>(new Win32Surface(cobject, true /* has reference */));
|
|
Packit |
908522 |
}
|
|
Packit |
908522 |
|
|
Packit |
908522 |
RefPtr<Win32Surface> Win32Surface::create_with_ddb(HDC hdc, Format format, int width, int height)
|
|
Packit |
908522 |
{
|
|
Packit |
908522 |
auto cobject =
|
|
Packit |
908522 |
cairo_win32_surface_create_with_ddb(hdc, (cairo_format_t)format, width, height);
|
|
Packit |
908522 |
check_status_and_throw_exception(cairo_surface_status(cobject));
|
|
Packit |
908522 |
return RefPtr<Win32Surface>(new Win32Surface(cobject, true /* has reference */));
|
|
Packit |
908522 |
}
|
|
Packit |
908522 |
|
|
Packit |
908522 |
Win32PrintingSurface::Win32PrintingSurface(cairo_surface_t* cobject, bool has_reference)
|
|
Packit |
908522 |
: Surface(cobject, has_reference)
|
|
Packit |
908522 |
{
|
|
Packit |
908522 |
}
|
|
Packit |
908522 |
|
|
Packit |
908522 |
Win32PrintingSurface::~Win32PrintingSurface()
|
|
Packit |
908522 |
{
|
|
Packit |
908522 |
// surface is destroyed in base class
|
|
Packit |
908522 |
}
|
|
Packit |
908522 |
|
|
Packit |
908522 |
RefPtr<Win32PrintingSurface> Win32PrintingSurface::create(HDC hdc)
|
|
Packit |
908522 |
{
|
|
Packit |
908522 |
auto cobject = cairo_win32_surface_create(hdc);
|
|
Packit |
908522 |
check_status_and_throw_exception(cairo_surface_status(cobject));
|
|
Packit |
908522 |
return RefPtr<Win32PrintingSurface>(new Win32PrintingSurface(cobject, true /* has reference */));
|
|
Packit |
908522 |
}
|
|
Packit |
908522 |
|
|
Packit |
908522 |
#endif // CAIRO_HAS_WIN32_SURFACE
|
|
Packit |
908522 |
|
|
Packit |
908522 |
} //namespace Cairo
|
|
Packit |
908522 |
|
|
Packit |
908522 |
// vim: ts=2 sw=2 et
|