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


C++ path::external_file_string方法代码示例

本文整理汇总了C++中boost::filesystem::path::external_file_string方法的典型用法代码示例。如果您正苦于以下问题:C++ path::external_file_string方法的具体用法?C++ path::external_file_string怎么用?C++ path::external_file_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在boost::filesystem::path的用法示例。


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

示例1: write_half_exr

void write_half_exr( const boost::filesystem::path& p, Imf::Header& header,
			    const image::const_image_view_t& view, bool write_alpha)
{
    boost::gil::rgba16f_image_t img( view.width(), view.height());
    boost::gil::copy_and_convert_pixels( view, boost::gil::view( img));

    header.channels().insert( "R", Imf::HALF);
    header.channels().insert( "G", Imf::HALF);
    header.channels().insert( "B", Imf::HALF);

    if( write_alpha)
        header.channels().insert( "A", Imf::HALF);

    Imf::FrameBuffer frameBuffer;

    char *ptr = (char *) boost::gil::interleaved_view_get_raw_data( boost::gil::view( img));
    std::size_t xstride = 4 * sizeof(half);
    std::size_t ystride = xstride * img.width();

    frameBuffer.insert( "R", Imf::Slice( Imf::HALF, ptr, xstride, ystride)); ptr += sizeof(half);
    frameBuffer.insert( "G", Imf::Slice( Imf::HALF, ptr, xstride, ystride)); ptr += sizeof(half);
    frameBuffer.insert( "B", Imf::Slice( Imf::HALF, ptr, xstride, ystride)); ptr += sizeof(half);

    if( write_alpha)
        frameBuffer.insert( "A", Imf::Slice( Imf::HALF, ptr, xstride, ystride));

    Imf::OutputFile out_file( p.external_file_string().c_str(), header);
    out_file.setFrameBuffer( frameBuffer);
    out_file.writePixels( img.height());
}
开发者ID:apextw,项目名称:Ramen,代码行数:30,代码来源:write_exr.cpp

示例2: runtime_error

boost::filesystem::path readlink(const boost::filesystem::path&
#ifndef BOOST_WINDOWS_API
		path
#endif
		)
{
#ifdef BOOST_WINDOWS_API
	throw std::runtime_error("readlink() not implemented on Windows");
#else
	string link(path.external_file_string());
	vector<char> buf(512);

	for (;;)
	{
		const ssize_t len = readlink(link.c_str(), &buf[0], buf.size());
		if (len == -1)
		{
			if (errno == ENAMETOOLONG)
			{
				buf.resize(2 * buf.size());
				continue;
			}

			throw system_error(error_code(errno, get_system_category()));
		}

		return path.parent_path() / string(&buf[0], len);
	}
#endif
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例3: stream_do_open

static void stream_do_open(Fstream& s,
                           const fs::path& path,
                           const std::ios_base::openmode mode,
                           typename boost::enable_if<is_std_fstream<Fstream> >::type* = 0)
{
	string file(path.external_file_string());
	s.open(file.c_str(), mode);
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例4: do_write_image

void png_writer_t::do_write_image( const boost::filesystem::path& p,
				const image::const_image_view_t& view,
				const adobe::dictionary_t& params) const
{
    int channels = adobe::get_value( params, adobe::name_t( "channels")).cast<int>();

    std::auto_ptr<OpenImageIO::ImageOutput> out( OpenImageIO::ImageOutput::create( p.external_file_string()));

    if( !out.get())
	throw std::runtime_error( "Write PNG: Can't open output file");

    if( channels)
	channels = 3;
    else
	channels = 4;

    OpenImageIO::ImageSpec spec( view.width(), view.height(), channels, TypeDesc::UINT8);
    spec.quant_dither = 0.0f;

    if( !out->open( p.external_file_string(), spec))
	throw( std::runtime_error( "Can't open output file"));
    
    std::vector<image::pixel_t> scanline( view.width());

    for( int y = 0; y < view.height(); ++y)
    {
	std::copy( view.row_begin( y), view.row_end( y), scanline.begin());
	apply_gamma( 1.0f / 2.2f, scanline.begin(), scanline.end());
	clamp( scanline.begin(), scanline.end());

	if( !out->write_scanline( y, 0, TypeDesc::FLOAT, (void *) &( *scanline.begin()), sizeof( image::pixel_t)))
	    throw( std::runtime_error( "Write image: Can't write pixels"));
    }

    if( !out->close())
	throw std::runtime_error( "Write image: Can't close file");
}
开发者ID:apextw,项目名称:Ramen,代码行数:37,代码来源:png_writer.cpp


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