134 return _desc.
width();
176 return _planeList[index];
192 void *
data(
int index = 0)
const {
193 return _planeList[index]->data();
203 for(
auto &p : _planeList) {
205 if(
err.isError())
return err;
221 for(
const auto &p : _planeList) {
222 if(p.referenceCount() > 1)
return false;
238 for(
auto &p : _planeList) {
250 return pf !=
nullptr &&
pf->isCompressed();
267 return _planeList[0]->size();
300 return _desc.
pixelFormat()->createPaintEngine(*
this);
promeki::List< Ptr > PtrList
List of shared Buffer pointers.
Definition buffer.h:104
Lightweight error code wrapper for the promeki library.
Definition error.h:39
@ Ok
No error.
Definition error.h:51
@ Invalid
Invalid value or argument (EINVAL).
Definition error.h:66
Describes the format and layout of a single image.
Definition imagedesc.h:33
size_t height() const
Returns the image height in pixels.
Definition imagedesc.h:95
bool isValid() const
Returns true if this image description has valid dimensions and pixel format.
Definition imagedesc.h:71
const Metadata & metadata() const
Returns a const reference to the metadata.
Definition imagedesc.h:187
int pixelFormatID() const
Returns the pixel format identifier.
Definition imagedesc.h:63
const Size2Du32 & size() const
Returns the image dimensions.
Definition imagedesc.h:79
const PixelFormat * pixelFormat() const
Returns a pointer to the PixelFormat descriptor for this image.
Definition imagedesc.h:173
size_t width() const
Returns the image width in pixels.
Definition imagedesc.h:87
Raster image with pixel format, planes, and metadata.
Definition image.h:48
size_t height() const
Returns the image height in pixels.
Definition image.h:141
Error fill(char value) const
Fills all image planes with the given byte value.
Definition image.h:201
void * data(int index=0) const
Returns a raw data pointer for the given plane.
Definition image.h:192
promeki::List< Ptr > PtrList
List of shared Image pointers.
Definition image.h:58
PaintEngine createPaintEngine() const
Creates a paint engine for drawing on this image.
Definition image.h:299
Image(const Size2Du32 &s, int pixfmt, const MemSpace &ms=MemSpace::Default)
Constructs an image from a size and pixel format ID.
Definition image.h:76
void ensureExclusive()
Ensures exclusive ownership of all plane buffers.
Definition image.h:237
SharedPtr< Image > Ptr
Shared pointer type for Image.
Definition image.h:52
Image convert(PixelFormat::ID pixelFormat, const Metadata &metadata) const
Converts this image to a different pixel format.
const Metadata & metadata() const
Returns a const reference to the image metadata.
Definition image.h:149
const Buffer::Ptr & plane(int index=0) const
Returns the buffer for the given image plane.
Definition image.h:175
Image()=default
Constructs an invalid (empty) image.
Image(size_t w, size_t h, int pixfmt, const MemSpace &ms=MemSpace::Default)
Constructs an image from width, height, and pixel format ID.
Definition image.h:86
int pixelFormatID() const
Returns the pixel format identifier.
Definition image.h:109
bool isExclusive() const
Returns true if all plane buffers are exclusively owned.
Definition image.h:220
const Size2Du32 & size() const
Returns the image dimensions.
Definition image.h:125
Image(const ImageDesc &desc, const MemSpace &ms=MemSpace::Default)
Constructs an image from an image descriptor.
size_t compressedSize() const
Returns the compressed data size in bytes.
Definition image.h:265
bool isCompressed() const
Returns true if this image uses a compressed pixel format.
Definition image.h:248
size_t width() const
Returns the image width in pixels.
Definition image.h:133
size_t lineStride(int plane=0) const
Returns the line stride in bytes for the given plane.
Definition image.h:166
bool isValid() const
Returns true if the image has a valid descriptor and allocated planes.
Definition image.h:93
const ImageDesc & desc() const
Returns the image descriptor.
Definition image.h:101
Metadata & metadata()
Returns a mutable reference to the image metadata.
Definition image.h:157
const Buffer::PtrList & planes() const
Returns the list of all plane buffers.
Definition image.h:183
promeki::List< Image > List
List of Image values.
Definition image.h:55
const PixelFormat * pixelFormat() const
Returns a pointer to the PixelFormat object.
Definition image.h:117
static Image fromCompressedData(const void *data, size_t size, size_t width, size_t height, int pixfmt, const Metadata &metadata=Metadata())
Creates a compressed image from pre-encoded data.
Dynamic array container wrapping std::vector.
Definition list.h:40
List()=default
Default constructor. Creates an empty list.
Abstraction for memory allocation in different address spaces.
Definition memspace.h:30
@ Default
Alias for System memory.
Definition memspace.h:36
2D drawing engine for rendering primitives onto images.
Definition paintengine.h:30
#define PROMEKI_NAMESPACE_BEGIN
Starts a promeki namespace block.
Definition namespace.h:14
#define PROMEKI_NAMESPACE_END
Ends a promeki namespace block.
Definition namespace.h:19
const T & value(const Result< T > &r)
Returns the value from a Result.
Definition result.h:56
#define PROMEKI_SHARED_FINAL(TYPE)
Macro for non-polymorphic native shared objects.
Definition sharedptr.h:88