44 bool IsValid()
const {
return this->w >= 0 && this->h >= 0; }
52 if (is.
w <= 0 || is.
h <= 0)
78 int x1 = (std::max)(a.
x, b.
x);
79 int x2 = (std::min)(a.
x + a.
w, b.
x + b.
w);
80 int y1 = (std::max)(a.
y, b.
y);
81 int y2 = (std::min)(a.
y + a.
h, b.
y + b.
h);
82 if (x2 >= x1&& y2 >= y1)
84 return IntRect{ x1, y1, x2 - x1, y2 - y1 };
174 virtual PixelType GetPixelType()
const = 0;
179 virtual IntSize GetSize()
const = 0;
195 virtual void Unlock() = 0;
202 std::uint32_t
GetWidth()
const {
return this->GetSize().w; }
207 std::uint32_t
GetHeight()
const {
return this->GetSize().h; }
254 template <
typename tBitmap>
266 auto lockInfo = bmData->Lock();
267 this->ptrData = lockInfo.ptrData;
268 this->ptrDataRoi = lockInfo.ptrDataRoi;
269 this->stride = lockInfo.stride;
270 this->size = lockInfo.size;
277 auto lockInfo = other.bmData->Lock();
278 this->ptrData = lockInfo.ptrData;
279 this->ptrDataRoi = lockInfo.ptrDataRoi;
280 this->stride = lockInfo.stride;
281 this->size = lockInfo.size;
287 *
this = std::move(other);
297 this->bmData->Unlock();
300 this->bmData = std::move(other.bmData);
301 this->ptrData = other.ptrData;
302 this->ptrDataRoi = other.ptrDataRoi;
303 this->stride = other.stride;
304 this->size = other.size;
305 other.ptrData = other.ptrDataRoi =
nullptr;
306 other.bmData = tBitmap();
316 this->bmData->Unlock();
335 os <<
"(" << rect.
x <<
"," << rect.
y <<
"," << rect.
w <<
"," << rect.
h <<
")";
345 os <<
"(" << size.
w <<
"," << size.
h <<
")";
PixelType
An enum representing a pixel-type.
Definition: libCZI_Pixels.h:127
A rectangle (with double coordinates).
Definition: libCZI_Pixels.h:92
Definition: libCZI_Pixels.h:167
CompressionMode
An enum specifying the compression method.
Definition: libCZI_Pixels.h:144
BGR-color 4 byte float triples (memory order B, G, R).
void * ptrData
Not currently used, to be ignored.
Definition: libCZI_Pixels.h:155
Definition: libCZI_Pixels.h:255
Currently not supported in libCZI.
Information about a locked bitmap - allowing direct access to the image data in memory.
Definition: libCZI_Pixels.h:153
std::uint32_t GetWidth() const
Definition: libCZI_Pixels.h:202
The data is JPG-XR-compressed.
std::ostream & operator<<(std::ostream &os, const IntRect &rect)
Definition: libCZI_Pixels.h:333
int w
The width of the rectangle.
Definition: libCZI_Pixels.h:37
BGR-color 16-bytes triples (memory order B, G, R).
std::uint32_t h
The height.
Definition: libCZI_Pixels.h:107
int h
The height of the rectangle.
Definition: libCZI_Pixels.h:38
double y
The y-coordinate of the upper-left point of the rectangle.
Definition: libCZI_Pixels.h:95
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:158
std::uint8_t b
The blue component.
Definition: libCZI_Pixels.h:115
ScopedBitmapLocker(tBitmap bmData)
Definition: libCZI_Pixels.h:264
bool IntersectsWith(const IntRect &r) const
Definition: libCZI_Pixels.h:49
A structure representing an R-G-B-color triple (as bytes).
Definition: libCZI_Pixels.h:111
The data is uncompressed.
std::uint32_t stride
The stride of the bitmap data (pointed to by ptrDataRoi).
Definition: libCZI_Pixels.h:157
float r
The red component.
Definition: libCZI_Pixels.h:121
Currently not supported in libCZI.
ScopedBitmapLocker< tBitmap > & operator=(ScopedBitmapLocker< tBitmap > &&other) noexcept
move assignment
Definition: libCZI_Pixels.h:291
static IntRect Intersect(const IntRect &a, const IntRect &b)
Definition: libCZI_Pixels.h:76
double h
The height of the rectangle.
Definition: libCZI_Pixels.h:97
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:94
std::uint8_t r
The red component.
Definition: libCZI_Pixels.h:113
ScopedBitmapLocker(ScopedBitmapLocker< tBitmap > &&other) noexcept
move constructor
Definition: libCZI_Pixels.h:285
float g
The green component.
Definition: libCZI_Pixels.h:122
ScopedBitmapLocker(const ScopedBitmapLocker< tBitmap > &other)
Definition: libCZI_Pixels.h:275
void Invalidate()
Invalidates this object.
Definition: libCZI_Pixels.h:41
std::uint32_t GetHeight() const
Definition: libCZI_Pixels.h:207
A rectangle (with integer coordinates).
Definition: libCZI_Pixels.h:33
A structure representing an R-G-B-color triple (as floats).
Definition: libCZI_Pixels.h:119
std::uint8_t g
The green component.
Definition: libCZI_Pixels.h:114
External interfaces, classes, functions and structs are found in the namespace "libCZI".
Definition: libCZI.h:45
int y
The y-coordinate of the upper-left point of the rectangle.
Definition: libCZI_Pixels.h:36
double w
The width of the rectangle.
Definition: libCZI_Pixels.h:96
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:325
float b
The blue component.
Definition: libCZI_Pixels.h:123
Currently not supported in libCZI.
The data is JPG-compressed.
A structure representing a size (width and height) in integers.
Definition: libCZI_Pixels.h:104
bool IsValid() const
Returns a boolean indicating whether this rectangle contains valid information.
Definition: libCZI_Pixels.h:44
ScopedBitmapLocker< IBitmapData * > ScopedBitmapLockerP
Defines an alias representing the scoped bitmap locker for use with libCZI::IBitmapData.
Definition: libCZI_Pixels.h:322
void Invalidate()
Invalidates this object.
Definition: libCZI_Pixels.h:100
int x
The x-coordinate of the upper-left point of the rectangle.
Definition: libCZI_Pixels.h:35
Currently not supported in libCZI.
void * ptrDataRoi
The pointer to the first (top-left) pixel of the bitmap.
Definition: libCZI_Pixels.h:156
IntRect Intersect(const IntRect &r) const
Definition: libCZI_Pixels.h:65
std::uint32_t w
The width.
Definition: libCZI_Pixels.h:106