From 0112d663ff20af76cba7a4d4fe7576194d83582b Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Thu, 15 Jan 2015 14:01:05 +1100 Subject: [PATCH] region: add point/extent constructor --- region.cpp | 13 ++++++++++++- region.hpp | 4 +++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/region.cpp b/region.cpp index 1f545622..85946fb5 100644 --- a/region.cpp +++ b/region.cpp @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with libgim. If not, see . * - * Copyright 2010 Danny Robson + * Copyright 2010-2015 Danny Robson */ @@ -31,6 +31,17 @@ using namespace util; +//----------------------------------------------------------------------------- +template +region::region (util::point<2,T> _point, + util::extent _size): + x (_point.x), + y (_point.y), + w (_size.w), + h (_size.h) +{ ; } + + //----------------------------------------------------------------------------- template region::region (T _x, T _y, size_type _w, size_type _h): diff --git a/region.hpp b/region.hpp index 947ae7b2..a25df6db 100644 --- a/region.hpp +++ b/region.hpp @@ -14,13 +14,14 @@ * You should have received a copy of the GNU General Public License * along with libgim. If not, see . * - * Copyright 2010 Danny Robson + * Copyright 2010-2015 Danny Robson */ #ifndef __UTIL_REGION_HPP #define __UTIL_REGION_HPP +#include "extent.hpp" #include "point.hpp" #include "types/traits.hpp" @@ -40,6 +41,7 @@ namespace util { T x, y; size_type w, h; + region (util::point<2,T>, util::extent); region (T _x, T _y, size_type _w, size_type _h); size_type area (void) const;