diff options
| author | Carl Hetherington <cth@carlh.net> | 2025-04-12 11:31:56 +0200 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2025-04-12 11:31:56 +0200 |
| commit | 7900d3f3fe825b7be59c0770180e58c8bbf6059e (patch) | |
| tree | d9f803fb640be7611d2c34ddc7e9a9f8a95ec232 /src | |
| parent | b4d87b8124b34d4c7d746fe5f423c589176d68be (diff) | |
Add Image::has_alpha().
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/image.cc | 9 | ||||
| -rw-r--r-- | src/lib/image.h | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/lib/image.cc b/src/lib/image.cc index 80ef92d06..1d06ef418 100644 --- a/src/lib/image.cc +++ b/src/lib/image.cc @@ -1728,3 +1728,12 @@ Image::crop(Crop crop) const return out; } + +bool +Image::has_alpha() const +{ + auto const d = av_pix_fmt_desc_get(_pixel_format); + DCPOMATIC_ASSERT(d); + return d->flags & AV_PIX_FMT_FLAG_ALPHA; +} + diff --git a/src/lib/image.h b/src/lib/image.h index 548ebf717..9eedaece7 100644 --- a/src/lib/image.h +++ b/src/lib/image.h @@ -99,6 +99,8 @@ public: return _pixel_format; } + bool has_alpha() const; + size_t memory_used () const; static std::shared_ptr<const Image> ensure_alignment (std::shared_ptr<const Image> image, Alignment alignment); |
