MCPcopy Create free account
hub / github.com/ImageEngine/cortex / setImageSpecFormatOptions

Function setImageSpecFormatOptions

src/IECoreImage/ImageWriter.cpp:180–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178}
179
180void setImageSpecFormatOptions( const CompoundObject *operands, ImageSpec *spec, const std::string &fileFormatName )
181{
182 const CompoundObject *settings = operands->member<const CompoundObject>( fileFormatName );
183 if( settings == nullptr )
184 {
185 return;
186 }
187
188 std::string dataType;
189 if( const StringData *dataTypeHolder = settings->member<const StringData>( "dataType" ) )
190 {
191 dataType = dataTypeHolder->readable();
192
193 /// \todo: This is copied from GafferImage::ImageWriter.
194 /// Can it be consolidated in OpenImageIOAlgo?
195 if( dataType == "int8" )
196 {
197 spec->set_format( TypeDesc::INT8 );
198 }
199 else if( dataType == "int16" )
200 {
201 spec->set_format( TypeDesc::INT16 );
202 }
203 else if( dataType == "int32" )
204 {
205 spec->set_format( TypeDesc::INT32 );
206 }
207 else if( dataType == "int64" )
208 {
209 spec->set_format( TypeDesc::INT64 );
210 }
211 else if( dataType == "uint8" )
212 {
213 spec->set_format( TypeDesc::UINT8 );
214 }
215 else if( dataType == "uint16" )
216 {
217 spec->set_format( TypeDesc::UINT16 );
218 }
219 else if( dataType == "uint32" )
220 {
221 spec->set_format( TypeDesc::UINT32 );
222 }
223 else if( dataType == "uint64" )
224 {
225 spec->set_format( TypeDesc::UINT64 );
226 }
227 else if( dataType == "half" )
228 {
229 spec->set_format( TypeDesc::HALF );
230 }
231 else if( dataType == "float" )
232 {
233 spec->set_format( TypeDesc::FLOAT );
234 }
235 else if( dataType == "double" )
236 {
237 spec->set_format( TypeDesc::DOUBLE );

Callers 1

doWriteMethod · 0.85

Calls 1

readableMethod · 0.80

Tested by

no test coverage detected