当前位置: 首页>>代码示例>>C++>>正文


C++ channellist::ConstIterator类代码示例

本文整理汇总了C++中channellist::ConstIterator的典型用法代码示例。如果您正苦于以下问题:C++ ConstIterator类的具体用法?C++ ConstIterator怎么用?C++ ConstIterator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ConstIterator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: int

void
ChannelListAttribute::writeValueTo (OStream &os, int version) const
{
    for (ChannelList::ConstIterator i = _value.begin();
	 i != _value.end();
	 ++i)
    {
	//
	// Write name
	//

	Xdr::write <StreamIO> (os, i.name());

	//
	// Write Channel struct
	//

	Xdr::write <StreamIO> (os, int (i.channel().type));
	Xdr::pad   <StreamIO> (os, 4);
	Xdr::write <StreamIO> (os, i.channel().xSampling);
	Xdr::write <StreamIO> (os, i.channel().ySampling);
    }

    //
    // Write end of list marker
    //

    Xdr::write <StreamIO> (os, "");
}
开发者ID:Len3d,项目名称:appleseed,代码行数:29,代码来源:ImfChannelListAttribute.cpp

示例2: viewFromChannelName

ChannelList
channelsInView (const string & viewName,
	        const ChannelList & channelList,
		const StringVector & multiView)
{
    //
    // Return a list of all channels belonging to view viewName.
    //

    ChannelList q;

    for (ChannelList::ConstIterator i = channelList.begin();
	 i != channelList.end();
	 ++i)
    {
	//
	// Get view name for this channel
	//

	string view = viewFromChannelName (i.name(), multiView);


	//
	// Insert channel into q if it's a member of view viewName
	//

	if (view == viewName)
	   q.insert (i.name(), i.channel());
    }

    return q;
}
开发者ID:cathook,项目名称:rendering_final_proj,代码行数:32,代码来源:ImfMultiView.cpp

示例3: exrInfo

// Read the header of an EXR file.
// (ref) http://www.openexr.com/ReadingAndWritingImageFiles.pdf
int vtkOpenEXR::exrInfo(const char *fileName, std::vector<std::string> &channelNames)
{
  // parse filename
  QFileInfo fi(fileName);

  QString extension = fi.suffix().toLower();
  if ( extension.compare("exr") != 0 ) {
//    qDebug() << "the exr file was not found";
    return false;
  }

  if (!fi.exists())
  {
//    qDebug() << "the exr file was not found";
    return false;
  }

  int numChannels = 0;

  try {
    RgbaInputFile file(fileName);

    const ChannelList &ch = file.header().channels();

    int ic = 0;
    for (ChannelList::ConstIterator i = ch.begin(); i != ch.end(); ++i) {
      const Channel &channel = i.channel();
      const char* channelName = i.name(); // by Min
      PixelType type = channel.type;
      const char* t = (type == UINT) ? "uint" :
          ((type == HALF) ? "half" : "float");

      channelNames.push_back(channelName);
      ++ic;
//      qDebug() << "channel " << ic << ": " << t << ": " << channelName ;
    }
    numChannels = ic;
    const StringAttribute *comments =
    file.header().findTypedAttribute <StringAttribute> ("comments");

    const M44fAttribute *cameraTransform =
    file.header().findTypedAttribute <M44fAttribute> ("cameraTransform");

//    if (comments)
//       qDebug() << "comments\n   " << comments->value() ;

//    if (cameraTransform)
//       qDebug() << "cameraTransform\n" << cameraTransform->value() << flush;

  } catch (const std::exception &exc) {
//    qDebug() << exc.what();
    return false;
  }

  return numChannels; // number of channels
}
开发者ID:WeiqiJust,项目名称:CHER-Ob,代码行数:58,代码来源:vtkOpenEXR.cpp

示例4: channelNames

void EXRImageReader::channelNames( vector<string> &names )
{
	open( true );

	const ChannelList &channels = m_inputFile->header().channels();
	names.clear();
	for( ChannelList::ConstIterator i = channels.begin(); i != channels.end(); ++i )
	{
		names.push_back( i.name() );
	}
}
开发者ID:Shockspot,项目名称:cortex,代码行数:11,代码来源:EXRImageReader.cpp

示例5: updateCombos

void EXRReaderPlugin::updateCombos()
{
	const std::string filename( getAbsoluteFirstFilename() );
	//TUTTLE_COUT("update Combo");
	if( bfs::exists( filename ) )
	{
		// read dims
		InputFile in( filename.c_str() );
		const Header& h  = in.header();
		const ChannelList& cl = h.channels();
		
		// Hide output channel selection till we don't select a channel.
		for( std::size_t i = 0; i < _vChannelChoice.size(); ++i )
		{
			//_vChannelChoice[i]->setIsSecret( true );
			_vChannelChoice[i]->resetOptions();
		}
		_vChannelNames.clear();
		for( ChannelList::ConstIterator it = cl.begin(); it != cl.end(); ++it )
		{
			_vChannelNames.push_back( it.name() );
			//TUTTLE_COUT_VAR( it.name() );
			for( std::size_t j = 0; j < _vChannelChoice.size(); ++j )
			{
				_vChannelChoice[j]->appendOption( it.name() );
			}
			++_channels;
			switch( _channels )
			{
				case 1:
				{
					for( std::size_t j = 0; j < _vChannelChoice.size(); j++ )
						_vChannelChoice.at(j)->setValue( 0 );
					break;
				}
				case 3:
				{
					for( std::size_t j = 0; j < _vChannelChoice.size() - 1; j++ )
						_vChannelChoice.at(j)->setValue( 2 - j );
					_vChannelChoice.at(3)->setValue( 0 );
					break;
				}
				case 4:
				{
					for( std::size_t j = 0; j < _vChannelChoice.size(); j++ )
						_vChannelChoice.at(j)->setValue( 3 - j );
					break;
				}
			}
		}
	}
}
开发者ID:DIT-Tools,项目名称:TuttleOFX,代码行数:52,代码来源:EXRReaderPlugin.cpp

示例6: pixelTypeSize

size_t
calculateBytesPerPixel (const Header &header)
{
    const ChannelList &channels = header.channels();

    size_t bytesPerPixel = 0;

    for (ChannelList::ConstIterator c = channels.begin();
	 c != channels.end();
	 ++c)
    {
	bytesPerPixel += pixelTypeSize (c.channel().type);
    }

    return bytesPerPixel;
}
开发者ID:voldemarz,项目名称:pbrt-v2,代码行数:16,代码来源:ImfTiledMisc.cpp

示例7: printPixelType

void
printChannelList (const ChannelList &cl)
{
    for (ChannelList::ConstIterator i = cl.begin(); i != cl.end(); ++i)
    {
        cout << "\n    " << i.name() << ", ";

        printPixelType (i.channel().type);

        cout << ", sampling " <<
        i.channel().xSampling << " " <<
        i.channel().ySampling;

        if (i.channel().pLinear)
            cout << ", plinear";
    }
}
开发者ID:GYingchao,项目名称:openexr,代码行数:17,代码来源:main.cpp

示例8: open

void EXRReader::open()
{
    // open file and read dimensions
    m_data.reset( new EXRReaderData(filename().c_str()) );

    int width  = m_data->dtw_.max.x - m_data->dtw_.min.x + 1;
    int height = m_data->dtw_.max.y - m_data->dtw_.min.y + 1;

    assert(width > 0);
    assert(height > 0);

    // check that file contains RGB data
    bool red = false;
    bool green = false;
    bool blue = false;
    const ChannelList &channels = m_data->file_.header().channels();
    for ( ChannelList::ConstIterator i = channels.begin(), iEnd = channels.end();
            i != iEnd; ++i )
    {
        if ( !strcmp(i.name(), "R") ) red = true;
        else if ( !strcmp(i.name(), "G") ) green = true;
        else if ( !strcmp(i.name(), "B") ) blue = true;
    }

    if ( !(red && green && blue) ) {
        throw pfs::io::InvalidHeader("OpenEXR file " + filename() + " does " \
                                     " not contain RGB data");
    }

    // check boundaries
    /*
    if ( (m_data->dtw_.min.x < m_data->dw_.min.x &&
          m_data->dtw_.max.x > m_data->dw_.max.x) ||
         (m_data->dtw_.min.y < m_data->dw_.min.y &&
          m_data->dtw_.max.y > m_data->dw_.max.y) )
    {
        throw pfs::io::InvalidHeader("No support for OpenEXR files DataWindow" \
                                     " greater than DisplayWindow" );
    }
    */

    setWidth(width);
    setHeight(height);
}
开发者ID:DINKIN,项目名称:LuminanceHDR,代码行数:44,代码来源:exrreader.cpp

示例9: prepareFrameBuffer

// Prepares a framebuffer for the requested channels, allocating also the
// appropriate Matlab memory
void vtkOpenEXR::prepareFrameBuffer(FrameBuffer & fb, const Box2i & dataWindow, const ChannelList & channels,
    const std::vector<std::string> & requestedChannels, std::vector< Array2D<float> *> & outData) // std::vector<mxArray *> & outMatlabData
{
    assert(!requestedChannels.empty());

    const Box2i & dw = dataWindow;
    const int width  = dw.max.x - dw.min.x + 1;
    const int height = dw.max.y - dw.min.y + 1;

    // The "weird" strides are because Matlab uses column-major order (check this out later)
//    const int xStride = height; // for matlab
//    const int yStride = 1;
    const int xStride = 1;
    const int yStride = width; // for c++

    // Offset for all the slices
    const off_t offset = - (dw.min.x * xStride + dw.min.y * yStride); // why negative?

    for (size_t i = 0; i != requestedChannels.size(); ++i) {
        // Allocate the memory
        //mxArray * data = mxCreateNumericMatrix(height, width, mxSINGLE_CLASS, mxREAL);
        Array2D<float> * data = new Array2D<float>;
        //Array2D<float> * data(height, width);
        data->resizeErase(height, width);

        outData[i] = data;

        float * ptr = static_cast<float*>(data[0][0]);  // check this out

        // Get the appropriate sampling factors
        int xSampling = 1, ySampling = 1;
        ChannelList::ConstIterator cIt = channels.find(requestedChannels[i].c_str());
        if (cIt != channels.end()) {
            xSampling = cIt.channel().xSampling;
            ySampling = cIt.channel().ySampling;
        }

        // Insert the slice in the framebuffer
        fb.insert(requestedChannels[i].c_str(), Slice(FLOAT, (char*)(ptr + offset), sizeof(float) * xStride, sizeof(float) * yStride, xSampling, ySampling));
    }
}
开发者ID:WeiqiJust,项目名称:CHER-Ob,代码行数:43,代码来源:vtkOpenEXR.cpp

示例10: IMB_exr_begin_read

/* read from file */
int IMB_exr_begin_read(void *handle, const char *filename, int *width, int *height)
{
	ExrHandle *data= (ExrHandle *)handle;
	
	if(BLI_exists(filename) && BLI_filepathsize(filename)>32) {	/* 32 is arbitrary, but zero length files crashes exr */
		data->ifile = new InputFile(filename);
		if(data->ifile) {
			Box2i dw = data->ifile->header().dataWindow();
			data->width= *width  = dw.max.x - dw.min.x + 1;
			data->height= *height = dw.max.y - dw.min.y + 1;
			
			const ChannelList &channels = data->ifile->header().channels();
			
			for (ChannelList::ConstIterator i = channels.begin(); i != channels.end(); ++i)
				IMB_exr_add_channel(data, NULL, i.name(), 0, 0, NULL);
			
			return 1;
		}
	}
	return 0;
}
开发者ID:rexbron,项目名称:blender-ocio,代码行数:22,代码来源:openexr_api.cpp

示例11: updateCombos

void EXRReaderPlugin::updateCombos()
{
	const std::string filepath( getAbsoluteFirstFilename() );
	if( ! bfs::exists( filepath ) )
		return;
	
	// read dims
	InputFile in( filepath.c_str() );
	const Header& h  = in.header();
	const ChannelList& cl = h.channels();

	_par = h.pixelAspectRatio();

	Imf::Compression compression = h.compression();
	
	switch( compression )
	{
		case RLE_COMPRESSION:
			_paramFileCompression->setValue( eParamCompression_RLE );
			break;
		case ZIPS_COMPRESSION:
			_paramFileCompression->setValue( eParamCompression_ZIPS );
			break;
		case ZIP_COMPRESSION:
			_paramFileCompression->setValue( eParamCompression_ZIP );
			break;
		case PIZ_COMPRESSION:
			_paramFileCompression->setValue( eParamCompression_PIZ );
			break;
		case PXR24_COMPRESSION:
			_paramFileCompression->setValue( eParamCompression_PXR24 );
			break;
		case B44_COMPRESSION:
			_paramFileCompression->setValue( eParamCompression_B44 );
			break;
		case B44A_COMPRESSION:
			_paramFileCompression->setValue( eParamCompression_B44A );
			break;
		case NO_COMPRESSION:
			_paramFileCompression->setValue( eParamCompression_None );
			break;
		default:
			_paramFileCompression->setValue( eParamCompression_None );
			TUTTLE_LOG_WARNING( "EXRReader: Unknown compression " << compression );
			break;
	}
	
	// Hide output channel selection till we don't select a channel.
	for( std::size_t i = 0; i < _paramsChannelChoice.size(); ++i )
	{
		//_vChannelChoice[i]->setIsSecret( true );
		_paramsChannelChoice[i]->resetOptions();
	}
	_channelNames.clear();
	for( ChannelList::ConstIterator it = cl.begin(); it != cl.end(); ++it )
	{
		_channelNames.push_back( it.name() );
		//TUTTLE_LOG_VAR( it.name() );
		for( std::size_t j = 0; j < _paramsChannelChoice.size(); ++j )
		{
			_paramsChannelChoice[j]->appendOption( it.name() );
		}
	}
	switch( _channelNames.size() )
	{
		case 1:
		{
			for( std::size_t j = 0; j < _paramsChannelChoice.size(); j++ )
				_paramsChannelChoice.at(j)->setValue( 0 );
			break;
		}
		case 3:
		{
			for( std::size_t j = 0; j < _paramsChannelChoice.size() - 1; j++ )
				_paramsChannelChoice.at(j)->setValue( 2 - j );
			_paramsChannelChoice.at(3)->setValue( 0 );
			break;
		}
		case 4:
		{
			for( std::size_t j = 0; j < _paramsChannelChoice.size(); j++ )
				_paramsChannelChoice.at(j)->setValue( 3 - j );
			break;
		}
	}
	
	const std::string& firstChannelName = _channelNames[ _paramsChannelChoice[0]->getValue() ];
	Imf::PixelType firstChannelType = cl.find(firstChannelName.c_str()).channel().type;
	switch( firstChannelType )
	{
		case Imf::UINT:
			_paramFileBitDepth->setValue( eTuttlePluginFileBitDepth32 );
			break;
		case Imf::HALF:
			_paramFileBitDepth->setValue( eTuttlePluginFileBitDepth16f );
			break;
		case Imf::FLOAT:
			_paramFileBitDepth->setValue( eTuttlePluginFileBitDepth32f );
			break;
		default:
//.........这里部分代码省略.........
开发者ID:edubois,项目名称:TuttleOFX,代码行数:101,代码来源:EXRReaderPlugin.cpp

示例12: lock

void	
ScanLineInputFile::setFrameBuffer (const FrameBuffer &frameBuffer)
{
    Lock lock (*_streamData);

    
    
    const ChannelList &channels = _data->header.channels();
    for (FrameBuffer::ConstIterator j = frameBuffer.begin();
	 j != frameBuffer.end();
	 ++j)
    {
	ChannelList::ConstIterator i = channels.find (j.name());

	if (i == channels.end())
	    continue;

	if (i.channel().xSampling != j.slice().xSampling ||
	    i.channel().ySampling != j.slice().ySampling)
	    THROW (IEX_NAMESPACE::ArgExc, "X and/or y subsampling factors "
				"of \"" << i.name() << "\" channel "
				"of input file \"" << fileName() << "\" are "
				"not compatible with the frame buffer's "
				"subsampling factors.");
    }

    //
    // Check if the new frame buffer descriptor is
    // compatible with the image file header.
    //
    
    
    if (!GLOBAL_SYSTEM_LITTLE_ENDIAN)
    {
        _data->optimizationMode._destination._format = OptimizationMode::PIXELFORMAT_OTHER;
        _data->optimizationMode._source._format      = OptimizationMode::PIXELFORMAT_OTHER;
    }
    else
    {
        StringVector * v=NULL;
        if(hasMultiView(_data->header))
        {
            v = &multiView(_data->header);
        }
        _data->optimizationMode = detectOptimizationMode(frameBuffer, channels,v);
    }
    
    // TODO-pk this disables optimization
    // _data->optimizationMode._destination._format = Imf::OptimizationMode::PIXELFORMAT_OTHER;
    

    //
    // Initialize the slice table for readPixels().
    //

    vector<InSliceInfo> slices;
    ChannelList::ConstIterator i = channels.begin();

    for (FrameBuffer::ConstIterator j = frameBuffer.begin();
	 j != frameBuffer.end();
	 ++j)
    {
	while (i != channels.end() && strcmp (i.name(), j.name()) < 0)
	{
	    //
	    // Channel i is present in the file but not
	    // in the frame buffer; data for channel i
	    // will be skipped during readPixels().
	    //

	    slices.push_back (InSliceInfo (i.channel().type,
					   i.channel().type,
					   0, // base
					   0, // xStride
					   0, // yStride
					   i.channel().xSampling,
					   i.channel().ySampling,
					   false,  // fill
					   true, // skip
					   0.0)); // fillValue
	    ++i;
	}

	bool fill = false;

	if (i == channels.end() || strcmp (i.name(), j.name()) > 0)
	{
	    //
	    // Channel i is present in the frame buffer, but not in the file.
	    // In the frame buffer, slice j will be filled with a default value.
	    //

	    fill = true;
	}

	slices.push_back (InSliceInfo (j.slice().type,
				       fill? j.slice().type:
				             i.channel().type,
				       j.slice().base,
				       j.slice().xStride,
//.........这里部分代码省略.........
开发者ID:JohanAberg,项目名称:openexr,代码行数:101,代码来源:ImfScanLineInputFile.cpp

示例13: mexFunction

void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
    char *exrFileName;
    double *mxData;
    int width = 0;
    int height = 0;
    int nSlices = 0;
    
    if (nrhs != 1 || !mxIsChar(prhs[0])) {
        mexErrMsgTxt("Usage: ReadMultichannelEXR('exrFile')\n");
    }
    
    // read the exr file with OpenEXR general interface
    exrFileName = mxArrayToString(prhs[0]);
    InputFile file (exrFileName);
    
    // query general file properties
    Box2i dw = file.header().dataWindow();
    width = dw.max.x - dw.min.x + 1;
    height = dw.max.y - dw.min.y + 1;
    
    const ChannelList &channels = file.header().channels();
    for (ChannelList::ConstIterator iter = channels.begin();
    iter != channels.end();
    ++iter) {
        nSlices++;
    }
    
    mexPrintf("Read \"%s\": width=%d height=%d nSlices=%d\n",
            exrFileName, width, height, nSlices);
    mxFree(exrFileName);
    
    // return a struct with info about image slices
    mwSize nDims = 2;
    mwSize infoDims[] = {1, 0};
    infoDims[1] = nSlices;
    const char* fieldNames[] = {"name", "pixelType",
    "xSampling", "ySampling", "isLinear"};
    int nFields = sizeof(fieldNames)/sizeof(fieldNames[0]);
    plhs[0] = mxCreateStructArray(nDims, infoDims, nFields, fieldNames);
    
    // return a double array with size [height width nSlices]
    nDims = 3;
    mwSize dataDims[] = {0, 0, 0};
    dataDims[0] = height;
    dataDims[1] = width;
    dataDims[2] = nSlices;
    plhs[1] = mxCreateNumericArray(nDims, dataDims, mxDOUBLE_CLASS, mxREAL);
    if (NULL == plhs[1]) {
        mexPrintf("Could not allocate image array of size [%d %d %d]\n",
                dataDims[0], dataDims[1], dataDims[2]);
        return;
    }
    double* data = mxGetPr(plhs[1]);
    
    // fill in info struct and data array
    int channelIndex = 0;
    for (ChannelList::ConstIterator iter = channels.begin(); iter != channels.end(); ++iter) {
        const Channel &channel = iter.channel();
        
        // fill in info struct for this channel
        mxSetField(plhs[0], channelIndex, "name", mxCreateString(iter.name()));
        mxSetField(plhs[0], channelIndex, "xSampling", mxCreateDoubleScalar((double)channel.xSampling));
        mxSetField(plhs[0], channelIndex, "ySampling", mxCreateDoubleScalar((double)channel.ySampling));
        mxSetField(plhs[0], channelIndex, "isLinear", mxCreateLogicalScalar((mxLogical)channel.pLinear));
        
        // fill in a slice of the data matrix for this channel
        //  memory allocation depends on slice pixel type
        mxArray* typeName = NULL;
        FrameBuffer frameBuffer;
        switch (channel.type) {
            case UINT:{
                typeName = mxCreateString("UINT");
                
                // copy slice data from file to a frame buffer
                Array2D<MATLAB_UINT32> slicePixels;
                slicePixels.resizeErase(height, width);
                frameBuffer.insert(iter.name(),
                        Slice(HALF,
                        (char *)(&slicePixels[0][0] - dw.min.x - dw.min.y * width),
                        sizeof(slicePixels[0][0]) * 1,
                        sizeof(slicePixels[0][0]) * width,
                        channel.xSampling,
                        channel.ySampling,
                        0.0));
                file.setFrameBuffer (frameBuffer);
                file.readPixels (dw.min.y, dw.max.y);
                
                // copy slice data from frame buffer to data array
                for (int i = 0; i < height; i++) {
                    for (int j = 0; j < width; j++) {
                        data[M3I(height, width, i, j, channelIndex)] = slicePixels[i][j];
                    }
                }
                
                break;
            }
            
            case HALF:{
                typeName = mxCreateString("HALF");
//.........这里部分代码省略.........
开发者ID:RenderToolbox3,项目名称:RenderToolbox3,代码行数:101,代码来源:ReadMultichannelEXR.cpp

示例14: lock

void	
OutputFile::setFrameBuffer (const FrameBuffer &frameBuffer)
{
    Lock lock (*_data);
    
    //
    // Check if the new frame buffer descriptor
    // is compatible with the image file header.
    //

    const ChannelList &channels = _data->header.channels();

    for (ChannelList::ConstIterator i = channels.begin();
	 i != channels.end();
	 ++i)
    {
	FrameBuffer::ConstIterator j = frameBuffer.find (i.name());

	if (j == frameBuffer.end())
	    continue;

	if (i.channel().type != j.slice().type)
	{
	    THROW (Iex::ArgExc, "Pixel type of \"" << i.name() << "\" channel "
			        "of output file \"" << fileName() << "\" is "
			        "not compatible with the frame buffer's "
			        "pixel type.");
	}

	if (i.channel().xSampling != j.slice().xSampling ||
	    i.channel().ySampling != j.slice().ySampling)
	{
	    THROW (Iex::ArgExc, "X and/or y subsampling factors "
				"of \"" << i.name() << "\" channel "
				"of output file \"" << fileName() << "\" are "
				"not compatible with the frame buffer's "
				"subsampling factors.");
	}
    }
    
    //
    // Initialize slice table for writePixels().
    //

    vector<OutSliceInfo> slices;

    for (ChannelList::ConstIterator i = channels.begin();
	 i != channels.end();
	 ++i)
    {
	FrameBuffer::ConstIterator j = frameBuffer.find (i.name());

	if (j == frameBuffer.end())
	{
	    //
	    // Channel i is not present in the frame buffer.
	    // In the file, channel i will contain only zeroes.
	    //

	    slices.push_back (OutSliceInfo (i.channel().type,
					    0, // base
					    0, // xStride,
					    0, // yStride,
					    i.channel().xSampling,
					    i.channel().ySampling,
					    true)); // zero
	}
	else
	{
	    //
	    // Channel i is present in the frame buffer.
	    //

	    slices.push_back (OutSliceInfo (j.slice().type,
					    j.slice().base,
					    j.slice().xStride,
					    j.slice().yStride,
					    j.slice().xSampling,
					    j.slice().ySampling,
					    false)); // zero
	}
    }

    //
    // Store the new frame buffer.
    //

    _data->frameBuffer = frameBuffer;
    _data->slices = slices;
}
开发者ID:ezhangle,项目名称:CxlCommon,代码行数:90,代码来源:ImfOutputFile.cpp

示例15: ArgExc


//.........这里部分代码省略.........
        
    }

    //
    // The compression method must be one of the predefined values.
    //

    if (!isValidCompression (this->compression()))
  	throw IEX_NAMESPACE::ArgExc ("Unknown compression type in image header.");
    
    if(isDeepData(part_type))
    {
        if (!isValidDeepCompression (this->compression()))
            throw IEX_NAMESPACE::ArgExc ("Compression type in header not valid for deep data");
    }

    //
    // Check the channel list:
    //
    // If the file is tiled then for each channel, the type must be one of the
    // predefined values, and the x and y sampling must both be 1.
    //
    // If the file is not tiled then for each channel, the type must be one
    // of the predefined values, the x and y coordinates of the data window's
    // upper left corner must be divisible by the x and y subsampling factors,
    // and the width and height of the data window must be divisible by the
    // x and y subsampling factors.
    //

    const ChannelList &channels = this->channels();
    
    if (isTiled)
    {
	for (ChannelList::ConstIterator i = channels.begin();
	     i != channels.end();
	     ++i)
	{
	    if (i.channel().type != UINT &&
		i.channel().type != HALF &&
		i.channel().type != FLOAT)
	    {
		THROW (IEX_NAMESPACE::ArgExc, "Pixel type of \"" << i.name() << "\" "
			            "image channel is invalid.");
	    }

	    if (i.channel().xSampling != 1)
	    {
		THROW (IEX_NAMESPACE::ArgExc, "The x subsampling factor for the "
				    "\"" << i.name() << "\" channel "
				    "is not 1.");
	    }	

	    if (i.channel().ySampling != 1)
	    {
		THROW (IEX_NAMESPACE::ArgExc, "The y subsampling factor for the "
				    "\"" << i.name() << "\" channel "
				    "is not 1.");
	    }	
	}
    }
    else
    {
	for (ChannelList::ConstIterator i = channels.begin();
	     i != channels.end();
	     ++i)
	{
开发者ID:GerHobbelt,项目名称:openexr,代码行数:67,代码来源:ImfHeader.cpp


注:本文中的channellist::ConstIterator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。