27 bool IsValid()
const {
return this->w >= 0 && this->h >= 0; }
30 bool IsNonEmpty()
const {
return this->w > 0 && this->h > 0; }
38 if (is.
w <= 0 || is.
h <= 0)
64 const int x1 = (std::max)(a.
x, b.
x);
65 const int x2 = (std::min)(a.
x + a.
w, b.
x + b.
w);
66 const int y1 = (std::max)(a.
y, b.
y);
67 const int y2 = (std::min)(a.
y + a.
h, b.
y + b.
h);
68 if (x2 >= x1 && y2 >= y1)
70 return IntRect{ x1, y1, x2 - x1, y2 - y1 };
253 template <
typename tBitmap>
265 auto lockInfo = bmData->Lock();
266 this->
ptrData = lockInfo.ptrData;
268 this->
stride = lockInfo.stride;
269 this->
size = lockInfo.size;
276 auto lockInfo = other.bmData->Lock();
277 this->
ptrData = lockInfo.ptrData;
279 this->
stride = lockInfo.stride;
280 this->
size = lockInfo.size;
286 *
this = std::move(other);
296 this->bmData->Unlock();
299 this->bmData = std::move(other.bmData);
302 this->
stride = other.stride;
303 this->
size = other.size;
304 other.ptrData = other.ptrDataRoi =
nullptr;
305 other.bmData = tBitmap();
315 this->bmData->Unlock();
334 os <<
"(" << rect.
x <<
"," << rect.
y <<
"," << rect.
w <<
"," << rect.
h <<
")";
344 os <<
"(" << size.
w <<
"," << size.
h <<
")";
Definition: libCZI_Pixels.h:167
std::uint32_t GetHeight() const
Definition: libCZI_Pixels.h:206
virtual PixelType GetPixelType() const =0
std::uint32_t GetWidth() const
Definition: libCZI_Pixels.h:201
virtual IntSize GetSize() const =0
virtual BitmapLockInfo Lock()=0
Definition: libCZI_Pixels.h:255
ScopedBitmapLocker(const ScopedBitmapLocker< tBitmap > &other)
Definition: libCZI_Pixels.h:274
ScopedBitmapLocker(tBitmap bmData)
Definition: libCZI_Pixels.h:263
ScopedBitmapLocker< tBitmap > & operator=(ScopedBitmapLocker< tBitmap > &&other) noexcept
move assignment
Definition: libCZI_Pixels.h:290
ScopedBitmapLocker(ScopedBitmapLocker< tBitmap > &&other) noexcept
move constructor
Definition: libCZI_Pixels.h:284
External interfaces, classes, functions and structs are found in the namespace "libCZI".
Definition: libCZI.h:31
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:324
CompressionMode
An enum specifying the compression method.
Definition: libCZI_Pixels.h:131
@ Invalid
Invalid compression type.
@ JpgXr
The data is JPG-XR-compressed.
@ Jpg
The data is JPG-compressed.
@ Zstd1
The data contains a header, followed by a zstd-compressed block.
@ Zstd0
The data is compressed with zstd.
@ UnCompressed
The data is uncompressed.
SubBlockPyramidType
Definition: libCZI_Pixels.h:144
@ MultiSubBlock
The subblock is a pyramid subblock, and it covers multiple subblocks of the lower layer.
@ SingleSubBlock
The subblock is a pyramid subblock, and it covers a single subblock of the lower layer (or: it is a m...
@ Invalid
Invalid pyramid type.
@ None
No pyramid (indicating that the subblock is not a pyramid subblock, but a layer-0 subblock).
ScopedBitmapLocker< IBitmapData * > ScopedBitmapLockerP
Defines an alias representing the scoped bitmap locker for use with libCZI::IBitmapData.
Definition: libCZI_Pixels.h:321
PixelType
An enum representing a pixel-type.
Definition: libCZI_Pixels.h:114
@ Gray64ComplexFloat
Currently not supported in libCZI.
@ Gray16
Grayscale 16-bit unsigned.
@ Bgra32
Currently not supported in libCZI.
@ Invalid
Invalid pixel type.
@ Gray64Float
Currently not supported in libCZI.
@ Gray32Float
Grayscale 4 byte float.
@ Bgr48
BGR-color 16-bytes triples (memory order B, G, R).
@ Gray32
Currently not supported in libCZI.
@ Bgr192ComplexFloat
Currently not supported in libCZI.
@ Bgr24
BGR-color 8-bytes triples (memory order B, G, R).
@ Gray8
Grayscale 8-bit unsigned.
@ Bgr96Float
BGR-color 4 byte float triples (memory order B, G, R).
std::ostream & operator<<(std::ostream &os, const IntRect &rect)
Definition: libCZI_Pixels.h:332
Information about a locked bitmap - allowing direct access to the image data in memory.
Definition: libCZI_Pixels.h:153
std::uint64_t size
The size of the bitmap data (pointed to by ptrDataRoi) in bytes.
Definition: libCZI_Pixels.h:157
void * ptrData
Not currently used, to be ignored.
Definition: libCZI_Pixels.h:154
std::uint32_t stride
The stride of the bitmap data (pointed to by ptrDataRoi).
Definition: libCZI_Pixels.h:156
void * ptrDataRoi
The pointer to the first (top-left) pixel of the bitmap.
Definition: libCZI_Pixels.h:155
A rectangle (with double coordinates).
Definition: libCZI_Pixels.h:79
double h
The height of the rectangle.
Definition: libCZI_Pixels.h:83
double w
The width of the rectangle.
Definition: libCZI_Pixels.h:82
double y
The y-coordinate of the upper-left point of the rectangle.
Definition: libCZI_Pixels.h:81
void Invalidate()
Invalidates this object.
Definition: libCZI_Pixels.h:86
double x
The x-coordinate of the upper-left point of the rectangle.
Definition: libCZI_Pixels.h:80
A rectangle (with integer coordinates).
Definition: libCZI_Pixels.h:17
int h
The height of the rectangle.
Definition: libCZI_Pixels.h:21
bool IsNonEmpty() const
Returns a boolean indicating whether this rectangle is valid and non-empty.
Definition: libCZI_Pixels.h:30
int y
The y-coordinate of the upper-left point of the rectangle.
Definition: libCZI_Pixels.h:19
IntRect Intersect(const IntRect &r) const
Definition: libCZI_Pixels.h:51
int x
The x-coordinate of the upper-left point of the rectangle.
Definition: libCZI_Pixels.h:18
bool IntersectsWith(const IntRect &r) const
Definition: libCZI_Pixels.h:35
static IntRect Intersect(const IntRect &a, const IntRect &b)
Definition: libCZI_Pixels.h:62
int w
The width of the rectangle.
Definition: libCZI_Pixels.h:20
bool IsValid() const
Returns a boolean indicating whether this rectangle contains valid information.
Definition: libCZI_Pixels.h:27
void Invalidate()
Invalidates this object.
Definition: libCZI_Pixels.h:24
A structure representing a size (width and height) in integers.
Definition: libCZI_Pixels.h:91
std::uint32_t h
The height.
Definition: libCZI_Pixels.h:93
std::uint32_t w
The width.
Definition: libCZI_Pixels.h:92
A structure representing an R-G-B-color triple (as bytes).
Definition: libCZI_Pixels.h:98
std::uint8_t b
The blue component.
Definition: libCZI_Pixels.h:101
std::uint8_t g
The green component.
Definition: libCZI_Pixels.h:100
std::uint8_t r
The red component.
Definition: libCZI_Pixels.h:99
A structure representing an R-G-B-color triple (as floats).
Definition: libCZI_Pixels.h:106
float r
The red component.
Definition: libCZI_Pixels.h:107
float b
The blue component.
Definition: libCZI_Pixels.h:109
float g
The green component.
Definition: libCZI_Pixels.h:108