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

Function example_button

test/test.cpp:1875–1907  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1873}
1874
1875void example_button( canvas &that, float width, float height )
1876{
1877 float left = roundf( 0.25f * width );
1878 float right = roundf( 0.75f * width );
1879 float top = roundf( 0.375f * height );
1880 float bottom = roundf( 0.625f * height );
1881 float mid_x = ( left + right ) * 0.5f;
1882 float mid_y = ( top + bottom ) * 0.5f;
1883 that.shadow_offset_x = 3.0f;
1884 that.shadow_offset_y = 3.0f;
1885 that.set_shadow_blur( 3.0f );
1886 that.set_shadow_color( 0.0f, 0.0f, 0.0f, 0.5f );
1887 that.set_linear_gradient( fill_style, 0.0f, top, 0.0f, bottom );
1888 that.add_color_stop( fill_style, 0.0f, 0.3f, 0.3f, 0.3f, 1.0f );
1889 that.add_color_stop( fill_style, 1.0f, 0.2f, 0.2f, 0.2f, 1.0f );
1890 that.move_to( left + 0.5f, mid_y );
1891 that.arc_to( left + 0.5f, top + 0.5f, mid_x, top + 0.5f, 4.0f );
1892 that.arc_to( right - 0.5f, top + 0.5f, right - 0.5f, mid_y, 4.0f );
1893 that.arc_to( right - 0.5f, bottom - 0.5f, mid_x, bottom - 0.5f, 4.0f );
1894 that.arc_to( left + 0.5f, bottom - 0.5f, left + 0.5f, mid_y, 4.0f );
1895 that.close_path();
1896 that.fill();
1897 that.set_shadow_color( 0.0f, 0.0f, 0.0f, 0.0f );
1898 that.set_font( &font_a[ 0 ], static_cast< int >( font_a.size() ), 0.075f * height );
1899 that.text_align = center;
1900 that.text_baseline = middle;
1901 that.set_color( fill_style, 0.8f, 0.8f, 0.8f, 1.0f );
1902 that.fill_text( "* Cats", 0.5f * width, 0.5f * height );
1903 that.set_color( fill_style, 0.4f, 0.4f, 0.4f, 1.0f );
1904 that.fill_rectangle( left + 4.0f, top + 1.0f, right - left - 8.0f, 1.0f );
1905 that.set_color( stroke_style, 0.1f, 0.1f, 0.1f, 1.0f );
1906 that.stroke();
1907}
1908
1909void example_smiley( canvas &that, float width, float height )
1910{

Callers

nothing calls this directly

Calls 13

set_shadow_blurMethod · 0.80
set_shadow_colorMethod · 0.80
set_linear_gradientMethod · 0.80
add_color_stopMethod · 0.80
move_toMethod · 0.80
arc_toMethod · 0.80
close_pathMethod · 0.80
fillMethod · 0.80
set_fontMethod · 0.80
set_colorMethod · 0.80
fill_textMethod · 0.80
fill_rectangleMethod · 0.80

Tested by

no test coverage detected