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
32 /* When we build only for backends other than gl,
33 include <cairo-gl.h> in blur.c will give errors.
44 #include "cairo-test.h"
46 static cairo_test_status_t
47 draw (cairo_t *cr, int width, int height)
49 const cairo_test_context_t *ctx = cairo_test_get_context (cr);
54 int radius = width / 4;
57 cairo_set_source_rgb (cr, 1, 1, 1);
64 cairo_arc (cr, x, y, radius, 0, 2 * M_PI);
65 cairo_set_line_width (cr, line_width);
66 cairo_set_draw_shadow_only (cr, 1);
67 cairo_set_shadow (cr, CAIRO_SHADOW_DROP);
68 cairo_set_shadow_rgba (cr, 0, 0, 0, 0.8);
69 cairo_set_shadow_blur (cr, 10, 10);
70 cairo_set_shadow_offset (cr, -42, -7);
73 /* ring with inset shadow */
74 cairo_arc (cr, x, y, radius, 0, 2 * M_PI);
75 cairo_set_line_width (cr, line_width);
76 cairo_set_source_rgb (cr, 0, 0.5, 0);
77 cairo_set_draw_shadow_only (cr, 0);
78 cairo_set_shadow (cr, CAIRO_SHADOW_INSET);
79 cairo_set_shadow_rgba (cr, 0, 0, 0, 1);
80 cairo_set_shadow_blur (cr, 5, 2);
81 cairo_set_shadow_offset (cr, 6, 1);
85 cairo_set_draw_shadow_only (cr, 1);
86 cairo_set_shadow (cr, CAIRO_SHADOW_DROP);
87 cairo_set_shadow_rgba (cr, 1, 1, 1, 1);
88 cairo_set_shadow_blur (cr, 5, 2);
89 cairo_set_line_width (cr, line_width/5);
90 cairo_set_source_rgb (cr, 0, 0.5, 0);
91 cairo_set_shadow_offset (cr, 6, 1);
92 cairo_arc (cr, x, y, radius, 0, 2 * M_PI);
97 return CAIRO_TEST_SUCCESS;
101 "Tests gaussian blur of a drawn image",
102 "gl, blur, operator", /* keywords */
103 NULL, /* requirements */