コード例 #1
0
void GoodNightMorningApp::resize( ResizeEvent event )
{
	Rectf svgBounds = mCityscapeSvg->getBounds(); // get the native bounds of the SVG
	// fit the SVG proportionally into the window
	mDrawBounds = svgBounds.getCenteredFit( getWindowBounds(), true );
	
	// Our SVG has two root groups, "Foreground" and "Background". Tweets are rendered between these two layers
	// Render each group into its own texture
	mForegroundTex = renderSvgGroupToTexture( *mCityscapeSvg, "Foreground", mDrawBounds, true );
	mBackgroundTex = renderSvgGroupToTexture( *mCityscapeSvg, "Background", mDrawBounds, false );
}
コード例 #2
0
ファイル: HelloSvgApp.cpp プロジェクト: notlion/Cinder-NanoVG
void HelloSvgApp::draw() {
  gl::clear(Color{0, 0, 0});
  gl::clear(GL_STENCIL_BUFFER_BIT);

  mNanoVG->beginFrame(getWindowSize(), getWindowContentScale());
  mNanoVG->translate(getWindowCenter());
  mNanoVG->scale(vec2(0.75f * float(getWindowHeight()) / float(mDoc->getHeight())));
  mNanoVG->translate(-mDoc->getBounds().getCenter());
  mNanoVG->fontFace("Roboto");
  mNanoVG->draw(*mDoc);
  mNanoVG->endFrame();
}