diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2010-07-07 17:21:03 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2010-07-07 17:21:03 +0000 |
| commit | 2f5eafec8d66d018d760b85a829c1d4ba1b0ed6d (patch) | |
| tree | 271bd139e254192743f02b6686aa33ee39e8c2a7 /src/display/cairo-utils.cpp | |
| parent | Smaller intermediate rendering regions (diff) | |
| download | inkscape-2f5eafec8d66d018d760b85a829c1d4ba1b0ed6d.tar.gz inkscape-2f5eafec8d66d018d760b85a829c1d4ba1b0ed6d.zip | |
Switch to nearest neighbor filtering when image is larger than original
(bzr r9508.1.12)
Diffstat (limited to 'src/display/cairo-utils.cpp')
| -rw-r--r-- | src/display/cairo-utils.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/display/cairo-utils.cpp b/src/display/cairo-utils.cpp index 8aaf838ed..bb401dc87 100644 --- a/src/display/cairo-utils.cpp +++ b/src/display/cairo-utils.cpp @@ -315,6 +315,20 @@ ink_cairo_pattern_set_matrix(cairo_pattern_t *cp, Geom::Matrix const &m) cairo_pattern_set_matrix(cp, &cm); } +void +ink_cairo_set_source_argb32_pixbuf(cairo_t *ct, GdkPixbuf *pb, double x, double y) +{ + guchar *data = gdk_pixbuf_get_pixels(pb); + int w = gdk_pixbuf_get_width(pb); + int h = gdk_pixbuf_get_height(pb); + int stride = gdk_pixbuf_get_rowstride(pb); + + cairo_surface_t *pbs = cairo_image_surface_create_for_data( + data, CAIRO_FORMAT_ARGB32, w, h, stride); + cairo_set_source_surface(ct, pbs, x, y); + cairo_surface_destroy(pbs); +} + // taken from Cairo sources static inline guint32 premul_alpha(guint32 color, guint32 alpha) { |
