2 * Copyright © 2005 Red Hat, Inc.
3 * Copyright © 2006 Red Hat, Inc.
5 * Permission to use, copy, modify, distribute, and sell this software
6 * and its documentation for any purpose is hereby granted without
7 * fee, provided that the above copyright notice appear in all copies
8 * and that both that copyright notice and this permission notice
9 * appear in supporting documentation, and that the name of
10 * Red Hat, Inc. not be used in advertising or publicity pertaining to
11 * distribution of the software without specific, written prior
12 * permission. Red Hat, Inc. makes no representations about the
13 * suitability of this software for any purpose. It is provided "as
14 * is" without express or implied warranty.
16 * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
17 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
18 * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
19 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
20 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
21 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
22 * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
24 * Author: Carl D. Worth <cworth@cworth.org>
27 #include "cairo-test.h"
29 static cairo_test_status_t
30 draw (cairo_t *cr, int width, int height)
32 cairo_surface_t *surface;
34 0x80808080, 0x80808080, 0x80800000, 0x80800000,
35 0x80808080, 0x80808080, 0x80800000, 0x80800000,
37 0x80008000, 0x80008000, 0x80000080, 0x80000080,
38 0x80008000, 0x80008000, 0x80000080, 0x80000080
41 surface = cairo_image_surface_create_for_data ((unsigned char *) data,
42 CAIRO_FORMAT_ARGB32, 4, 4, 16);
44 cairo_test_paint_checkered (cr);
46 cairo_scale (cr, 4, 4);
48 cairo_set_source_surface (cr, surface, 2 , 2);
49 cairo_pattern_set_filter (cairo_get_source (cr), CAIRO_FILTER_NEAREST);
52 cairo_surface_finish (surface); /* data will go out of scope */
53 cairo_surface_destroy (surface);
55 return CAIRO_TEST_SUCCESS;
58 CAIRO_TEST (paint_source_alpha,
59 "Simple test of cairo_paint with a source surface with non-opaque alpha",
60 "paint, alpha", /* keywords */
61 NULL, /* requirements */