Skip to content

Commit 731b90b

Browse files
authored
api: Add new ImageInput::supports() query: "mipmap" (AcademySoftwareFoundation#4800)
ImageOutput::supports() recognized queries for "multiimage" and "mipmap". But ImageInput::supports() only recognized "multiimage". Add "mipmap" to make it easier for client software to know if the image file format they're reading from allows the possibility of MIP-mapping. As far as I can tell, only OpenEXR, TIFF, Ptex, and DDS do, among the file types we currently support. Signed-off-by: Larry Gritz <lg@larrygritz.com>
1 parent 1516226 commit 731b90b

6 files changed

Lines changed: 13 additions & 6 deletions

File tree

src/dds.imageio/ddsinput.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class DDSInput final : public ImageInput {
3535
const char* format_name(void) const override { return "dds"; }
3636
int supports(string_view feature) const override
3737
{
38-
return feature == "ioproxy";
38+
return feature == "ioproxy" || feature == "mipmap";
3939
}
4040
bool valid_file(Filesystem::IOProxy* ioproxy) const override;
4141
bool open(const std::string& name, ImageSpec& newspec) override;

src/include/OpenImageIO/imageio.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,12 @@ class OIIO_API ImageInput {
10321032
/// (Note: this doesn't necessarily mean that the particular
10331033
/// file this ImageInput is reading has multiple subimages.)
10341034
///
1035+
/// - `"mipmap"` :
1036+
/// Does this format support multiple resolutions for an
1037+
/// image/subimage? (Note: this doesn't necessarily mean that the
1038+
/// particular file this ImageInput is reading is MIP-mapped.)
1039+
/// This query was added in OpenImageIO 3.1.
1040+
///
10351041
/// - `"noimage"` :
10361042
/// Does this format allow 0x0 sized images, i.e. an image file
10371043
/// with metadata only and no pixels?

src/openexr.imageio/exr_pvt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class OpenEXRInput final : public ImageInput {
102102
|| feature == "exif" // Because of arbitrary_metadata
103103
|| feature == "ioproxy"
104104
|| feature == "iptc" // Because of arbitrary_metadata
105-
|| feature == "multiimage");
105+
|| feature == "multiimage" || feature == "mipmap");
106106
}
107107
bool valid_file(Filesystem::IOProxy* ioproxy) const override;
108108
bool open(const std::string& name, ImageSpec& newspec,

src/openexr.imageio/exrinput_c.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class OpenEXRCoreInput final : public ImageInput {
106106
|| feature == "exif" // Because of arbitrary_metadata
107107
|| feature == "ioproxy"
108108
|| feature == "iptc" // Because of arbitrary_metadata
109-
|| feature == "multiimage");
109+
|| feature == "multiimage" || feature == "mipmap");
110110
}
111111
bool valid_file(const std::string& filename) const override;
112112
bool open(const std::string& name, ImageSpec& newspec,

src/ptex.imageio/ptexinput.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ class PtexInput final : public ImageInput {
2323
int supports(string_view feature) const override
2424
{
2525
return (feature == "arbitrary_metadata"
26-
|| feature == "exif" // Because of arbitrary_metadata
27-
|| feature == "iptc"); // Because of arbitrary_metadata
26+
|| feature == "exif" // Because of arbitrary_metadata
27+
|| feature == "iptc" // Because of arbitrary_metadata
28+
|| feature == "multiimage" || feature == "mipmap");
2829
}
2930
bool open(const std::string& name, ImageSpec& newspec) override;
3031
bool close() override;

src/tiff.imageio/tiffinput.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ class TIFFInput final : public ImageInput {
102102
int supports(string_view feature) const override
103103
{
104104
return (feature == "exif" || feature == "iptc" || feature == "ioproxy"
105-
|| feature == "multiimage");
105+
|| feature == "multiimage" || feature == "mipmap");
106106
// N.B. No support for arbitrary metadata.
107107
}
108108
bool open(const std::string& name, ImageSpec& newspec) override;

0 commit comments

Comments
 (0)