MCPcopy Create free account
hub / github.com/cinder/Cinder / ImageTargetFileTinyExr

Method ImageTargetFileTinyExr

src/cinder/ImageFileTinyExr.cpp:267–304  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265}
266
267ImageTargetFileTinyExr::ImageTargetFileTinyExr( DataTargetRef dataTarget, ImageSourceRef imageSource, ImageTarget::Options options, const std::string & /*extensionData*/ )
268{
269 if( ! dataTarget->providesFilePath() ) {
270 throw ImageIoExceptionFailedWrite( "ImageTargetFileTinyExr only supports writing to files." );
271 }
272
273 mFilePath = dataTarget->getFilePath();
274
275 setSize( imageSource->getWidth(), imageSource->getHeight() );
276 ImageIo::ColorModel cm = options.isColorModelDefault() ? imageSource->getColorModel() : options.getColorModel();
277
278 switch( cm ) {
279 case ImageIo::ColorModel::CM_RGB:
280 mNumComponents = ( imageSource->hasAlpha() ) ? 4 : 3;
281 setColorModel( ImageIo::ColorModel::CM_RGB );
282 setChannelOrder( ( mNumComponents == 3 ) ? ImageIo::ChannelOrder::BGR : ImageIo::ChannelOrder::ABGR );
283 if( mNumComponents == 3 )
284 mChannelNames = { "B", "G", "R" };
285 else
286 mChannelNames = { "A", "B", "G", "R" };
287 break;
288 case ImageIo::ColorModel::CM_GRAY:
289 mNumComponents = ( imageSource->hasAlpha() ) ? 2 : 1;
290 setColorModel( ImageIo::ColorModel::CM_GRAY );
291 setChannelOrder( ( mNumComponents == 2 ) ? ImageIo::ChannelOrder::YA : ImageIo::ChannelOrder::Y );
292 if( mNumComponents == 2 )
293 mChannelNames = { "Y", "A" };
294 else
295 mChannelNames = { "Y" };
296 break;
297 default:
298 throw ImageIoExceptionIllegalColorModel();
299 }
300
301 // TODO: consider supporting half float and uint types as well
302 setDataType( ImageIo::DataType::FLOAT32 );
303 mData.resize( mHeight * mWidth * mNumComponents );
304}
305
306void *ImageTargetFileTinyExr::getRowPointer( int32_t row )
307{

Callers

nothing calls this directly

Calls 10

setColorModelFunction · 0.85
setChannelOrderFunction · 0.85
isColorModelDefaultMethod · 0.80
getColorModelMethod · 0.80
setSizeFunction · 0.50
setDataTypeFunction · 0.50
getWidthMethod · 0.45
getHeightMethod · 0.45
hasAlphaMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected