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

Method run

test/cairoTest/cairoTest.cpp:290–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288// image pattern
289struct TestImagePattern : public TestBase {
290 virtual void run( fli::cairo::Context &ctx ) {
291 Surface beyonceSurface( loadImage( app::App::loadResource( "Beyonce.jpg", RES_BEYONCE_JPG, "JPG" ) ), SurfaceConstraintsCairo() );
292 fli::shared_ptr<fli::cairo::SurfaceImage> image( new cairo::SurfaceImage( beyonceSurface ) );
293 fli::shared_ptr<fli::cairo::Pattern> pattern( fli::cairo::Pattern::createForSurface( image.get() ) );
294 pattern->setExtend( fli::cairo::EXTEND_REPEAT );
295
296 ctx.translate( 128.0, 128.0 );
297 ctx.rotate( M_PI / 4 );
298 ctx.scale( 1 / sqrt( 2.0 ), 1 / sqrt( 2.0 ) );
299 ctx.translate( -128.0, -128.0 );
300
301 fli::cairo::Matrix mtx;
302 mtx.initScale( image->getWidth() / 256.0 * 5.0, image->getHeight() / 256.0 * 5.0 );
303 pattern->setMatrix( &mtx );
304
305 ctx.setSource( pattern.get() );
306 ctx.rectangle( 0, 0, 256.0, 256.0 );
307 ctx.fill();
308 }
309};
310
311// multi segment caps

Callers

nothing calls this directly

Calls 15

loadImageFunction · 0.85
loadResourceFunction · 0.85
sqrtFunction · 0.85
setExtendMethod · 0.80
rotateMethod · 0.80
initScaleMethod · 0.80
setMatrixMethod · 0.80
getMethod · 0.45
translateMethod · 0.45
scaleMethod · 0.45
getWidthMethod · 0.45

Tested by

no test coverage detected