summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog16
-rw-r--r--TODO6
-rw-r--r--src/cairo-image-surface.c1
-rw-r--r--src/cairo-surface.c11
-rw-r--r--src/cairo.c50
-rw-r--r--src/cairo.h21
-rw-r--r--src/cairoint.h1
7 files changed, 78 insertions, 28 deletions
diff --git a/ChangeLog b/ChangeLog
index a16ae963..614de05e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2005-04-01 Carl Worth <cworth@cworth.org>
+
+ * TODO: Update API shakeup chart.
+
+ * src/cairo.h:
+ * src/cairo.c: (cairo_set_target_image_no_data): Add a standin for
+ the function that should be cairo_set_target_image which should
+ then have some other name. We can straighten that mess out when we
+ eliminate the set_target functions. Add deprecation alias for
+ cairo_current_pattern.
+
+ * src/cairoint.h:
+ * src/cairo-image-surface.c:
+ * src/cairo-surface.c: Deprecate cairo_surface_create_for_image in
+ favor of cairo_image_surface_create_for_data.
+
2005-03-31 Kristian Høgsberg <krh@redhat.com>
* src/cairo.c (cairo_set_target_png): Remove this function now
diff --git a/TODO b/TODO
index 33df4b39..dd393b45 100644
--- a/TODO
+++ b/TODO
@@ -15,11 +15,11 @@ PDRTC cairo_current_path -> cairo_copy_path_data
PDR C cairo_surface_finish, cairo_surface_flush
PD C Abbreviation hunt: cairo_init_clip and cairo_concat_matrix
----- Renaming the terms of the rendering equation
- Making set_source consistent
+PD default matrix
cairo_paint
cairo_begin_group, cairo_end_group, cairo_get_group
- cairo_stroke_path -> cairo_stroke_to_path
- default matrix
+ Making set_source consistent
+----- cairo_stroke_path -> cairo_stroke_to_path
cairo_current_matrix
cairo_mask
cairo_create and eliminating cairo_set_target_surface
diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 106fcf0e..abaec018 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -223,6 +223,7 @@ cairo_image_surface_create_for_data (char *data,
return &surface->base;
}
+DEPRECATE(cairo_surface_create_for_image, cairo_image_surface_create_for_data);
static cairo_surface_t *
_cairo_image_surface_create_similar (void *abstract_src,
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index f9c84784..213852d1 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -65,17 +65,6 @@ _cairo_surface_init (cairo_surface_t *surface,
}
cairo_surface_t *
-cairo_surface_create_for_image (char *data,
- cairo_format_t format,
- int width,
- int height,
- int stride)
-{
- return cairo_image_surface_create_for_data (data, format, width, height, stride);
-}
-slim_hidden_def(cairo_surface_create_for_image);
-
-cairo_surface_t *
_cairo_surface_create_similar_scratch (cairo_surface_t *other,
cairo_format_t format,
int drawable,
diff --git a/src/cairo.c b/src/cairo.c
index b72c7a3b..2df39dc8 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -324,7 +324,7 @@ slim_hidden_def(cairo_set_target_surface);
* Directs output for a #cairo_t to an in-memory image. The output
* buffer must be kept around until the #cairo_t is destroyed or set
* to to have a different target. The initial contents of @buffer
- * will be used as the inital image contents; you must explicitely
+ * will be used as the inital image contents; you must explicitly
* clear the buffer, using, for example, cairo_rectangle() and
* cairo_fill() if you want it cleared.
**/
@@ -342,9 +342,50 @@ cairo_set_target_image (cairo_t *cr,
if (cr->status)
return;
- surface = cairo_surface_create_for_image (data,
- format,
- width, height, stride);
+ surface = cairo_image_surface_create_for_data (data,
+ format,
+ width, height, stride);
+ if (surface == NULL) {
+ cr->status = CAIRO_STATUS_NO_MEMORY;
+ CAIRO_CHECK_SANITY (cr);
+ return;
+ }
+
+ cairo_set_target_surface (cr, surface);
+
+ cairo_surface_destroy (surface);
+ CAIRO_CHECK_SANITY (cr);
+}
+
+/**
+ * cairo_set_target_image_no_data:
+ * @cr: a #cairo_t
+ * @format: the format of pixels in the buffer
+ * @width: the width of the image to be stored in the buffer
+ * @height: the eight of the image to be stored in the buffer
+ *
+ * Directs output for a #cairo_t to an implicit image surface of the
+ * given format that will be created and owned by the cairo
+ * context. The initial contents of the target surface will be
+ * cleared to 0 in all channels, (ie. transparent black).
+ *
+ * NOTE: This function has an unconventional name, but that will be
+ * straightened out in a future change in which all set_target
+ * functions will be renamed.
+ **/
+void
+cairo_set_target_image_no_data (cairo_t *cr,
+ cairo_format_t format,
+ int width,
+ int height)
+{
+ cairo_surface_t *surface;
+
+ CAIRO_CHECK_SANITY (cr);
+ if (cr->status)
+ return;
+
+ surface = cairo_image_surface_create (format, width, height);
if (surface == NULL) {
cr->status = CAIRO_STATUS_NO_MEMORY;
CAIRO_CHECK_SANITY (cr);
@@ -687,6 +728,7 @@ cairo_get_pattern (cairo_t *cr)
CAIRO_CHECK_SANITY (cr);
return _cairo_gstate_get_pattern (cr->gstate);
}
+DEPRECATE(cairo_current_pattern, cairo_get_pattern);
/**
* cairo_set_tolerance:
diff --git a/src/cairo.h b/src/cairo.h
index ee2a4b9f..274a47c5 100644
--- a/src/cairo.h
+++ b/src/cairo.h
@@ -173,7 +173,10 @@ typedef enum cairo_format {
CAIRO_FORMAT_A1
} cairo_format_t;
-/* XXX: Need to add cairo_set_target_image_data */
+/* XXX: The naming of these two functions is reversed from their
+ * cairo_image_surface_create counterparts. We'll fix this when
+ * we eliminate all the cairo_set_target functions.
+ */
void
cairo_set_target_image (cairo_t *cr,
char *data,
@@ -182,6 +185,12 @@ cairo_set_target_image (cairo_t *cr,
int height,
int stride);
+void
+cairo_set_target_image_no_data (cairo_t *cr,
+ cairo_format_t format,
+ int width,
+ int height);
+
typedef enum cairo_operator {
CAIRO_OPERATOR_CLEAR,
CAIRO_OPERATOR_SRC,
@@ -825,14 +834,6 @@ cairo_status_string (cairo_t *cr);
typedef void (*cairo_destroy_func_t) (void *data);
/* Surface manipulation */
-/* XXX: We may want to rename this function in light of the new
- virtualized surface backends... */
-cairo_surface_t *
-cairo_surface_create_for_image (char *data,
- cairo_format_t format,
- int width,
- int height,
- int stride);
/* XXX: I want to remove this function, (replace with
cairo_set_target_scratch or similar). */
@@ -1070,6 +1071,7 @@ typedef cairo_status_t (*cairo_write_func_t) (void *closure,
#define cairo_inverse_transform_point cairo_inverse_transform_point_DEPRECATED_BY_cairo_device_to_user
#define cairo_inverse_transform_distance cairo_inverse_transform_distance_DEPRECATED_BY_cairo_device_to_user_distance
#define cairo_init_clip cairo_init_clip_DEPRECATED_BY_cairo_reset_clip
+#define cairo_surface_create_for_image cairo_surface_create_for_image_DEPRECATED_BY_cairo_image_surface_create_for_data
#else /* CAIRO_API_SHAKEUP_FLAG_DAY */
@@ -1097,6 +1099,7 @@ typedef cairo_status_t (*cairo_write_func_t) (void *closure,
#define cairo_inverse_transform_point cairo_device_to_user
#define cairo_inverse_transform_distance cairo_device_to_user_distance
#define cairo_init_clip cairo_reset_clip
+#define cairo_surface_create_for_image cairo_image_surface_create_for_data
#endif /* CAIRO_API_SHAKEUP_FLAG_DAY */
diff --git a/src/cairoint.h b/src/cairoint.h
index 477ba435..5728554a 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -1777,7 +1777,6 @@ slim_hidden_proto(cairo_rel_line_to)
slim_hidden_proto(cairo_restore)
slim_hidden_proto(cairo_save)
slim_hidden_proto(cairo_set_target_surface)
-slim_hidden_proto(cairo_surface_create_for_image)
slim_hidden_proto(cairo_surface_destroy)
slim_hidden_proto(cairo_surface_get_matrix)
slim_hidden_proto(cairo_surface_set_matrix)