Loading...
Searching...
No Matches
VRegion8.h
// VIPS region wrapper
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_VREGION_H
#define VIPS_VREGION_H
#include <vips/vips.h>
VIPS_NAMESPACE_START
class VRegion : public VObject {
public:
explicit VRegion(VipsRegion *region, VSteal steal = STEAL)
: VObject((VipsObject *) region, steal)
{
}
static VRegion
new_from_image(VImage image);
VipsRegion *
get_region() const
{
return (VipsRegion *) VObject::get_object();
}
void
prepare(const VipsRect *rect) const
{
if (vips_region_prepare(get_region(), rect))
throw VError();
}
void
prepare(int left, int top, int width, int height) const
{
VipsRect rect = { left, top, width, height };
prepare(&rect);
}
VipsRect
valid() const
{
return get_region()->valid;
}
VipsPel *
addr() const
{
return addr(0);
}
VipsPel *
addr(size_t i) const
{
return &VIPS_REGION_ADDR_TOPLEFT(get_region())[i];
}
VipsPel *
addr(int x, int y) const
{
return VIPS_REGION_ADDR(get_region(), x, y);
}
size_t
stride() const
{
return VIPS_REGION_LSKIP(get_region());
}
VipsPel
operator[](size_t i) const
{
return *addr(i);
}
VipsPel
operator()(int x, int y) const
{
return *addr(x, y);
}
};
VIPS_NAMESPACE_END
#endif /*VIPS_VREGION_H*/
VError
Definition VError8.h:45
VImage
Definition VImage8.h:398
VObject::VObject
VObject(VipsObject *new_vobject, VSteal steal=STEAL)
Definition VImage8.h:79
VObject::get_object
VipsObject * get_object() const
Definition VImage8.h:170
VRegion
Definition VRegion8.h:40
VRegion::addr
VipsPel * addr(size_t i) const
Definition VRegion8.h:110
VRegion::stride
size_t stride() const
Definition VRegion8.h:128
VRegion::valid
VipsRect valid() const
Definition VRegion8.h:92
VRegion::addr
VipsPel * addr() const
Definition VRegion8.h:101
VRegion::operator()
VipsPel operator()(int x, int y) const
Definition VRegion8.h:146
VRegion::VRegion
VRegion(VipsRegion *region, VSteal steal=STEAL)
Definition VRegion8.h:47
VRegion::prepare
void prepare(const VipsRect *rect) const
Definition VRegion8.h:71
VRegion::get_region
VipsRegion * get_region() const
Definition VRegion8.h:62
VRegion::operator[]
VipsPel operator[](size_t i) const
Definition VRegion8.h:137
VRegion::addr
VipsPel * addr(int x, int y) const
Definition VRegion8.h:119
VRegion::prepare
void prepare(int left, int top, int width, int height) const
Definition VRegion8.h:81
VRegion::new_from_image
static VRegion new_from_image(VImage image)
Definition VRegion.cpp:14