-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathimageoutput.cpp
More file actions
49 lines (37 loc) · 1.36 KB
/
Copy pathimageoutput.cpp
File metadata and controls
49 lines (37 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <OpenImageIO/imageio.h>
#include <string>
#include "oiio.h"
#include "handles.h"
using oiio_go::UniqueHandle;
extern "C" {
void deleteImageOutput(ImageOutput *out) {
delete static_cast<UniqueHandle<OIIO::ImageOutput>*>(out);
}
ImageOutput* ImageOutput_Create(const char* filename, const char* plugin_searchpath) {
// Use the non-deprecated 3-argument form with nullptr for ioproxy
auto out = OIIO::ImageOutput::create(filename, nullptr, plugin_searchpath);
if (!out) return nullptr;
return (ImageOutput*) new UniqueHandle<OIIO::ImageOutput>(std::move(out));
}
char* ImageOutput_geterror(ImageOutput *out) {
auto* handle = static_cast<UniqueHandle<OIIO::ImageOutput>*>(out);
std::string sstring = handle->get()->geterror();
if (sstring.empty()){
return NULL;
}
return strdup(sstring.c_str());
}
const char* ImageOutput_format_name(ImageOutput *out) {
auto* handle = static_cast<UniqueHandle<OIIO::ImageOutput>*>(out);
return handle->get()->format_name();
}
const ImageSpec* ImageOutput_spec(ImageOutput *out) {
auto* handle = static_cast<UniqueHandle<OIIO::ImageOutput>*>(out);
const OIIO::ImageSpec *spec = &(handle->get()->spec());
return (ImageSpec*) spec;
}
bool ImageOutput_supports(ImageOutput *out, const char* feature){
auto* handle = static_cast<UniqueHandle<OIIO::ImageOutput>*>(out);
return handle->get()->supports(feature);
}
} // extern "C"