34#include <drain/UniTuple.h>
36#include "drain/util/Frame.h"
51 ChannelGeometry(
size_t images=1,
size_t alphas=0) : imageChannels(next()), alphaChannels(next()){
52 this->set(images, alphas);
62 imageChannels(this->next()),
63 alphaChannels(this->next()){
95 void setChannelCount(
size_t imageChannelCount,
size_t alphaChannelCount = 0){
96 this->set(imageChannelCount, alphaChannelCount);
100 void setAlphaChannelCount(
size_t a){
107 return imageChannels + alphaChannels;
114 return imageChannels;
120 return alphaChannels;
125 size_t & imageChannels;
126 size_t & alphaChannels;
157 Geometry(
size_t width=0,
size_t height=0,
size_t channels=1,
size_t alphas=0) : area(tuple(),0), channels(tuple(),2) {
158 set(width, height, channels, alphas);
173 const Geometry & getGeometry()
const {
184 void setGeometry(
const T &g){
192 void setGeometry(
const Geometry &g){
198 void setGeometry(
size_t width,
size_t height,
size_t imageChannelCount = 1,
size_t alphaChannelCount = 0){
199 set(width, height, imageChannelCount, alphaChannelCount);
203 operator const AreaGeometry &()
const {
209 size_t getWidth()
const {
210 return area.getWidth();
214 size_t getHeight()
const {
215 return area.getHeight();
226 template <
typename S,
size_t N>
228 void setArea(
const TupleBase<S,N> & a){
235 void setArea(
size_t width,
size_t height){
236 area.set(width, height);
240 size_t getArea()
const {
241 return area.getArea();
260 void setChannelCount(
size_t imageChannels,
size_t alphaChannels){
261 channels.set(imageChannels, alphaChannels);
266 channels.setChannelCount(geom);
270 const size_t getImageChannelCount()
const {
275 void setImageChannelCount(
size_t imageChannels){
276 channels.set(imageChannels);
280 const size_t getAlphaChannelCount()
const {
285 void setAlphaChannelCount(
size_t alphaChannels){
286 channels.setAlphaChannelCount(alphaChannels);
291 bool hasAlphaChannel()
const {
304 size_t getVolume()
const {
309 bool isEmpty()
const {
310 return (getVolume() == 0);
335 bool operator==(
const Geometry &g)
const {
336 return (tuple() == g.tuple());
344 bool operator!=(
const Geometry &g)
const {
345 return !((*this)==g);
Something that has width and height.
Definition Frame.h:53
tuplebase_t & assignSequence(T &sequence, bool LENIENT=false)
Proposed for tuples only; derived classes should not shadow this.
Definition TupleBase.h:287
Tuple of N elements of type T.
Definition UniTuple.h:65
size_t getAlphaChannelCount() const
Return the number of alpha channels.
Definition Geometry.h:119
size_t getImageChannelCount() const
Return the number of actual image channels (excluding alphas)
Definition Geometry.h:113
size_t getChannelCount() const
Return the number of channels (image and alpha)
Definition Geometry.h:106
Definition Geometry.h:143
size_t getChannelIndex(const std::string &index) const
Returns numeric channel index from "r", "g", "b", or "a" or a non-negative number in string format.
Definition Geometry.cpp:45
Geometry(size_t width=0, size_t height=0, size_t channels=1, size_t alphas=0)
Constructor with dimensions. Channel count is one by default, allowing construction with width and he...
Definition Geometry.h:157
size_t getChannelCount() const
Set...
Definition Geometry.h:255
Definition DataSelector.cpp:1277