diff --git a/Makefile.am b/Makefile.am index 81b6efc7..077457e3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -96,6 +96,7 @@ UTIL_FILES = \ hash/wang.ipp \ image.cpp \ image.hpp \ + image.ipp \ introspection.cpp \ introspection.hpp \ io.cpp \ diff --git a/image.hpp b/image.hpp index 961df0d9..a16403a9 100644 --- a/image.hpp +++ b/image.hpp @@ -48,6 +48,9 @@ namespace util { namespace image { buffer downsample (float factor) const; + constexpr size_t area (void) const; + constexpr bool is_packed (void) const; + size_t w; size_t h; size_t s; @@ -71,4 +74,6 @@ namespace util { namespace image { }; } } +#include "image.ipp" + #endif diff --git a/image.ipp b/image.ipp new file mode 100644 index 00000000..64cbb961 --- /dev/null +++ b/image.ipp @@ -0,0 +1,38 @@ +/* + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Copyright 2011-2015 Danny Robson + */ + +#ifdef __UTIL_IMAGE_IPP +#error +#endif +#define __UTIL_IMAGE_IPP + +namespace util { namespace image { + //------------------------------------------------------------------------- + template + constexpr size_t + buffer::area (void) const + { + return w * h; + } + + //------------------------------------------------------------------------- + template + constexpr bool + buffer::is_packed (void) const + { + return s == w; + } +} }