diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2010-08-04 03:45:58 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2010-08-04 03:45:58 +0000 |
| commit | 30884b9e814d7baaa2299803e8cb76cf203ca084 (patch) | |
| tree | 579df4681a79a963913cea8d4891405d74280615 /src/display/cairo-utils.cpp | |
| parent | Fix pattern viewBox (diff) | |
| download | inkscape-30884b9e814d7baaa2299803e8cb76cf203ca084.tar.gz inkscape-30884b9e814d7baaa2299803e8cb76cf203ca084.zip | |
Wholesale cruft removal part 1
(bzr r9508.1.44)
Diffstat (limited to 'src/display/cairo-utils.cpp')
| -rw-r--r-- | src/display/cairo-utils.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/display/cairo-utils.cpp b/src/display/cairo-utils.cpp index 25a1e7988..15fceedae 100644 --- a/src/display/cairo-utils.cpp +++ b/src/display/cairo-utils.cpp @@ -457,6 +457,32 @@ ink_cairo_surface_get_height(cairo_surface_t *surface) return cairo_image_surface_get_height(surface); } +cairo_pattern_t * +ink_cairo_pattern_create_checkerboard() +{ + int const w = 8; + int const h = 8; + + cairo_surface_t *s = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 2*w, 2*h); + + cairo_t *ct = cairo_create(s); + cairo_set_operator(ct, CAIRO_OPERATOR_SOURCE); + cairo_set_source_rgb(ct, 0.75, 0.75, 0.75); + cairo_paint(ct); + cairo_set_source_rgb(ct, 0.5, 0.5, 0.5); + cairo_rectangle(ct, 0, 0, w, h); + cairo_rectangle(ct, w, h, w, h); + cairo_fill(ct); + cairo_destroy(ct); + + cairo_pattern_t *p = cairo_pattern_create_for_surface(s); + cairo_pattern_set_extend(p, CAIRO_EXTEND_REPEAT); + cairo_pattern_set_filter(p, CAIRO_FILTER_NEAREST); + + cairo_surface_destroy(s); + return p; +} + /** * @brief Convert pixel data from GdkPixbuf format to ARGB. * This will convert pixel data from GdkPixbuf format to Cairo's native pixel format. |
