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

Method ImageTargetFileQoi

src/cinder/ImageTargetFileQoi.cpp:87–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87ImageTargetFileQoi::ImageTargetFileQoi( DataTargetRef dataTarget, ImageSourceRef imageSource, ImageTarget::Options options, const std::string &extensionData )
88 : mDataTarget( dataTarget )
89{
90 if( ! ( mDataTarget->providesFilePath() || mDataTarget->getStream() ) ) {
91 throw ImageIoExceptionFailedWrite( "No file path or stream provided" );
92 }
93
94 setSize( imageSource->getWidth(), imageSource->getHeight() );
95 ImageIo::ColorModel cm = options.isColorModelDefault() ? imageSource->getColorModel() : options.getColorModel();
96
97 switch( cm ) {
98 case ImageIo::ColorModel::CM_RGB:
99 mNumComponents = ( imageSource->hasAlpha() ) ? 4 : 3;
100 setColorModel( ImageIo::ColorModel::CM_RGB );
101 setChannelOrder( ( mNumComponents == 4 ) ? ImageIo::ChannelOrder::RGBA : ImageIo::ChannelOrder::RGB );
102 break;
103 default:
104 throw ImageIoExceptionIllegalColorModel( "QOI only supports RGB/RGBA color models" );
105 }
106
107 setDataType( ImageIo::DataType::UINT8 );
108 mRowBytes = mNumComponents * imageSource->getWidth();
109
110 if( mDataTarget->providesFilePath() ) {
111 mFilePath = dataTarget->getFilePath();
112 }
113
114 mData = std::unique_ptr<uint8_t[]>( new uint8_t[mHeight * mRowBytes] );
115}
116
117void* ImageTargetFileQoi::getRowPointer( int32_t row )
118{

Callers

nothing calls this directly

Calls 10

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

Tested by

no test coverage detected