43 bool IsValid()
const {
return this->w >= 0 && this->h >= 0; }
51 if (is.
w <= 0 || is.
h <= 0)
77 int x1 = (std::max)(a.
x, b.
x);
78 int x2 = (std::min)(a.
x + a.
w, b.
x + b.
w);
79 int y1 = (std::max)(a.
y, b.
y);
80 int y2 = (std::min)(a.
y + a.
h, b.
y + b.
h);
81 if (x2 >= x1&& y2 >= y1)
83 return IntRect{ x1, y1, x2 - x1, y2 - y1 };
194 virtual void Unlock() = 0;
251 template <
typename tBitmap>
263 auto lockInfo = bmData->Lock();
264 this->
ptrData = lockInfo.ptrData;
266 this->
stride = lockInfo.stride;
267 this->
size = lockInfo.size;
274 auto lockInfo = other.bmData->Lock();
275 this->
ptrData = lockInfo.ptrData;
277 this->
stride = lockInfo.stride;
278 this->
size = lockInfo.size;
284 *
this = std::move(other);
294 this->bmData->Unlock();
297 this->bmData = std::move(other.bmData);
300 this->
stride = other.stride;
301 this->
size = other.size;
302 other.ptrData = other.ptrDataRoi =
nullptr;
303 other.bmData = tBitmap();
313 this->bmData->Unlock();
332 os <<
"(" << rect.
x <<
"," << rect.
y <<
"," << rect.
w <<
"," << rect.
h <<
")";
342 os <<
"(" << size.
w <<
"," << size.
h <<
")";
PixelType
An enum representing a pixel-type.
Definition: libCZI_Pixels.h:126
A rectangle (with double coordinates).
Definition: libCZI_Pixels.h:91
Definition: libCZI_Pixels.h:166
CompressionMode
An enum specifying the compression method.
Definition: libCZI_Pixels.h:143
BGR-color 4 byte float triples (memory order B, G, R).
void * ptrData
Not currently used, to be ignored.
Definition: libCZI_Pixels.h:154
Definition: libCZI_Pixels.h:252
Currently not supported in libCZI.
virtual PixelType GetPixelType() const =0
Information about a locked bitmap - allowing direct access to the image data in memory.
Definition: libCZI_Pixels.h:152
std::uint32_t GetWidth() const
Definition: libCZI_Pixels.h:199
The data is JPG-XR-compressed.
std::ostream & operator<<(std::ostream &os, const IntRect &rect)
Definition: libCZI_Pixels.h:330
int w
The width of the rectangle.
Definition: libCZI_Pixels.h:36
BGR-color 16-bytes triples (memory order B, G, R).
std::uint32_t h
The height.
Definition: libCZI_Pixels.h:106
int h
The height of the rectangle.
Definition: libCZI_Pixels.h:37
double y
The y-coordinate of the upper-left point of the rectangle.
Definition: libCZI_Pixels.h:94
Currently not supported in libCZI.
std::uint64_t size
The size of the bitmap data (pointed to by ptrDataRoi) in bytes.
Definition: libCZI_Pixels.h:157
std::uint8_t b
The blue component.
Definition: libCZI_Pixels.h:114
ScopedBitmapLocker(tBitmap bmData)
Definition: libCZI_Pixels.h:261
bool IntersectsWith(const IntRect &r) const
Definition: libCZI_Pixels.h:48
A structure representing an R-G-B-color triple (as bytes).
Definition: libCZI_Pixels.h:110
The data is uncompressed.
std::uint32_t stride
The stride of the bitmap data (pointed to by ptrDataRoi).
Definition: libCZI_Pixels.h:156
float r
The red component.
Definition: libCZI_Pixels.h:120
Currently not supported in libCZI.
ScopedBitmapLocker< tBitmap > & operator=(ScopedBitmapLocker< tBitmap > &&other) noexcept
move assignment
Definition: libCZI_Pixels.h:288
static IntRect Intersect(const IntRect &a, const IntRect &b)
Definition: libCZI_Pixels.h:75
double h
The height of the rectangle.
Definition: libCZI_Pixels.h:96
BGR-color 8-bytes triples (memory order B, G, R).
Grayscale 16-bit unsinged.
Grayscale 8-bit unsinged.
double x
The x-coordinate of the upper-left point of the rectangle.
Definition: libCZI_Pixels.h:93
std::uint8_t r
The red component.
Definition: libCZI_Pixels.h:112
ScopedBitmapLocker(ScopedBitmapLocker< tBitmap > &&other) noexcept
move constructor
Definition: libCZI_Pixels.h:282
virtual BitmapLockInfo Lock()=0
float g
The green component.
Definition: libCZI_Pixels.h:121
ScopedBitmapLocker(const ScopedBitmapLocker< tBitmap > &other)
Definition: libCZI_Pixels.h:272
void Invalidate()
Invalidates this object.
Definition: libCZI_Pixels.h:40
std::uint32_t GetHeight() const
Definition: libCZI_Pixels.h:204
A rectangle (with integer coordinates).
Definition: libCZI_Pixels.h:32
A structure representing an R-G-B-color triple (as floats).
Definition: libCZI_Pixels.h:118
virtual IntSize GetSize() const =0
std::uint8_t g
The green component.
Definition: libCZI_Pixels.h:113
External interfaces, classes, functions and structs are found in the namespace "libCZI".
Definition: libCZI.h:44
int y
The y-coordinate of the upper-left point of the rectangle.
Definition: libCZI_Pixels.h:35
double w
The width of the rectangle.
Definition: libCZI_Pixels.h:95
ScopedBitmapLocker< std::shared_ptr< IBitmapData > > ScopedBitmapLockerSP
Defines an alias representing the scoped bitmap locker for use with a shared_ptr of type libCZI::IBit...
Definition: libCZI_Pixels.h:322
float b
The blue component.
Definition: libCZI_Pixels.h:122
Currently not supported in libCZI.
The data is JPG-compressed.
A structure representing a size (width and height) in integers.
Definition: libCZI_Pixels.h:103
bool IsValid() const
Returns a boolean indicating whether this rectangle contains valid information.
Definition: libCZI_Pixels.h:43
ScopedBitmapLocker< IBitmapData * > ScopedBitmapLockerP
Defines an alias representing the scoped bitmap locker for use with libCZI::IBitmapData.
Definition: libCZI_Pixels.h:319
void Invalidate()
Invalidates this object.
Definition: libCZI_Pixels.h:99
int x
The x-coordinate of the upper-left point of the rectangle.
Definition: libCZI_Pixels.h:34
Currently not supported in libCZI.
void * ptrDataRoi
The pointer to the first (top-left) pixel of the bitmap.
Definition: libCZI_Pixels.h:155
IntRect Intersect(const IntRect &r) const
Definition: libCZI_Pixels.h:64
std::uint32_t w
The width.
Definition: libCZI_Pixels.h:105