MaterialX 1.39.1
Loading...
Searching...
No Matches
OiioImageLoader.h
1//
2// Copyright Contributors to the MaterialX Project
3// SPDX-License-Identifier: Apache-2.0
4//
5
6#ifndef MATERIALX_OIIOIMAGELOADER_H
7#define MATERIALX_OIIOIMAGELOADER_H
8
9#if MATERIALX_BUILD_OIIO
10
13
15
16MATERIALX_NAMESPACE_BEGIN
17
19using OiioImageLoaderPtr = std::shared_ptr<class OiioImageLoader>;
20
23class MX_RENDER_API OiioImageLoader : public ImageLoader
24{
25 public:
26 OiioImageLoader()
27 {
28 // Set all extensions supported by OpenImageIO
29 _extensions.insert(BMP_EXTENSION);
30 _extensions.insert(GIF_EXTENSION);
31 _extensions.insert(HDR_EXTENSION);
32 _extensions.insert(JPG_EXTENSION);
33 _extensions.insert(JPEG_EXTENSION);
34 _extensions.insert(PIC_EXTENSION);
35 _extensions.insert(PNG_EXTENSION);
36 _extensions.insert(PSD_EXTENSION);
37 _extensions.insert(TGA_EXTENSION);
38 _extensions.insert(EXR_EXTENSION);
39 _extensions.insert(TIF_EXTENSION);
40 _extensions.insert(TIFF_EXTENSION);
41 _extensions.insert(TX_EXTENSION);
42 _extensions.insert(TXT_EXTENSION);
43 _extensions.insert(TXR_EXTENSION);
44 }
45 virtual ~OiioImageLoader() { }
46
48 static OiioImageLoaderPtr create() { return std::make_shared<OiioImageLoader>(); }
49
51 bool saveImage(const FilePath& filePath,
52 ConstImagePtr image,
53 bool verticalFlip = false) override;
54
56 ImagePtr loadImage(const FilePath& filePath) override;
57};
58
59MATERIALX_NAMESPACE_END
60
61#endif // MATERIALX_BUILD_OIIO
62
63#endif
shared_ptr< const Image > ConstImagePtr
A shared pointer to a const image.
Definition: Image.h:26
shared_ptr< Image > ImagePtr
A shared pointer to an image.
Definition: Image.h:23
Image handler interfaces.
A generic file path, supporting both syntactic and file system operations.
Definition: File.h:27
Abstract base class for file-system image loaders.
Definition: ImageHandler.h:108
virtual bool saveImage(const FilePath &filePath, ConstImagePtr image, bool verticalFlip=false)
Save an image to the file system.
virtual ImagePtr loadImage(const FilePath &filePath)
Load an image from the file system.