From 588e003e5445350dc3e5799e1aa31bc2002db6ae Mon Sep 17 00:00:00 2001 From: Vincent Rabaud Date: Tue, 17 Feb 2026 15:17:14 +0100 Subject: [PATCH 1/3] Add avifRGBImage to the C++ API --- include/avif/avif_cxx.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/avif/avif_cxx.h b/include/avif/avif_cxx.h index 1b4e560189..b6588c9368 100644 --- a/include/avif/avif_cxx.h +++ b/include/avif/avif_cxx.h @@ -18,17 +18,19 @@ namespace avif // Struct to call the destroy functions in a unique_ptr. struct UniquePtrDeleter { - void operator()(avifEncoder * encoder) const { avifEncoderDestroy(encoder); } void operator()(avifDecoder * decoder) const { avifDecoderDestroy(decoder); } - void operator()(avifImage * image) const { avifImageDestroy(image); } + void operator()(avifEncoder * encoder) const { avifEncoderDestroy(encoder); } void operator()(avifGainMap * gainMap) const { avifGainMapDestroy(gainMap); } + void operator()(avifImage * image) const { avifImageDestroy(image); } + void operator()(avifRGBImage * image) const { avifRGBImageFreePixels(image); } }; // Use these unique_ptr to ensure the structs are automatically destroyed. -using EncoderPtr = std::unique_ptr; using DecoderPtr = std::unique_ptr; -using ImagePtr = std::unique_ptr; +using EncoderPtr = std::unique_ptr; using GainMapPtr = std::unique_ptr; +using ImagePtr = std::unique_ptr; +using RGBImagePtr = std::unique_ptr; } // namespace avif From 876c872fbd25d5b9d72b4d96c829486ae2a6f0b3 Mon Sep 17 00:00:00 2001 From: Vincent Rabaud Date: Tue, 17 Feb 2026 15:52:05 +0100 Subject: [PATCH 2/3] Rename and add comment. --- include/avif/avif_cxx.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/avif/avif_cxx.h b/include/avif/avif_cxx.h index b6588c9368..15c7592e34 100644 --- a/include/avif/avif_cxx.h +++ b/include/avif/avif_cxx.h @@ -30,7 +30,8 @@ using DecoderPtr = std::unique_ptr; using EncoderPtr = std::unique_ptr; using GainMapPtr = std::unique_ptr; using ImagePtr = std::unique_ptr; -using RGBImagePtr = std::unique_ptr; +// To use when RGBImage actually owns the pixels. RGBImage can also be used as a view, in which case it does not own the pixels. +using RGBImageOwnedPixelsPtr = std::unique_ptr; } // namespace avif From efe1ca0b6189be469d0e9b37c0f00eb997e1e5f1 Mon Sep 17 00:00:00 2001 From: Vincent Rabaud Date: Wed, 18 Feb 2026 14:38:14 +0100 Subject: [PATCH 3/3] Simplify naming --- include/avif/avif_cxx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/avif/avif_cxx.h b/include/avif/avif_cxx.h index 15c7592e34..f369978cba 100644 --- a/include/avif/avif_cxx.h +++ b/include/avif/avif_cxx.h @@ -31,7 +31,7 @@ using EncoderPtr = std::unique_ptr; using GainMapPtr = std::unique_ptr; using ImagePtr = std::unique_ptr; // To use when RGBImage actually owns the pixels. RGBImage can also be used as a view, in which case it does not own the pixels. -using RGBImageOwnedPixelsPtr = std::unique_ptr; +using RGBImagePtr = std::unique_ptr; } // namespace avif