34 #include <drain/UniTuple.h>
38 #include "drain/util/Frame.h"
53 ChannelGeometry(
size_t images=1,
size_t alphas=0) : imageChannels(next()), alphaChannels(next()){
54 this->set(images, alphas);
64 imageChannels(this->next()),
65 alphaChannels(this->next()){
97 void setChannelCount(
size_t imageChannelCount,
size_t alphaChannelCount = 0){
98 this->set(imageChannelCount, alphaChannelCount);
102 void setAlphaChannelCount(
size_t a){
109 return imageChannels + alphaChannels;
116 return imageChannels;
122 return alphaChannels;
127 size_t & imageChannels;
128 size_t & alphaChannels;
159 Geometry(
size_t width=0,
size_t height=0,
size_t channels=1,
size_t alphas=0) : area(tuple(),0), channels(tuple(),2) {
160 set(width, height, channels, alphas);
175 const Geometry & getGeometry()
const {
186 void setGeometry(
const T &g){
194 void setGeometry(
const Geometry &g){
200 void setGeometry(
size_t width,
size_t height,
size_t imageChannelCount = 1,
size_t alphaChannelCount = 0){
201 set(width, height, imageChannelCount, alphaChannelCount);
205 operator const AreaGeometry &()
const {
211 size_t getWidth()
const {
212 return area.getWidth();
216 size_t getHeight()
const {
217 return area.getHeight();
228 template <
typename S,
size_t N>
230 void setArea(
const TupleBase<S,N> & a){
237 void setArea(
size_t width,
size_t height){
238 area.set(width, height);
242 size_t getArea()
const {
243 return area.getArea();
262 void setChannelCount(
size_t imageChannels,
size_t alphaChannels){
263 channels.set(imageChannels, alphaChannels);
268 channels.setChannelCount(geom);
272 const size_t getImageChannelCount()
const {
277 void setImageChannelCount(
size_t imageChannels){
278 channels.set(imageChannels);
282 const size_t getAlphaChannelCount()
const {
287 void setAlphaChannelCount(
size_t alphaChannels){
288 channels.setAlphaChannelCount(alphaChannels);
293 bool hasAlphaChannel()
const {
306 size_t getVolume()
const {
311 bool isEmpty()
const {
312 return (getVolume() == 0);
337 bool operator==(
const Geometry &g)
const {
338 return (tuple() == g.tuple());
346 bool operator!=(
const Geometry &g)
const {
347 return !((*this)==g);
tuplebase_t & assignSequence(T &sequence, bool LENIENT=false)
Proposed for tuples only; derived classes should not shadow this.
Definition: TupleBase.h:244
Tuple of N elements of type T.
Definition: UniTuple.h:65
Definition: Geometry.h:49
size_t getAlphaChannelCount() const
Return the number of alpha channels.
Definition: Geometry.h:121
size_t getImageChannelCount() const
Return the number of actual image channels (excluding alphas)
Definition: Geometry.h:115
size_t getChannelCount() const
Return the number of channels (image and alpha)
Definition: Geometry.h:108
Definition: Geometry.h:145
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:159
size_t getChannelCount() const
Set...
Definition: Geometry.h:257
Definition: DataSelector.cpp:1277