| 1950 | } |
| 1951 | |
| 1952 | void example_knot( canvas &that, float width, float height ) |
| 1953 | { |
| 1954 | float points[ 6 ][ 8 ] = { |
| 1955 | { 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f }, |
| 1956 | { -1.0f, -1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f }, |
| 1957 | { 2.0f, 1.0f, 2.0f, -2.0f, -1.0f, -2.0f, -1.0f, -1.0f }, |
| 1958 | { -2.0f, -1.0f, -2.0f, 2.0f, 1.0f, 2.0f, 1.0f, 1.0f }, |
| 1959 | { -2.0f, -1.0f, -2.0f, -3.0f, 0.0f, -3.0f, 0.0f, -1.0f }, |
| 1960 | { 2.0f, 1.0f, 2.0f, 3.0f, 0.0f, 3.0f, 0.0f, 1.0f }, |
| 1961 | }; |
| 1962 | that.translate( width * 0.5f, height * 0.5f ); |
| 1963 | that.scale( width * 0.17f, height * 0.17f ); |
| 1964 | that.rotate( -15.0f * 3.14159265f / 180.0f ); |
| 1965 | for ( int index = 0; index < 6; ++index ) |
| 1966 | { |
| 1967 | that.begin_path(); |
| 1968 | that.move_to( |
| 1969 | 1.01f * points[ index ][ 0 ] - 0.01f * points[ index ][ 2 ], |
| 1970 | 1.01f * points[ index ][ 1 ] - 0.01f * points[ index ][ 3 ] ); |
| 1971 | that.line_to( points[ index ][ 0 ], points[ index ][ 1 ] ); |
| 1972 | that.bezier_curve_to( points[ index ][ 2 ], points[ index ][ 3 ], |
| 1973 | points[ index ][ 4 ], points[ index ][ 5 ], |
| 1974 | points[ index ][ 6 ], points[ index ][ 7 ] ); |
| 1975 | that.line_to( |
| 1976 | -0.01f * points[ index ][ 4 ] + 1.01f * points[ index ][ 6 ], |
| 1977 | -0.01f * points[ index ][ 5 ] + 1.01f * points[ index ][ 7 ] ); |
| 1978 | that.set_color( stroke_style, 0.0f, 0.0f, 0.0f, 1.0f ); |
| 1979 | that.set_line_width( 0.75f ); |
| 1980 | that.line_cap = butt; |
| 1981 | that.stroke(); |
| 1982 | that.set_radial_gradient( stroke_style, |
| 1983 | 0.0f, 0.0f, 0.0f, |
| 1984 | 0.0f, 0.0f, 3.0f ); |
| 1985 | that.add_color_stop( stroke_style, 0.0f, 0.8f, 1.0f, 0.6f, 1.0f ); |
| 1986 | that.add_color_stop( stroke_style, 1.0f, 0.1f, 0.5f, 0.1f, 1.0f ); |
| 1987 | that.set_line_width( 0.5f ); |
| 1988 | that.line_cap = circle; |
| 1989 | that.stroke(); |
| 1990 | } |
| 1991 | } |
| 1992 | |
| 1993 | void example_icon( canvas &that, float width, float height ) |
| 1994 | { |
nothing calls this directly
no test coverage detected