2 * Copyright © 2013 Samsung Electronics
4 * Permission is hereby granted, free of charge, to any person
5 * obtaining a copy of this software and associated documentation
6 * files (the "Software"), to deal in the Software without
7 * restriction, including without limitation the rights to use, copy,
8 * modify, merge, publish, distribute, sublicense, and/or sell copies
9 * of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 * Bryce Harrington <b.harrington@samsung.com>
26 * Henry Song <henry.song@samsung.com>
29 /* This test exercises gaussian blur rendering
39 #include "cairo-test.h"
41 static cairo_test_status_t
42 draw (cairo_t *cr, int width, int height)
44 const cairo_test_context_t *ctx = cairo_test_get_context (cr);
49 int radius = width / 4;
52 cairo_set_source_rgb (cr, 1, 1, 1);
59 cairo_arc (cr, x, y, radius, 0, 2 * M_PI);
60 cairo_set_line_width (cr, line_width);
61 cairo_set_draw_shadow_only (cr, 1);
62 cairo_set_shadow (cr, CAIRO_SHADOW_DROP);
63 cairo_set_shadow_rgba (cr, 0, 0, 0, 0.8);
64 cairo_set_shadow_blur (cr, 10, 10);
65 cairo_set_shadow_offset (cr, -42, -7);
68 /* ring with inset shadow */
69 cairo_arc (cr, x, y, radius, 0, 2 * M_PI);
70 cairo_set_line_width (cr, line_width);
71 cairo_set_source_rgb (cr, 0, 0.5, 0);
72 cairo_set_draw_shadow_only (cr, 0);
73 cairo_set_shadow (cr, CAIRO_SHADOW_INSET);
74 cairo_set_shadow_rgba (cr, 0, 0, 0, 1);
75 cairo_set_shadow_blur (cr, 5, 2);
76 cairo_set_shadow_offset (cr, 6, 1);
80 cairo_set_draw_shadow_only (cr, 1);
81 cairo_set_shadow (cr, CAIRO_SHADOW_DROP);
82 cairo_set_shadow_rgba (cr, 1, 1, 1, 1);
83 cairo_set_shadow_blur (cr, 5, 2);
84 cairo_set_line_width (cr, line_width/5);
85 cairo_set_source_rgb (cr, 0, 0.5, 0);
86 cairo_set_shadow_offset (cr, 6, 1);
87 cairo_arc (cr, x, y, radius, 0, 2 * M_PI);
92 return CAIRO_TEST_SUCCESS;
96 "Tests gaussian blur of a drawn image",
97 "gl, blur, operator", /* keywords */
98 NULL, /* requirements */