MCPcopy Create free account
hub / github.com/a-e-k/canvas_ity / example_star

Function example_star

test/test.cpp:2078–2116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2076}
2077
2078void example_star( canvas &that, float width, float height )
2079{
2080 that.scale( width / 256.0f, height / 256.0f );
2081 that.move_to( 128.0f, 28.0f );
2082 that.line_to( 157.0f, 87.0f );
2083 that.line_to( 223.0f, 97.0f );
2084 that.line_to( 175.0f, 143.0f );
2085 that.line_to( 186.0f, 208.0f );
2086 that.line_to( 128.0f, 178.0f );
2087 that.line_to( 69.0f, 208.0f );
2088 that.line_to( 80.0f, 143.0f );
2089 that.line_to( 32.0f, 97.0f );
2090 that.line_to( 98.0f, 87.0f );
2091 that.close_path();
2092 that.set_shadow_blur( 8.0f );
2093 that.shadow_offset_y = 4.0f;
2094 that.set_shadow_color( 0.0f, 0.0f, 0.0f, 0.5f );
2095 that.set_color( fill_style, 1.0f, 0.9f, 0.2f, 1.0f );
2096 that.fill();
2097 that.line_join = rounded;
2098 that.set_line_width( 12.0f );
2099 that.set_color( stroke_style, 0.9f, 0.0f, 0.5f, 1.0f );
2100 that.stroke();
2101 float segments[] = { 21.0f, 9.0f, 1.0f, 9.0f, 7.0f, 9.0f, 1.0f, 9.0f };
2102 that.set_line_dash( segments, 8 );
2103 that.line_dash_offset = 10.0f;
2104 that.line_cap = circle;
2105 that.set_line_width( 6.0f );
2106 that.set_color( stroke_style, 0.95f, 0.65f, 0.15f, 1.0f );
2107 that.stroke();
2108 that.set_shadow_color( 0.0f, 0.0f, 0.0f, 0.0f );
2109 that.set_linear_gradient( fill_style, 64.0f, 0.0f, 192.0f, 256.0f );
2110 that.add_color_stop( fill_style, 0.30f, 1.0f, 1.0f, 1.0f, 0.0f );
2111 that.add_color_stop( fill_style, 0.35f, 1.0f, 1.0f, 1.0f, 0.8f );
2112 that.add_color_stop( fill_style, 0.45f, 1.0f, 1.0f, 1.0f, 0.8f );
2113 that.add_color_stop( fill_style, 0.50f, 1.0f, 1.0f, 1.0f, 0.0f );
2114 that.global_composite_operation = source_atop;
2115 that.fill_rectangle( 0.0f, 0.0f, 256.0f, 256.0f );
2116}
2117
2118void example_neon( canvas &that, float width, float height )
2119{

Callers

nothing calls this directly

Calls 14

scaleMethod · 0.80
move_toMethod · 0.80
line_toMethod · 0.80
close_pathMethod · 0.80
set_shadow_blurMethod · 0.80
set_shadow_colorMethod · 0.80
set_colorMethod · 0.80
fillMethod · 0.80
set_line_widthMethod · 0.80
strokeMethod · 0.80
set_line_dashMethod · 0.80
set_linear_gradientMethod · 0.80

Tested by

no test coverage detected