| 2045 | } |
| 2046 | |
| 2047 | void example_illusion( canvas &that, float width, float height ) |
| 2048 | { |
| 2049 | that.set_color( fill_style, 0.0f, 0.4f, 1.0f, 1.0f ); |
| 2050 | that.fill_rectangle( 0.0f, 0.0f, width, height ); |
| 2051 | that.set_color( fill_style, 0.8f, 0.8f, 0.0f, 1.0f ); |
| 2052 | that.set_line_width( 0.4f ); |
| 2053 | for ( float spot = 0.0f; spot < 240.0f; spot += 1.0f ) |
| 2054 | { |
| 2055 | float angle = fmodf( spot * 0.61803398875f, 1.0f ) * 6.28318531f; |
| 2056 | float radius = spot / 240.0f * 0.5f * hypotf( width, height ); |
| 2057 | float size = min( width, height ) * sqrtf( spot ) / 240.0f; |
| 2058 | that.set_transform( 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f ); |
| 2059 | that.translate( 0.5f * width + radius * cosf( angle ), |
| 2060 | 0.5f * height + radius * sinf( angle ) ); |
| 2061 | that.rotate( angle - 1.3f ); |
| 2062 | that.scale( 0.8f * size, 0.6f * size ); |
| 2063 | that.rotate( 1.3f ); |
| 2064 | that.begin_path(); |
| 2065 | that.arc( 0.0f, 0.0f, 1.0f, 0.0f, 6.28318531f ); |
| 2066 | that.fill(); |
| 2067 | that.begin_path(); |
| 2068 | that.arc( 0.0f, 0.0f, 1.0f, 0.0f, 3.14159265f ); |
| 2069 | that.set_color( stroke_style, 1.0f, 1.0f, 1.0f, 1.0f ); |
| 2070 | that.stroke(); |
| 2071 | that.begin_path(); |
| 2072 | that.arc( 0.0f, 0.0f, 1.0f, 3.14159265f, 6.28318531f ); |
| 2073 | that.set_color( stroke_style, 0.0f, 0.0f, 0.0f, 1.0f ); |
| 2074 | that.stroke(); |
| 2075 | } |
| 2076 | } |
| 2077 | |
| 2078 | void example_star( canvas &that, float width, float height ) |
| 2079 | { |
nothing calls this directly
no test coverage detected