|
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/path.h>
|
|
Packit |
908522 |
#include <cairomm/private.h>
|
|
Packit |
908522 |
#include <iostream>
|
|
Packit |
908522 |
|
|
Packit |
908522 |
namespace Cairo
|
|
Packit |
908522 |
{
|
|
Packit |
908522 |
|
|
Packit |
908522 |
/*
|
|
Packit |
908522 |
Path::Path()
|
|
Packit |
908522 |
: m_cobject(nullptr)
|
|
Packit |
908522 |
{
|
|
Packit |
908522 |
m_cobject = cairo_path_create();
|
|
Packit |
908522 |
}
|
|
Packit |
908522 |
*/
|
|
Packit |
908522 |
|
|
Packit |
908522 |
Path::Path(cairo_path_t* cobject, bool take_ownership)
|
|
Packit |
908522 |
: m_cobject(nullptr)
|
|
Packit |
908522 |
{
|
|
Packit |
908522 |
if(take_ownership)
|
|
Packit |
908522 |
m_cobject = cobject;
|
|
Packit |
908522 |
else
|
|
Packit |
908522 |
{
|
|
Packit |
908522 |
std::cerr << "cairomm: Path::Path(): copying of the underlying cairo_path_t* is not yet implemented." << std::endl;
|
|
Packit |
908522 |
//m_cobject = cairo_path_copy(cobject);
|
|
Packit |
908522 |
}
|
|
Packit |
908522 |
}
|
|
Packit |
908522 |
|
|
Packit |
908522 |
/*
|
|
Packit |
908522 |
Path::Path(const Path& src)
|
|
Packit |
908522 |
{
|
|
Packit |
908522 |
//Reference-counting, instead of copying by value:
|
|
Packit |
908522 |
if(!src.m_cobject)
|
|
Packit |
908522 |
m_cobject = nullptr;
|
|
Packit |
908522 |
else
|
|
Packit |
908522 |
m_cobject = cairo_path_copy(src.m_cobject);
|
|
Packit |
908522 |
}
|
|
Packit |
908522 |
*/
|
|
Packit |
908522 |
|
|
Packit |
908522 |
Path::~Path()
|
|
Packit |
908522 |
{
|
|
Packit |
908522 |
if(m_cobject)
|
|
Packit |
908522 |
cairo_path_destroy(m_cobject);
|
|
Packit |
908522 |
}
|
|
Packit |
908522 |
|
|
Packit |
908522 |
/*
|
|
Packit |
908522 |
Path& Path::operator=(const Path& src)
|
|
Packit |
908522 |
{
|
|
Packit |
908522 |
//Reference-counting, instead of copying by value:
|
|
Packit |
908522 |
|
|
Packit |
908522 |
if(this == &src)
|
|
Packit |
908522 |
return *this;
|
|
Packit |
908522 |
|
|
Packit |
908522 |
if(m_cobject == src.m_cobject)
|
|
Packit |
908522 |
return *this;
|
|
Packit |
908522 |
|
|
Packit |
908522 |
if(m_cobject)
|
|
Packit |
908522 |
{
|
|
Packit |
908522 |
cairo_path_destroy(m_cobject);
|
|
Packit |
908522 |
m_cobject = nullptr;
|
|
Packit |
908522 |
}
|
|
Packit |
908522 |
|
|
Packit |
908522 |
if(!src.m_cobject)
|
|
Packit |
908522 |
return *this;
|
|
Packit |
908522 |
|
|
Packit |
908522 |
m_cobject = cairo_path_copy(src.m_cobject);
|
|
Packit |
908522 |
|
|
Packit |
908522 |
return *this;
|
|
Packit |
908522 |
}
|
|
Packit |
908522 |
*/
|
|
Packit |
908522 |
|
|
Packit |
908522 |
/*
|
|
Packit |
908522 |
bool Path::operator==(const Path& src) const
|
|
Packit |
908522 |
{
|
|
Packit |
908522 |
return cairo_path_equal(m_cobject, src.cobj());
|
|
Packit |
908522 |
}
|
|
Packit |
908522 |
*/
|
|
Packit |
908522 |
|
|
Packit |
908522 |
} //namespace Cairo
|
|
Packit |
908522 |
|
|
Packit |
908522 |
// vim: ts=2 sw=2 et
|