29 #ifndef vtkPixelExtent_h
30 #define vtkPixelExtent_h
53 { this->SetData(T(0), width-T(1), T(0), height-T(1)); }
62 const int &
operator[](
int i)
const {
return this->Data[i]; }
69 void SetData(
const T *ext);
72 void SetData(T ilo, T ihi, T jlo, T jhi);
78 const int *
GetData()
const {
return this->Data; }
82 void GetData(T
data[4])
const;
85 {
return reinterpret_cast<unsigned int*
>(this->Data); }
88 {
return reinterpret_cast<const unsigned int*
>(this->Data); }
92 void GetStartIndex(
int first[2])
const;
93 void GetStartIndex(
int first[2],
const int origin[2])
const;
94 void GetEndIndex(
int last[2])
const;
106 int Contains(
int i,
int j)
const;
115 void Size(T nCells[2])
const;
133 void Grow(
int q,
int n);
134 void GrowLow(
int q,
int n);
135 void GrowHigh(
int q,
int n);
141 void Shrink(
int q,
int n);
154 void Shift(
int q,
int n);
227 static void Shift(
int *ij,
int n);
228 static void Shift(
int *ij,
int *n);
239 std::deque<vtkPixelExtent> &newExts);
245 static void Subtract(
248 std::deque<vtkPixelExtent> &newExts);
254 static void Merge(std::deque<vtkPixelExtent> &exts);
270 Data[0] =
static_cast<int>(ext[0]);
271 Data[1] =
static_cast<int>(ext[1]);
272 Data[2] =
static_cast<int>(ext[2]);
273 Data[3] =
static_cast<int>(ext[3]);
280 T ext[4] = {ilo, ihi, jlo, jhi};
295 data[0] =
static_cast<T
>(this->Data[0]);
296 data[1] =
static_cast<T
>(this->Data[1]);
297 data[2] =
static_cast<T
>(this->Data[2]);
298 data[3] =
static_cast<T
>(this->Data[3]);
305 this->SetData<int>(INT_MAX, INT_MIN, INT_MAX, INT_MIN);
330 this->
SetData(ilo, ihi, jlo, jhi);
356 nCells[0] = ext[1] - ext[0] + 1;
357 nCells[1] = ext[3] - ext[2] + 1;
364 return (ext[1] - ext[0] + 1) * (ext[3] - ext[2] + 1);
385 first[0] = this->Data[0];
386 first[1] = this->Data[2];
393 first[0] = this->Data[0] - origin[0];
394 first[1] = this->Data[2] - origin[1];
401 last[0] = this->Data[1];
402 last[1] = this->Data[3];
409 if ( this->Data[0] > this->Data[1]
410 || this->Data[2] > this->Data[3])
421 if ( (this->Data[0] == other.Data[0])
422 && (this->Data[1] == other.Data[1])
423 && (this->Data[2] == other.Data[2])
424 && (this->Data[3] == other.Data[3]) )
435 if ( (this->Data[0] <= other.Data[0])
436 && (this->Data[1] >= other.Data[1])
437 && (this->Data[2] <= other.Data[2])
438 && (this->Data[3] >= other.Data[3]) )
449 if ( (this->Data[0] <= i)
450 && (this->Data[1] >= i)
451 && (this->Data[2] <= j)
452 && (this->Data[3] >= j) )
475 this->Data[0] =
std::max(this->Data[0], other.Data[0]);
476 this->Data[1] = std::min(this->Data[1], other.Data[1]);
477 this->Data[2] =
std::max(this->Data[2], other.Data[2]);
478 this->Data[3] = std::min(this->Data[3], other.Data[3]);
501 this->Data[0] = std::min(this->Data[0], other.Data[0]);
502 this->Data[1] =
std::max(this->Data[1], other.Data[1]);
503 this->Data[2] = std::min(this->Data[2], other.Data[2]);
504 this->Data[3] =
std::max(this->Data[3], other.Data[3]);
512 return other.
Empty();
532 this->Data[q+1] += n;
539 this->Data[2*
q] -= n;
546 this->Data[2*q+1] += n;
565 this->Data[q+1] -= n;
572 this->Data[0] += n[0];
573 this->Data[1] += n[0];
574 this->Data[2] += n[1];
575 this->Data[3] += n[1];
584 this->Data[q+1] += n;
591 for (
int q=0;
q<2; ++
q)
596 this->Data[qq ] += n;
597 this->Data[qq+1] += n;
605 for (
int q=0;
q<2; ++
q)
608 int n =- this->Data[qq];
610 this->Data[qq ] += n;
611 this->Data[qq+1] += n;
622 int l = this->Data[q+1] - this->Data[
q] + 1;
630 this->Data[q+1] = s - 1;
void GetStartIndex(int first[2]) const
int Disjoint(vtkPixelExtent other) const
const unsigned int * GetDataU() const
vtkPixelExtent(T width, T height)
int Contains(const vtkPixelExtent &other) const
void GrowLow(int q, int n)
int operator==(const vtkPixelExtent &other) const
const int & operator[](int i) const
bool operator<(const vtkPixelExtent &l, const vtkPixelExtent &r)
vtkPixelExtent & operator=(const vtkPixelExtent &other)
vtkPixelExtent Split(int dir)
void operator|=(const vtkPixelExtent &other)
VTKCOMMONDATAMODEL_EXPORT std::ostream & operator<<(std::ostream &os, const vtkPixelExtent &ext)
void GrowHigh(int q, int n)
void SetData(const vtkPixelExtent &ext)
void operator&=(const vtkPixelExtent &other)
void GetEndIndex(int last[2]) const
VTKCOMMONCORE_EXPORT bool operator==(const vtkUnicodeString &lhs, const vtkUnicodeString &rhs)
VTKWRAPPINGJAVA_EXPORT jlong q(JNIEnv *env, jobject obj)
void Size(T nCells[2]) const
const int * GetData() const
#define VTKCOMMONDATAMODEL_EXPORT
unsigned int * GetDataU()