summaryrefslogtreecommitdiff
path: root/src/cairo-surface.c
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2006-06-09 16:52:17 -0700
committerCarl Worth <cworth@cworth.org>2006-06-09 16:52:17 -0700
commitb2f274b3e86983b312ec19e33b3a1231bd3e51d0 (patch)
tree378e2a02d876b888eeb5ab33e45adb588d6d7c4d /src/cairo-surface.c
parenta812b3c4908ff296877a648915d5f06696eebe9e (diff)
New API: Replace cairo_{ps,pdf,svg}_set_dpi with new cairo_surface_set_fallback_resolution.
This just provides the mechanics for storing the value and removing the old function calls. The new value is still not used anywhere (though nor where the old values), so there should be no functional change (other than forcing any programs calling the old API to be updated).
Diffstat (limited to 'src/cairo-surface.c')
-rw-r--r--src/cairo-surface.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 39b018cf5..1f0a6b630 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -55,6 +55,8 @@ const cairo_surface_t _cairo_surface_nil = {
}, /* user_data */
0.0, /* device_x_offset */
0.0, /* device_y_offset */
+ 0.0, /* x_fallback_resolution */
+ 0.0, /* y_fallback_resolution */
0, /* next_clip_serial */
0 /* current_clip_serial */
};
@@ -73,6 +75,8 @@ const cairo_surface_t _cairo_surface_nil_file_not_found = {
}, /* user_data */
0.0, /* device_x_offset */
0.0, /* device_y_offset */
+ 0.0, /* x_fallback_resolution */
+ 0.0, /* y_fallback_resolution */
0, /* next_clip_serial */
0 /* current_clip_serial */
};
@@ -91,6 +95,8 @@ const cairo_surface_t _cairo_surface_nil_read_error = {
}, /* user_data */
0.0, /* device_x_offset */
0.0, /* device_y_offset */
+ 0.0, /* x_fallback_resolution */
+ 0.0, /* y_fallback_resolution */
0, /* next_clip_serial */
0 /* current_clip_serial */
};
@@ -200,6 +206,9 @@ _cairo_surface_init (cairo_surface_t *surface,
surface->device_x_offset = 0.0;
surface->device_y_offset = 0.0;
+ surface->x_fallback_resolution = CAIRO_SURFACE_FALLBACK_RESOLUTION_DEFAULT;
+ surface->y_fallback_resolution = CAIRO_SURFACE_FALLBACK_RESOLUTION_DEFAULT;
+
surface->clip = NULL;
surface->next_clip_serial = 0;
surface->current_clip_serial = 0;
@@ -651,6 +660,38 @@ cairo_surface_get_device_offset (cairo_surface_t *surface,
*y_offset = surface->device_y_offset;
}
+/**
+ * cairo_surface_set_fallback_resolution:
+ * @surface: a #cairo_surface_t
+ * @x_pixels_per_inch: horizontal setting for pixels per inch
+ * @y_pixels_per_inch: vertical setting for pixels per inch
+ *
+ * Set the horizontal and vertical resolution for image fallbacks.
+ *
+ * When certain operations aren't supported natively by a backend,
+ * cairo will fallback by rendering operations to an image and then
+ * overlaying that image onto the output. For backends that are
+ * natively vector-oriented, this function can be used to set the
+ * resolution used for these image fallbacks, (larger values will
+ * result in more detailed images, but also larger file sizes).
+ *
+ * Some examples of natively vector-oriented backends are the ps, pdf,
+ * and svg backends.
+ *
+ * For backends that are natively raster-oriented, image fallbacks are
+ * still possible, but they are always performed at the native
+ * device resolution. So this function has no effect on those
+ * backends.
+ **/
+void
+cairo_surface_set_fallback_resolution (cairo_surface_t *surface,
+ double x_pixels_per_inch,
+ double y_pixels_per_inch)
+{
+ surface->x_fallback_resolution = x_pixels_per_inch;
+ surface->y_fallback_resolution = y_pixels_per_inch;
+}
+
cairo_bool_t
_cairo_surface_has_device_offset_or_scale (cairo_surface_t *surface)
{
@@ -1934,3 +1975,6 @@ _cairo_surface_copy_pattern_for_destination (const cairo_pattern_t *pattern,
_cairo_pattern_transform (pattern_out, &device_to_surface);
}
}
+
+/* LocalWords: rasterized
+ */