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

Method prepareSource

blocks/Cairo/src/Cairo.cpp:1894–1912  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1892 bool prepareSourceFill( const svg::Node &node ) { return prepareSource( node, mFillStack, mFillOpacityStack ); }
1893 bool prepareSourceStroke( const svg::Node &node ) { return prepareSource( node, mStrokeStack, mStrokeOpacityStack ); }
1894 bool prepareSource( const svg::Node &node, const std::vector<svg::Paint> &paintStack, const std::vector<float> &opacityStack ) {
1895 if( paintStack.back().isNone() )
1896 return false;
1897 else if( paintStack.back().isLinearGradient() ) {
1898 cairo::GradientLinear grad( paintStack.back().getCoords0(), paintStack.back().getCoords1() );
1899 prepareGradientSource( node, paintStack.back(), grad, opacityStack.back() );
1900 return true;
1901 }
1902 else if( paintStack.back().isRadialGradient() ) {
1903 cairo::GradientRadial grad( paintStack.back().getCoords1(), 0, paintStack.back().getCoords0(), paintStack.back().getRadius() );
1904 prepareGradientSource( node, paintStack.back(), grad, opacityStack.back() );
1905 return true;
1906 }
1907 else { // solid color or other
1908 ColorA color( paintStack.back().getColor() ); color.a = opacityStack.back();
1909 mCtx.setSource( color );
1910 return true;
1911 }
1912 }
1913 void prepareGradientSource( const svg::Node &node, const svg::Paint &paint, cairo::Gradient &grad, float opacity ) {
1914 if( paint.useObjectBoundingBox() ) {
1915 Rectf bb = node.getBoundingBox();

Callers

nothing calls this directly

Calls 3

backMethod · 0.80
getRadiusMethod · 0.45
setSourceMethod · 0.45

Tested by

no test coverage detected