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


C++ TextLayout类代码示例

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


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

示例1: loadMovieFile

void QuickTimeSampleApp::loadMovieFile( const fs::path& moviePath )
{
	try {
		// load up the movie, set it to loop, and begin playing
		mMovie = qtime::MovieGl( moviePath );
		mMovie.setLoop();
		mMovie.play();
		
		// create a texture for showing some info about the movie
		TextLayout infoText;
		infoText.clear( ColorA( 0.2f, 0.2f, 0.2f, 0.5f ) );
		infoText.setColor( Color::white() );
		infoText.addCenteredLine( getPathFileName( moviePath.string() ) );
		infoText.addLine( toString( mMovie.getWidth() ) + " x " + toString( mMovie.getHeight() ) + " pixels" );
		infoText.addLine( toString( mMovie.getDuration() ) + " seconds" );
		infoText.addLine( toString( mMovie.getNumFrames() ) + " frames" );
		infoText.addLine( toString( mMovie.getFramerate() ) + " fps" );
		infoText.setBorder( 4, 2 );
		mInfoTexture = gl::Texture( infoText.render( true ) );
	}
	catch( ... ) {
		console() << "Unable to load the movie." << std::endl;
		mMovie.reset();
		mInfoTexture.reset();
	}

	mFrameTexture.reset();
}
开发者ID:kevinbs,项目名称:Cinder-portfolio,代码行数:28,代码来源:quickTimeSample.cpp

示例2: mTimeline

AccordionItem::AccordionItem( Timeline &timeline, float x, float y, float height, float contractedWidth, float expandedWidth, gl::Texture image, string title, string subtitle ) 
	: mTimeline(timeline), mX(x), mY(y), mWidth(contractedWidth), mHeight(height), mExpandedWidth(expandedWidth), mImage(image), mTitle(title), mSubtitle(subtitle)
{
#if defined( CINDER_COCOA )
	std::string normalFont( "Arial" );
	std::string boldFont( "Arial-BoldMT" );
#else
	std::string normalFont( "Arial" );
	std::string boldFont( "ArialBold" );
#endif
	
	mAnimEase = EaseOutAtan(25);
	mAnimDuration = 0.7f;
	
	mTextAlpha = 0.0f;
	
	TextLayout layout;
	layout.clear( ColorA( 0.6f, 0.6f, 0.6f, 0.0f ) );
	layout.setFont( Font( boldFont, 26 ) );
	layout.setColor( Color( 1, 1, 1 ) );
	layout.addLine( mTitle );
	layout.setFont( Font( normalFont, 16 ) );
	layout.addLine( mSubtitle );
	layout.setBorder(11, 6);
	mText = gl::Texture( layout.render( true ) );
	
	update();
}
开发者ID:ChadMcKinney,项目名称:Cinder,代码行数:28,代码来源:AccordionItem.cpp

示例3: drawError

void QRcode::draw()
{
	gl::pushMatrices();					
		gl::translate(startQRCodeHolderXY);
		gl::draw(qrCodeFon);

		if (isError)
		{
			drawError();			
		}
		else
		{
			if (isReady == false)
			{
				gl::pushMatrices();
					gl::translate(220, 650);	
					preloader.draw();			
				gl::popMatrices();
			}
			else
			{
				if(stringQrcode=="") return;
				//if (isRender == false)
				//{
					isRender = true;		
					qrCodeTexture = loadImageFromString(stringQrcode);

					TextLayout simple;
					simple.setFont( qrCodeFont );
					simple.setColor( Color( 1, 1, 1 ) );
					simple.addLine(url);
					qrCodeTextTexture = gl::Texture( simple.render( true, false ) );
				//}

				if(qrCodeTextTexture)
				{
					gl::pushMatrices();			
					gl::translate(33, 885);	
					gl::draw(qrCodeTextTexture);
					gl::popMatrices();
				}	

				if(qrCodeTexture)
				{
					gl::pushMatrices();			
					gl::translate(86, 505);		
					gl::draw(qrCodeTexture);
					gl::popMatrices();
				}

			}
		}

	gl::popMatrices();	
}
开发者ID:20SecondsToSun,项目名称:Funces,代码行数:55,代码来源:QRcode.cpp

示例4: loadMovieFile

void QuickTimeSampleApp::loadMovieFile( const fs::path &moviePath )
{
	try {
		// load up the movie, set it to loop, and begin playing
		mMovie = qtime::MovieGl::create( moviePath );
		mMovie->setLoop();
		mMovie->play();
		
		// create a texture for showing some info about the movie
		TextLayout infoText;
		infoText.clear( ColorA( 0.2f, 0.2f, 0.2f, 0.5f ) );
		infoText.setColor( Color::white() );
		infoText.addCenteredLine( moviePath.filename().string() );
		infoText.addLine( toString( mMovie->getWidth() ) + " x " + toString( mMovie->getHeight() ) + " pixels" );
		infoText.addLine( toString( mMovie->getDuration() ) + " seconds" );
		infoText.addLine( toString( mMovie->getNumFrames() ) + " frames" );
		infoText.addLine( toString( mMovie->getFramerate() ) + " fps" );
		infoText.setBorder( 4, 2 );
		mInfoTexture = gl::Texture::create( infoText.render( true ) );
	}
	catch( ci::Exception &exc ) {
		console() << "Exception caught trying to load the movie from path: " << moviePath << ", what: " << exc.what() << std::endl;
		mMovie.reset();
		mInfoTexture.reset();
	}

	mFrameTexture.reset();
}
开发者ID:ChristophPacher,项目名称:Cinder,代码行数:28,代码来源:QuickTimeBasicApp.cpp

示例5: layoutTooltipText

static const TextLayout layoutTooltipText (const String& text) throw()
{
    const float tooltipFontSize = 11.0f;
    const int maxToolTipWidth = 400;

    const Font f (tooltipFontSize, Font::plain);
    TextLayout tl (text, f);
    tl.layout (maxToolTipWidth, Justification::left, true);

    return tl;
}
开发者ID:Amcut,项目名称:pizmidi,代码行数:11,代码来源:piz_LookAndFeel.cpp

示例6: draw

void AttributedString::draw (Graphics& g, const Rectangle<float>& area) const
{
    if (text.isNotEmpty() && g.clipRegionIntersects (area.getSmallestIntegerContainer()))
    {
        if (! g.getInternalContext()->drawTextLayout (*this, area))
        {
            TextLayout layout;
            layout.createLayout (*this, area.getWidth());
            layout.draw (g, area);
        }
    }
}
开发者ID:Emisense,项目名称:S3Test,代码行数:12,代码来源:juce_AttributedString.cpp

示例7: setBtnId

void  Button::setBtnId(string value)
{
	if (isTextField ) 
	{
		code = value;
		TextLayout simple;
		simple.setFont( *textFont );	
		simple.setColor(Color::black());
		simple.addLine(Utils::cp1251_to_utf8(value.c_str()));		
		textTexture = gl::Texture( simple.render( true, false ) );	
	}
}
开发者ID:20SecondsToSun,项目名称:KinectPoseRecognition,代码行数:12,代码来源:Button.cpp

示例8: layoutTooltipText

    static TextLayout layoutTooltipText (const String& text, const Colour& colour) noexcept
    {
        const float tooltipFontSize = 13.0f;
        const int maxToolTipWidth = 400;

        AttributedString s;
        s.setJustification (Justification::centred);
        s.append (text, Font (tooltipFontSize, Font::bold), colour);

        TextLayout tl;
        tl.createLayoutWithBalancedLineLengths (s, (float) maxToolTipWidth);
        return tl;
    }
开发者ID:Amcut,项目名称:pizmidi,代码行数:13,代码来源:LookAndFeel.cpp

示例9: lime_text_layout_position

	value lime_text_layout_position (value textHandle, value fontHandle, value size, value textString, value data) {
		
		#if defined(LIME_FREETYPE) && defined(LIME_HARFBUZZ)
		
		TextLayout *text = (TextLayout*)(intptr_t)val_float (textHandle);
		Font *font = (Font*)(intptr_t)val_float (fontHandle);
		ByteArray bytes = ByteArray (data);
		text->Position (font, val_int (size), val_string (textString), &bytes);
		
		#endif
		
		return alloc_null ();
		
	}
开发者ID:fserb,项目名称:lime,代码行数:14,代码来源:ExternalInterface.cpp

示例10: saveFirst

void CatMemeMakerApp::saveFirst()
{
	TextLayout simple;

	std::string normalFont( "Arial" );

	simple.setFont( Font(normalFont,48) );
	simple.setColor( Color( 1, 1, 1 ) );
	simple.addCenteredLine(mMessage.str());

	mFirstLine = gl::Texture( simple.render( true , false ) );

	mMessage.str(" ");
}
开发者ID:foxmadnes,项目名称:CatMemeMaker,代码行数:14,代码来源:CatMemeMakerApp.cpp

示例11: make_tex

gl::TextureRef make_tex(std::string const& line)
{
    TextLayout layout;
    layout.setFont( Font( "Arial", 32 ) );
    layout.setColor( Color( 1, 1, 0 ) );

    layout.addLine( line );
    //if (stat_ == stat::over) {
    //    //layout.addLine( std::string("synths: ") );
    //} else if (stat_ == stat::pause) {
    //    layout.addLine( std::string("Pause") );
    //}
    return gl::Texture::create( layout.render( true ) );
}
开发者ID:gitter-badger,项目名称:cpp-tetris,代码行数:14,代码来源:box2d_basicApp.cpp

示例12: updateTexture

void ScrollingLabel::updateTexture()
{
    if (mText == "") {
        mTexture.reset();
    }
    else {
		TextLayout layout;
		layout.setFont( mFont );
		layout.setColor( mColor );			
		layout.addLine( mText );
		bool PREMULT = false;
		mTexture = gl::Texture( layout.render( true, PREMULT ) );        
    }
}
开发者ID:H-Plus-Time,项目名称:Planetary,代码行数:14,代码来源:ScrollingLabel.cpp

示例13: getWindowWidth

SceneInIsInside::SceneInIsInside()
{
	mmgr = make_shared<MovieManager>();

	mmgr->addMovie("innen.mp4", getWindowWidth()*0.5, getWindowHeight()*0.5, getWindowWidth(), getWindowHeight());


	std::string arial("Arial");

	TextLayout simple;
	simple.setFont(Font(arial, 16));
	simple.setColor(Color(1, 1, 1));
	simple.addLine("SceneInIsInside");
	text = gl::Texture2d::create(simple.render(true, PREMULT));
}
开发者ID:LarsEngeln,项目名称:orbZ,代码行数:15,代码来源:SceneInIsInside.cpp

示例14: lime_text_layout_position

	value lime_text_layout_position (value textHandle, value fontHandle, int size, HxString textString, value data) {
		
		#if defined(LIME_FREETYPE) && defined(LIME_HARFBUZZ)
		
		TextLayout *text = (TextLayout*)val_data (textHandle);
		Font *font = (Font*)val_data (fontHandle);
		Bytes bytes;
		bytes.Set (data);
		text->Position (font, size, textString.__s, &bytes);
		return bytes.Value ();
		
		#endif
		
		return alloc_null ();
		
	}
开发者ID:Rezmason,项目名称:lime,代码行数:16,代码来源:ExternalInterface.cpp

示例15: Color

void PathSimplificationApp::draw()
{
   	// clear out the window with black
	gl::clear( Color( 0, 0, 0 ) );
    
    cairo::SurfaceImage surface( getWindowWidth(), getWindowHeight());
    cairo::Context ctx( surface );
    
    // draw each path
    for(int i=0; i<mSmPaths.size(); i++){
        // pass the cairo context to draw onto
        drawPath(ctx, mSmPaths[i], drawMode);
    }
    
    // draw the surface
    gl::Texture myTexture = surface.getSurface();
    gl::draw(myTexture);
    
    
    TextLayout layout;
    layout.clear(ColorA(0.1f,0.1f,0.1f,0.7f));
    layout.setColor( Color( 0.9f, 0.9f, 0.9f ) );
    layout.setFont( Font( "Arial", 14 ) );
    
    
    SmoothPath* lastPath;
    if(mSmPaths.size() > 0){
        lastPath = mSmPaths[mSmPaths.size()-1];
    }
    
    if(mSmPaths.size() == 0){
        layout.addCenteredLine("Click and drag to draw a line.");
        layout.addCenteredLine("Press 'R' to clear.");
    }else if(mSmPaths.size() > 0 && lastPath->inProgress){
        int segCount = (lastPath->getPathPoints().size()>0) ? lastPath->getPathPoints().size()-1 : 0;
        layout.addCenteredLine( "Segment Count: " + boost::lexical_cast<std::string>(segCount));
    }else if(mSmPaths.size() > 0 && !lastPath->inProgress){
        int oldSegCount = (lastPath->getPathPoints().size()>0) ? lastPath->getPathPoints().size()-1 : 0;
        int segCount = lastPath->getCurrentPath().getNumSegments();
        int diff = oldSegCount - segCount;
        float per = (float(diff)/float(oldSegCount)) * 100.0f;
        string msg = boost::lexical_cast<std::string>(diff) + " of " + boost::lexical_cast<std::string>(oldSegCount) + " segments were removed. Saving " +boost::lexical_cast<std::string>(per) + "%";
        layout.addCenteredLine(msg);
    }
    
    
    Surface8u rendered = layout.render( true, PREMULT );
    mTextTexture = gl::Texture( rendered );
    
    if( mTextTexture )
		gl::draw( mTextTexture,  Vec2f(10, 10)  );
}
开发者ID:gregkepler,项目名称:CinderPathFitter,代码行数:52,代码来源:PathSimplificationApp.cpp


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