diff options
-rw-r--r-- | ChangeLog | 65 | ||||
-rw-r--r-- | src/cairo-ft-font.c | 8 | ||||
-rw-r--r-- | src/cairo-gstate.c | 15 | ||||
-rw-r--r-- | src/cairo-image-surface.c | 1 | ||||
-rw-r--r-- | src/cairo-matrix.c | 116 | ||||
-rw-r--r-- | src/cairo-pattern.c | 17 | ||||
-rw-r--r-- | src/cairo-pdf-surface.c | 10 | ||||
-rw-r--r-- | src/cairo-surface.c | 79 | ||||
-rw-r--r-- | src/cairo-xlib-surface.c | 8 | ||||
-rw-r--r-- | src/cairo.c | 145 | ||||
-rw-r--r-- | src/cairo.h | 265 | ||||
-rw-r--r-- | src/cairoint.h | 19 | ||||
-rw-r--r-- | test/cairo-test.c | 7 | ||||
-rw-r--r-- | test/gradient-alpha.c | 16 | ||||
-rw-r--r-- | test/mask.c | 8 | ||||
-rw-r--r-- | test/move-to-show-surface.c | 5 | ||||
-rw-r--r-- | test/select-font-no-show-text.c | 6 | ||||
-rw-r--r-- | test/set-source.c | 4 | ||||
-rw-r--r-- | test/text-cache-crash.c | 16 | ||||
-rw-r--r-- | test/text-rotate.c | 6 | ||||
-rw-r--r-- | test/transforms.c | 2 | ||||
-rw-r--r-- | test/translate-show-surface.c | 5 | ||||
-rw-r--r-- | test/trap-clip.c | 8 | ||||
-rwxr-xr-x | util/cairo-api-update | 48 |
24 files changed, 274 insertions, 605 deletions
@@ -1,5 +1,70 @@ 2005-05-06 Carl Worth <cworth@cworth.org> + * src/cairo.c: + * src/cairo.h: Eliminate the following deprecated functions from + cairo's interface: + + cairo_copy + cairo_get_path + cairo_get_path_flat + cairo_matrix_create + cairo_matrix_destroy + cairo_matrix_copy + cairo_matrix_get_affine + cairo_surface_set_repeat + cairo_surface_set_matrix + cairo_surface_get_matrix + cairo_surface_set_filter + cairo_surface_get_filter + + Also, eliminate all support for compiling against, or running with + old, deprecated names for functions. + + * src/cairo-ft-font.c: (_compute_transform): + * src/cairo-gstate.c: + * src/cairo-image-surface.c: (cairo_image_surface_create_for_data): + * src/cairo-matrix.c: (_cairo_matrix_get_affine), + (_cairo_matrix_compute_adjoint), + (_cairo_matrix_is_integer_translation): + * src/cairo-pattern.c: (cairo_pattern_add_color_stop_rgba), + (cairo_pattern_set_matrix), (cairo_pattern_get_matrix), + (_cairo_image_data_set_linear), (_cairo_linear_pattern_classify), + (_cairo_image_data_set_radial): + * src/cairo-pdf-surface.c: (_cairo_pdf_surface_composite_image), + (_cairo_pdf_surface_composite_pdf), (emit_surface_pattern), + (emit_linear_pattern), (emit_radial_pattern): + * src/cairo-surface.c: + * src/cairo-xlib-surface.c: + (_cairo_xlib_surface_acquire_source_image), + (cairo_xlib_surface_create): + * src/cairo.c: (cairo_set_source_rgba), (cairo_set_source), + (cairo_get_source), (cairo_transform), (cairo_identity_matrix), + (cairo_user_to_device), (cairo_user_to_device_distance), + (cairo_device_to_user), (cairo_device_to_user_distance), + (cairo_reset_clip), (cairo_select_font_face), (cairo_font_extents), + (cairo_set_font_size), (cairo_get_operator), (cairo_get_rgb_color), + (cairo_get_tolerance), (cairo_get_fill_rule), + (cairo_get_line_width), (cairo_get_line_cap), + (cairo_get_line_join), (cairo_get_miter_limit), (cairo_get_matrix), + (cairo_get_target), (cairo_status), (cairo_status_string): + * src/cairoint.h: + * test/cairo-test.c: (cairo_test_create_png_pattern): + * test/gradient-alpha.c: (draw): + * test/mask.c: (set_gradient_pattern), (set_image_pattern): + * test/move-to-show-surface.c: (draw): + * test/select-font-no-show-text.c: (draw): + * test/set-source.c: (draw): + * test/text-cache-crash.c: (draw): + * test/text-rotate.c: (draw): + * test/transforms.c: (draw_L_shape): + * test/translate-show-surface.c: (draw): + * test/trap-clip.c: (set_gradient_pattern), (set_image_pattern): + * util/cairo-api-update: + + Deal with all of the removals. + +2005-05-06 Carl Worth <cworth@cworth.org> + * src/cairo-glitz-surface.c: (_glitz_operator), (_cairo_glitz_surface_fill_rectangles): * src/cairo-gstate.c: (_cairo_gstate_mask): diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c index 151076316..421a7fbde 100644 --- a/src/cairo-ft-font.c +++ b/src/cairo-ft-font.c @@ -432,10 +432,10 @@ _compute_transform (ft_font_transform_t *sf, &sf->x_scale, &sf->y_scale, /* XXX */ 1); cairo_matrix_scale (&normalized, 1.0 / sf->x_scale, 1.0 / sf->y_scale); - cairo_matrix_get_affine (&normalized, - &sf->shape[0][0], &sf->shape[0][1], - &sf->shape[1][0], &sf->shape[1][1], - &tx, &ty); + _cairo_matrix_get_affine (&normalized, + &sf->shape[0][0], &sf->shape[0][1], + &sf->shape[1][0], &sf->shape[1][1], + &tx, &ty); } /* Temporarily scales an unscaled font to the give scale. We catch diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c index 709f577fe..48a1324f6 100644 --- a/src/cairo-gstate.c +++ b/src/cairo-gstate.c @@ -251,21 +251,6 @@ _cairo_gstate_clone (cairo_gstate_t *gstate) return clone; } -cairo_status_t -_cairo_gstate_copy (cairo_gstate_t *dest, cairo_gstate_t *src) -{ - cairo_status_t status; - cairo_gstate_t *next; - - /* Preserve next pointer over fini/init */ - next = dest->next; - _cairo_gstate_fini (dest); - status = _cairo_gstate_init_copy (dest, src); - dest->next = next; - - return status; -} - /* Push rendering off to an off-screen group. */ /* XXX: Rethinking this API cairo_status_t diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c index 648a2cdef..a98b602c9 100644 --- a/src/cairo-image-surface.c +++ b/src/cairo-image-surface.c @@ -223,7 +223,6 @@ cairo_image_surface_create_for_data (unsigned char *data, return &surface->base; } -DEPRECATE(cairo_surface_create_for_image, cairo_image_surface_create_for_data); /** * cairo_image_surface_get_width: diff --git a/src/cairo-matrix.c b/src/cairo-matrix.c index 1bfd4aae2..71bd0d2ea 100644 --- a/src/cairo-matrix.c +++ b/src/cairo-matrix.c @@ -47,67 +47,6 @@ static void _cairo_matrix_compute_adjoint (cairo_matrix_t *matrix); /** - * cairo_matrix_create: - * - * Creates a new identity matrix. - * - * Return value: a newly created matrix; free with cairo_matrix_destroy(), - * or %NULL if memory couldn't be allocated. - * - * WARNING: This function is deprecated and will be disappearing - * shortly. Now that the structure of #cairo_matrix_t is exposed, - * users can manage the memory on their own, (in particular by putting - * a cairo_matrix_t on the stack). - **/ -cairo_matrix_t * -cairo_matrix_create (void) -{ - cairo_matrix_t *matrix; - - matrix = malloc (sizeof (cairo_matrix_t)); - if (matrix == NULL) - return NULL; - - cairo_matrix_init_identity (matrix); - - return matrix; -} - -/** - * cairo_matrix_destroy: - * @matrix: a #cairo_matrix_t - * - * Frees a matrix created with cairo_matrix_create. - * - * WARNING: This function is deprecated and will be disappearing - * shortly. Now that the structure of #cairo_matrix_t is exposed, - * users can manage the memory on their own, (in particular by putting - * a cairo_matrix_t on the stack). - **/ -void -cairo_matrix_destroy (cairo_matrix_t *matrix) -{ - free (matrix); -} - -/** - * cairo_matrix_copy: - * @matrix: a #cairo_matrix_t - * @other: another #cairo_ - * - * Modifies @matrix to be identical to @other. - * - * WARNING: This function is deprecated and will be disappearing - * shortly. Now that the structure of #cairo_matrix_t is exposed, - * users can copy a matrix by direct assignment. - **/ -void -cairo_matrix_copy (cairo_matrix_t *matrix, const cairo_matrix_t *other) -{ - *matrix = *other; -} - -/** * cairo_matrix_init_identity: * @matrix: a #cairo_matrix_t * @@ -122,7 +61,6 @@ cairo_matrix_init_identity (cairo_matrix_t *matrix) 0, 0); } slim_hidden_def(cairo_matrix_init_identity); -DEPRECATE(cairo_matrix_set_identity, cairo_matrix_init_identity); /** * cairo_matrix_init: @@ -153,40 +91,38 @@ cairo_matrix_init (cairo_matrix_t *matrix, matrix->x0 = x0; matrix->y0 = y0; } slim_hidden_def(cairo_matrix_init); -DEPRECATE(cairo_matrix_set_affine, cairo_matrix_init); /** - * cairo_matrix_get_affine: + * _cairo_matrix_get_affine: * @matrix: a @cairo_matrix_t - * @a: location to store a component of affine transformation, or %NULL - * @b: location to store b component of affine transformation, or %NULL - * @c: location to store c component of affine transformation, or %NULL - * @d: location to store d component of affine transformation, or %NULL - * @tx: location to store X-translation component of affine transformation, or %NULL - * @ty: location to store Y-translation component of affine transformation, or %NULL + * @xx: location to store xx component of matrix + * @yx: location to store yx component of matrix + * @xy: location to store xy component of matrix + * @yy: location to store yy component of matrix + * @x0: location to store x0 (X-translation component) of matrix, or %NULL + * @y0: location to store y0 (Y-translation component) of matrix, or %NULL * * Gets the matrix values for the affine tranformation that @matrix represents. * See cairo_matrix_init(). * - * WARNING: This function is deprecated and will be disappearing - * shortly. Now that the structure of #cairo_matrix_t is exposed, - * users can just examine the matrix values directly. + * + * This function is a leftover from the old public API, but is still + * mildly useful as an internal means for getting at the matrix + * members in a positional way. For example, when reassigning to some + * external matrix type, or when renaming members to more meaningful + * names (such as a,b,c,d,e,f) for particular manipulations. **/ void -cairo_matrix_get_affine (cairo_matrix_t *matrix, - double *xx, double *yx, - double *xy, double *yy, - double *x0, double *y0) +_cairo_matrix_get_affine (cairo_matrix_t *matrix, + double *xx, double *yx, + double *xy, double *yy, + double *x0, double *y0) { - if (xx) - *xx = matrix->xx; - if (yx) - *yx = matrix->yx; + *xx = matrix->xx; + *yx = matrix->yx; - if (xy) - *xy = matrix->xy; - if (yy) - *yy = matrix->yy; + *xy = matrix->xy; + *yy = matrix->yy; if (x0) *x0 = matrix->x0; @@ -495,10 +431,10 @@ _cairo_matrix_compute_adjoint (cairo_matrix_t *matrix) /* adj (A) = transpose (C:cofactor (A,i,j)) */ double a, b, c, d, tx, ty; - cairo_matrix_get_affine (matrix, - &a, &b, - &c, &d, - &tx, &ty); + _cairo_matrix_get_affine (matrix, + &a, &b, + &c, &d, + &tx, &ty); cairo_matrix_init (matrix, d, -b, @@ -627,7 +563,7 @@ _cairo_matrix_is_integer_translation(cairo_matrix_t *mat, double a, b, c, d, tx, ty; int ttx, tty; int ok = 0; - cairo_matrix_get_affine (mat, &a, &b, &c, &d, &tx, &ty); + _cairo_matrix_get_affine (mat, &a, &b, &c, &d, &tx, &ty); ttx = _cairo_fixed_from_double (tx); tty = _cairo_fixed_from_double (ty); ok = ((a == 1.0) diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c index 7fa5f7dab..e74da6a6a 100644 --- a/src/cairo-pattern.c +++ b/src/cairo-pattern.c @@ -368,12 +368,11 @@ cairo_pattern_add_color_stop_rgba (cairo_pattern_t *pattern, offset, &color); } -DEPRECATE (cairo_pattern_add_color_stop, cairo_pattern_add_color_stop_rgba); cairo_status_t cairo_pattern_set_matrix (cairo_pattern_t *pattern, cairo_matrix_t *matrix) { - cairo_matrix_copy (&pattern->matrix, matrix); + pattern->matrix = *matrix; return CAIRO_STATUS_SUCCESS; } @@ -381,7 +380,7 @@ cairo_pattern_set_matrix (cairo_pattern_t *pattern, cairo_matrix_t *matrix) cairo_status_t cairo_pattern_get_matrix (cairo_pattern_t *pattern, cairo_matrix_t *matrix) { - cairo_matrix_copy (matrix, &pattern->matrix); + *matrix = pattern->matrix; return CAIRO_STATUS_SUCCESS; } @@ -681,8 +680,8 @@ _cairo_image_data_set_linear (cairo_linear_pattern_t *pattern, point1.x = pattern->point1.x; point1.y = pattern->point1.y; - cairo_matrix_get_affine (&pattern->base.base.matrix, - &a, &b, &c, &d, &tx, &ty); + _cairo_matrix_get_affine (&pattern->base.base.matrix, + &a, &b, &c, &d, &tx, &ty); dx = point1.x - point0.x; dy = point1.y - point0.y; @@ -736,8 +735,8 @@ _cairo_linear_pattern_classify (cairo_linear_pattern_t *pattern, point1.x = pattern->point1.x; point1.y = pattern->point1.y; - cairo_matrix_get_affine (&pattern->base.base.matrix, - &a, &b, &c, &d, &tx, &ty); + _cairo_matrix_get_affine (&pattern->base.base.matrix, + &a, &b, &c, &d, &tx, &ty); dx = point1.x - point0.x; dy = point1.y - point0.y; @@ -810,8 +809,8 @@ _cairo_image_data_set_radial (cairo_radial_pattern_t *pattern, r1_2 = c0_c1 = 0.0; /* shut up compiler */ } - cairo_matrix_get_affine (&pattern->base.base.matrix, - &a, &b, &c, &d, &tx, &ty); + _cairo_matrix_get_affine (&pattern->base.base.matrix, + &a, &b, &c, &d, &tx, &ty); for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c index e471b5c44..42a7ccf8e 100644 --- a/src/cairo-pdf-surface.c +++ b/src/cairo-pdf-surface.c @@ -1243,7 +1243,7 @@ _cairo_pdf_surface_composite_image (cairo_pdf_surface_t *dst, _cairo_pdf_surface_ensure_stream (dst); - cairo_matrix_copy (&i2u, &pattern->base.matrix); + i2u = pattern->base.matrix; cairo_matrix_invert (&i2u); cairo_matrix_translate (&i2u, 0, image->height); cairo_matrix_scale (&i2u, image->width, -image->height); @@ -1286,7 +1286,7 @@ _cairo_pdf_surface_composite_pdf (cairo_pdf_surface_t *dst, src = (cairo_pdf_surface_t *) pattern->surface; - cairo_matrix_copy (&i2u, &src->base.matrix); + i2u = src->base.matrix; cairo_matrix_invert (&i2u); cairo_matrix_scale (&i2u, 1.0 / (src->width_inches * document->x_ppi), @@ -1420,7 +1420,7 @@ emit_surface_pattern (cairo_pdf_surface_t *dst, cairo_matrix_init_identity (&pm); cairo_matrix_scale (&pm, image->width, image->height); - cairo_matrix_copy (&pm, &pattern->base.matrix); + pm = pattern->base.matrix; cairo_matrix_invert (&pm); snprintf (entries, sizeof entries, @@ -1502,7 +1502,7 @@ emit_linear_pattern (cairo_pdf_surface_t *surface, cairo_linear_pattern_t *patte function_id = emit_pattern_stops (surface, &pattern->base); - cairo_matrix_copy (&p2u, &pattern->base.base.matrix); + p2u = pattern->base.base.matrix; cairo_matrix_invert (&p2u); x0 = pattern->point0.x; @@ -1556,7 +1556,7 @@ emit_radial_pattern (cairo_pdf_surface_t *surface, cairo_radial_pattern_t *patte function_id = emit_pattern_stops (surface, &pattern->base); - cairo_matrix_copy (&p2u, &pattern->base.base.matrix); + p2u = pattern->base.base.matrix; cairo_matrix_invert (&p2u); x0 = pattern->center0.x; diff --git a/src/cairo-surface.c b/src/cairo-surface.c index f947bead9..b2ed96499 100644 --- a/src/cairo-surface.c +++ b/src/cairo-surface.c @@ -540,85 +540,6 @@ _cairo_surface_clone_similar (cairo_surface_t *surface, return status; } -cairo_status_t -cairo_surface_set_matrix (cairo_surface_t *surface, cairo_matrix_t *matrix) -{ - if (surface->finished) - return CAIRO_STATUS_SURFACE_FINISHED; - - if (surface == NULL) - return CAIRO_STATUS_NULL_POINTER; - - cairo_matrix_copy (&surface->matrix, matrix); - - return CAIRO_STATUS_SUCCESS; -} -slim_hidden_def(cairo_surface_set_matrix); - -cairo_status_t -cairo_surface_get_matrix (cairo_surface_t *surface, cairo_matrix_t *matrix) -{ - if (surface->finished) - return CAIRO_STATUS_SURFACE_FINISHED; - - if (surface == NULL) - return CAIRO_STATUS_NULL_POINTER; - - cairo_matrix_copy (matrix, &surface->matrix); - - return CAIRO_STATUS_SUCCESS; -} -slim_hidden_def(cairo_surface_get_matrix); - -cairo_status_t -cairo_surface_set_filter (cairo_surface_t *surface, cairo_filter_t filter) -{ - if (surface->finished) - return CAIRO_STATUS_SURFACE_FINISHED; - - if (surface == NULL) - return CAIRO_STATUS_NULL_POINTER; - - surface->filter = filter; - return CAIRO_STATUS_SUCCESS; -} - -cairo_filter_t -cairo_surface_get_filter (cairo_surface_t *surface) -{ - return surface->filter; -} - -/* XXX: NYI -cairo_status_t -cairo_surface_clip_rectangle (cairo_surface_t *surface, - int x, int y, - int width, int height) -{ - -} -*/ - -/* XXX: NYI -cairo_status_t -cairo_surface_clip_restore (cairo_surface_t *surface); -*/ - -cairo_status_t -cairo_surface_set_repeat (cairo_surface_t *surface, int repeat) -{ - if (surface->finished) - return CAIRO_STATUS_SURFACE_FINISHED; - - if (surface == NULL) - return CAIRO_STATUS_NULL_POINTER; - - surface->repeat = repeat; - - return CAIRO_STATUS_SUCCESS; -} -slim_hidden_def(cairo_surface_set_repeat); - typedef struct { cairo_surface_t *dst; cairo_rectangle_t extents; diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c index f34a57681..522ca4499 100644 --- a/src/cairo-xlib-surface.c +++ b/src/cairo-xlib-surface.c @@ -377,13 +377,8 @@ _cairo_xlib_surface_acquire_source_image (void *abstract_surf cairo_status_t status; status = _get_image_surface (surface, NULL, &image, NULL); - if (status == CAIRO_STATUS_SUCCESS) { - cairo_surface_set_filter (&image->base, surface->base.filter); - cairo_surface_set_matrix (&image->base, &surface->base.matrix); - cairo_surface_set_repeat (&image->base, surface->base.repeat); - + if (status == CAIRO_STATUS_SUCCESS) *image_out = image; - } return status; } @@ -1023,7 +1018,6 @@ cairo_xlib_surface_create (Display *dpy, visual, format); } -DEPRECATE (cairo_surface_create_for_drawable, cairo_xlib_surface_create); /** * cairo_xlib_surface_create_for_pixmap: diff --git a/src/cairo.c b/src/cairo.c index b2b61387a..6b2d217b6 100644 --- a/src/cairo.c +++ b/src/cairo.c @@ -248,38 +248,6 @@ cairo_restore (cairo_t *cr) } slim_hidden_def(cairo_restore); -/** - * cairo_copy: - * @dest: a #cairo_t - * @src: another #cairo_t - * - * This function copies all current state information from src to - * dest. This includes the current point and path, the target surface, - * the transformation matrix, and so forth. - * - * The stack of states saved with cairo_save() is <emphasis>not</emphasis> - * not copied; nor are any saved states on @dest cleared. The - * operation only copies the current state of @src to the current - * state of @dest. - **/ -void -cairo_copy (cairo_t *dest, cairo_t *src) -{ - CAIRO_CHECK_SANITY (src); - CAIRO_CHECK_SANITY (dest); - if (dest->status) - return; - - if (src->status) { - dest->status = src->status; - return; - } - - dest->status = _cairo_gstate_copy (dest->gstate, src->gstate); - CAIRO_CHECK_SANITY (src); - CAIRO_CHECK_SANITY (dest); -} - /* XXX: I want to rethink this API void cairo_push_group (cairo_t *cr) @@ -405,7 +373,6 @@ cairo_set_source_rgba (cairo_t *cr, CAIRO_CHECK_SANITY (cr); } -DEPRECATE(cairo_set_rgb_color, cairo_set_source_rgb); void cairo_set_source_surface (cairo_t *cr, @@ -459,7 +426,6 @@ cairo_set_source (cairo_t *cr, cairo_pattern_t *source) cr->status = _cairo_gstate_set_source (cr->gstate, source); CAIRO_CHECK_SANITY (cr); } -DEPRECATE(cairo_set_pattern, cairo_set_source); /** * cairo_get_source: @@ -482,7 +448,6 @@ cairo_get_source (cairo_t *cr) return _cairo_gstate_get_source (cr->gstate); } -DEPRECATE(cairo_current_pattern, cairo_get_source); /** * cairo_set_tolerance: @@ -720,7 +685,6 @@ cairo_transform (cairo_t *cr, cairo_matrix_t *matrix) cr->status = _cairo_gstate_transform (cr->gstate, matrix); CAIRO_CHECK_SANITY (cr); } -DEPRECATE(cairo_concat_matrix, cairo_transform); /** * cairo_set_matrix: @@ -761,7 +725,6 @@ cairo_identity_matrix (cairo_t *cr) cr->status = _cairo_gstate_identity_matrix (cr->gstate); CAIRO_CHECK_SANITY (cr); } -DEPRECATE(cairo_default_matrix, cairo_identity_matrix); /** * cairo_user_to_device: @@ -783,7 +746,6 @@ cairo_user_to_device (cairo_t *cr, double *x, double *y) cr->status = _cairo_gstate_user_to_device (cr->gstate, x, y); CAIRO_CHECK_SANITY (cr); } -DEPRECATE(cairo_transform_point, cairo_user_to_device); /** * cairo_user_to_device_distance: @@ -806,7 +768,6 @@ cairo_user_to_device_distance (cairo_t *cr, double *dx, double *dy) cr->status = _cairo_gstate_user_to_device_distance (cr->gstate, dx, dy); CAIRO_CHECK_SANITY (cr); } -DEPRECATE(cairo_transform_distance, cairo_user_to_device_distance); /** * cairo_device_to_user: @@ -828,7 +789,6 @@ cairo_device_to_user (cairo_t *cr, double *x, double *y) cr->status = _cairo_gstate_device_to_user (cr->gstate, x, y); CAIRO_CHECK_SANITY (cr); } -DEPRECATE(cairo_inverse_transform_point, cairo_device_to_user); /** * cairo_device_to_user_distance: @@ -851,7 +811,6 @@ cairo_device_to_user_distance (cairo_t *cr, double *dx, double *dy) cr->status = _cairo_gstate_device_to_user_distance (cr->gstate, dx, dy); CAIRO_CHECK_SANITY (cr); } -DEPRECATE(cairo_inverse_transform_distance, cairo_device_to_user_distance); void cairo_new_path (cairo_t *cr) @@ -1548,7 +1507,6 @@ cairo_reset_clip (cairo_t *cr) cr->status = _cairo_gstate_reset_clip (cr->gstate); CAIRO_CHECK_SANITY (cr); } -DEPRECATE (cairo_init_clip, cairo_reset_clip); /** * cairo_select_font_face: @@ -1578,7 +1536,6 @@ cairo_select_font_face (cairo_t *cr, cr->status = _cairo_gstate_select_font_face (cr->gstate, family, slant, weight); CAIRO_CHECK_SANITY (cr); } -DEPRECATE (cairo_select_font, cairo_select_font_face); /** * cairo_get_font_face: @@ -1624,8 +1581,6 @@ cairo_font_extents (cairo_t *cr, cr->status = _cairo_gstate_get_font_extents (cr->gstate, extents); CAIRO_CHECK_SANITY (cr); } -DEPRECATE (cairo_current_font_extents, cairo_font_extents); -DEPRECATE (cairo_get_font_extents, cairo_font_extents); /** * cairo_set_font_face: @@ -1669,7 +1624,6 @@ cairo_set_font_size (cairo_t *cr, double size) cr->status = _cairo_gstate_set_font_size (cr->gstate, size); CAIRO_CHECK_SANITY (cr); } -DEPRECATE (cairo_scale_font, cairo_set_font_size); /** * cairo_set_font_matrix @@ -1912,7 +1866,6 @@ cairo_get_operator (cairo_t *cr) CAIRO_CHECK_SANITY (cr); return _cairo_gstate_get_operator (cr->gstate); } -DEPRECATE (cairo_current_operator, cairo_get_operator); /** * cairo_get_rgb_color: @@ -1938,7 +1891,6 @@ cairo_get_rgb_color (cairo_t *cr, double *red, double *green, double *blue) _cairo_gstate_get_rgb_color (cr->gstate, red, green, blue); CAIRO_CHECK_SANITY (cr); } -DEPRECATE (cairo_current_rgb_color, cairo_get_rgb_color); /** * cairo_get_tolerance: @@ -1954,7 +1906,6 @@ cairo_get_tolerance (cairo_t *cr) CAIRO_CHECK_SANITY (cr); return _cairo_gstate_get_tolerance (cr->gstate); } -DEPRECATE (cairo_current_tolerance, cairo_get_tolerance); /** * cairo_get_current_point: @@ -2004,7 +1955,6 @@ cairo_get_current_point (cairo_t *cr, double *x_ret, double *y_ret) CAIRO_CHECK_SANITY (cr); } slim_hidden_def(cairo_get_current_point); -DEPRECATE (cairo_current_point, cairo_get_current_point); /** * cairo_get_fill_rule: @@ -2020,7 +1970,6 @@ cairo_get_fill_rule (cairo_t *cr) CAIRO_CHECK_SANITY (cr); return _cairo_gstate_get_fill_rule (cr->gstate); } -DEPRECATE (cairo_current_fill_rule, cairo_get_fill_rule); /** * cairo_get_line_width: @@ -2036,7 +1985,6 @@ cairo_get_line_width (cairo_t *cr) CAIRO_CHECK_SANITY (cr); return _cairo_gstate_get_line_width (cr->gstate); } -DEPRECATE (cairo_current_line_width, cairo_get_line_width); /** * cairo_get_line_cap: @@ -2052,7 +2000,6 @@ cairo_get_line_cap (cairo_t *cr) CAIRO_CHECK_SANITY (cr); return _cairo_gstate_get_line_cap (cr->gstate); } -DEPRECATE (cairo_current_line_cap, cairo_get_line_cap); /** * cairo_get_line_join: @@ -2068,7 +2015,6 @@ cairo_get_line_join (cairo_t *cr) CAIRO_CHECK_SANITY (cr); return _cairo_gstate_get_line_join (cr->gstate); } -DEPRECATE (cairo_current_line_join, cairo_get_line_join); /** * cairo_get_miter_limit: @@ -2084,7 +2030,6 @@ cairo_get_miter_limit (cairo_t *cr) CAIRO_CHECK_SANITY (cr); return _cairo_gstate_get_miter_limit (cr->gstate); } -DEPRECATE (cairo_current_miter_limit, cairo_get_miter_limit); /** * cairo_get_matrix: @@ -2099,7 +2044,6 @@ cairo_get_matrix (cairo_t *cr, cairo_matrix_t *matrix) CAIRO_CHECK_SANITY (cr); _cairo_gstate_get_matrix (cr->gstate, matrix); } -DEPRECATE(cairo_current_matrix, cairo_get_matrix); /** * cairo_get_target: @@ -2121,93 +2065,6 @@ cairo_get_target (cairo_t *cr) return _cairo_gstate_get_target (cr->gstate); } -DEPRECATE (cairo_current_target_surface, cairo_get_target); - -void -cairo_get_path (cairo_t *cr, - cairo_move_to_func_t *move_to, - cairo_line_to_func_t *line_to, - cairo_curve_to_func_t *curve_to, - cairo_close_path_func_t *close_path, - void *closure) -{ - int i; - cairo_path_t *path; - cairo_path_data_t *data; - - CAIRO_CHECK_SANITY (cr); - if (cr->status) - return; - - path = cairo_copy_path (cr); - - for (i=0; i < path->num_data; i += path->data[i].header.length) { - data = &path->data[i]; - switch (data->header.type) { - case CAIRO_PATH_MOVE_TO: - (move_to) (closure, data[1].point.x, data[1].point.y); - break; - case CAIRO_PATH_LINE_TO: - (line_to) (closure, data[1].point.x, data[1].point.y); - break; - case CAIRO_PATH_CURVE_TO: - (curve_to) (closure, - data[1].point.x, data[1].point.y, - data[2].point.x, data[2].point.y, - data[3].point.x, data[3].point.y); - break; - case CAIRO_PATH_CLOSE_PATH: - (close_path) (closure); - break; - } - } - - cairo_path_destroy (path); - - CAIRO_CHECK_SANITY (cr); -} -DEPRECATE (cairo_current_path, cairo_get_path); - -void -cairo_get_path_flat (cairo_t *cr, - cairo_move_to_func_t *move_to, - cairo_line_to_func_t *line_to, - cairo_close_path_func_t *close_path, - void *closure) -{ - int i; - cairo_path_t *path; - cairo_path_data_t *data; - - CAIRO_CHECK_SANITY (cr); - if (cr->status) - return; - - path = cairo_copy_path_flat (cr); - - for (i=0; i < path->num_data; i += path->data[i].header.length) { - data = &path->data[i]; - switch (data->header.type) { - case CAIRO_PATH_MOVE_TO: - (move_to) (closure, data[1].point.x, data[1].point.y); - break; - case CAIRO_PATH_LINE_TO: - (line_to) (closure, data[1].point.x, data[1].point.y); - break; - case CAIRO_PATH_CLOSE_PATH: - (close_path) (closure); - break; - case CAIRO_PATH_CURVE_TO: - ASSERT_NOT_REACHED; - break; - } - } - - cairo_path_destroy (path); - - CAIRO_CHECK_SANITY (cr); -} -DEPRECATE (cairo_current_path_flat, cairo_get_path_flat); /** * cairo_copy_path: @@ -2301,7 +2158,6 @@ cairo_status (cairo_t *cr) CAIRO_CHECK_SANITY (cr); return cr->status; } -DEPRECATE (cairo_get_status, cairo_status); const char * cairo_status_string (cairo_t *cr) @@ -2341,7 +2197,6 @@ cairo_status_string (cairo_t *cr) return "<unknown error status>"; } -DEPRECATE (cairo_get_status_string, cairo_status_string); void _cairo_restrict_value (double *value, double min, double max) diff --git a/src/cairo.h b/src/cairo.h index de85566a6..b8a96a7bc 100644 --- a/src/cairo.h +++ b/src/cairo.h @@ -214,10 +214,6 @@ cairo_save (cairo_t *cr); void cairo_restore (cairo_t *cr); -/* XXX: Replace with cairo_get_gstate/cairo_set_gstate */ -void -cairo_copy (cairo_t *dest, cairo_t *src); - /* XXX: I want to rethink this API void cairo_push_group (cairo_t *cr); @@ -268,10 +264,6 @@ cairo_set_source_surface (cairo_t *cr, double x, double y); -/* XXX: Currently, the tolerance value is specified by the user in - terms of device-space units. If I'm not mistaken, this is the only - value in this API that is not expressed in user-space units. I - should think whether this value should be user-space instead. */ void cairo_set_tolerance (cairo_t *cr, double tolerance); @@ -425,16 +417,9 @@ cairo_rectangle (cairo_t *cr, double x, double y, double width, double height); -/* XXX: This is the same name that PostScript uses, but to me the name - suggests an actual drawing operation ala cairo_stroke --- especially - since I want to add a cairo_path_t and with that it would be - natural to have "cairo_stroke_path (cairo_t *, cairo_path_t *)" - - Maybe we could use something like "cairo_outline_path (cairo_t *)"? -*/ /* XXX: NYI void -cairo_stroke_path (cairo_t *cr); +cairo_stroke_to_path (cairo_t *cr); */ void @@ -524,7 +509,7 @@ typedef struct _cairo_scaled_font cairo_scaled_font_t; * a font by sheering it or scaling it unequally in the two * directions) . A font face can be set on a #cairo_t by using * cairo_set_font_face(); the size and font matrix are set with - * cairo_scale_font() and cairo_transform_font(). + * cairo_set_font_size() and cairo_set_font_matrix(). */ typedef struct _cairo_font_face cairo_font_face_t; @@ -749,12 +734,6 @@ cairo_scaled_font_glyph_extents (cairo_scaled_font_t *scaled_font, /* Query functions */ -/* XXX: It would be nice if I could find a simpler way to make the - definitions for the deprecated functions. Ideally, I would just - have to put DEPRECATE (cairo_get_operator, cairo_current_operator) - into one file and be done with it. For now, I've got a little more - typing than that. */ - cairo_operator_t cairo_get_operator (cairo_t *cr); @@ -765,11 +744,6 @@ cairo_pattern_t * cairo_get_source (cairo_t *cr); double -cairo_get_alpha (cairo_t *cr); - -/* XXX: Do we want cairo_get_pattern as well? */ - -double cairo_get_tolerance (cairo_t *cr); void @@ -800,34 +774,6 @@ cairo_get_matrix (cairo_t *cr, cairo_matrix_t *matrix); cairo_surface_t * cairo_get_target (cairo_t *cr); -typedef void (cairo_move_to_func_t) (void *closure, - double x, double y); - -typedef void (cairo_line_to_func_t) (void *closure, - double x, double y); - -typedef void (cairo_curve_to_func_t) (void *closure, - double x1, double y1, - double x2, double y2, - double x3, double y3); - -typedef void (cairo_close_path_func_t) (void *closure); - -void -cairo_get_path (cairo_t *cr, - cairo_move_to_func_t *move_to, - cairo_line_to_func_t *line_to, - cairo_curve_to_func_t *curve_to, - cairo_close_path_func_t *close_path, - void *closure); - -void -cairo_get_path_flat (cairo_t *cr, - cairo_move_to_func_t *move_to, - cairo_line_to_func_t *line_to, - cairo_close_path_func_t *close_path, - void *closure); - /** * cairo_path_data_t: * @@ -1004,36 +950,6 @@ cairo_surface_write_to_png_stream (cairo_surface_t *surface, #endif -/* XXX: Note: The current Render/Ic implementations don't do the right - thing with repeat when the surface has a non-identity matrix. */ -/* XXX: Rework this as a cairo function with an enum: cairo_set_pattern_extend */ -cairo_status_t -cairo_surface_set_repeat (cairo_surface_t *surface, int repeat); - -/* XXX: Rework this as a cairo function: cairo_set_pattern_transform */ -cairo_status_t -cairo_surface_set_matrix (cairo_surface_t *surface, cairo_matrix_t *matrix); - -/* XXX: Rework this as a cairo function: cairo_get_pattern_transform */ -cairo_status_t -cairo_surface_get_matrix (cairo_surface_t *surface, cairo_matrix_t *matrix); - -typedef enum { - CAIRO_FILTER_FAST, - CAIRO_FILTER_GOOD, - CAIRO_FILTER_BEST, - CAIRO_FILTER_NEAREST, - CAIRO_FILTER_BILINEAR, - CAIRO_FILTER_GAUSSIAN -} cairo_filter_t; - -/* XXX: Rework this as a cairo function: cairo_set_pattern_filter */ -cairo_status_t -cairo_surface_set_filter (cairo_surface_t *surface, cairo_filter_t filter); - -cairo_filter_t -cairo_surface_get_filter (cairo_surface_t *surface); - void * cairo_surface_get_user_data (cairo_surface_t *surface, const cairo_user_data_key_t *key); @@ -1127,6 +1043,15 @@ cairo_pattern_set_extend (cairo_pattern_t *pattern, cairo_extend_t extend); cairo_extend_t cairo_pattern_get_extend (cairo_pattern_t *pattern); +typedef enum { + CAIRO_FILTER_FAST, + CAIRO_FILTER_GOOD, + CAIRO_FILTER_BEST, + CAIRO_FILTER_NEAREST, + CAIRO_FILTER_BILINEAR, + CAIRO_FILTER_GAUSSIAN +} cairo_filter_t; + cairo_status_t cairo_pattern_set_filter (cairo_pattern_t *pattern, cairo_filter_t filter); @@ -1135,18 +1060,6 @@ cairo_pattern_get_filter (cairo_pattern_t *pattern); /* Matrix functions */ -/* XXX: Deprecated. To be removed in favor of a structure of known size. */ -cairo_matrix_t * -cairo_matrix_create (void); - -/* XXX: Deprecated. To be removed in favor of a structure of known size. */ -void -cairo_matrix_destroy (cairo_matrix_t *matrix); - -/* XXX: Deprecated. To be removed in favor of direct assignment. */ -void -cairo_matrix_copy (cairo_matrix_t *matrix, const cairo_matrix_t *other); - void cairo_matrix_init (cairo_matrix_t *matrix, double xx, double yx, @@ -1168,13 +1081,6 @@ void cairo_matrix_init_rotate (cairo_matrix_t *matrix, double radians); -/* XXX: Deprecated. To be removed in favor of direct access. */ -void -cairo_matrix_get_affine (cairo_matrix_t *matrix, - double *a, double *b, - double *c, double *d, - double *tx, double *ty); - void cairo_matrix_translate (cairo_matrix_t *matrix, double tx, double ty); @@ -1192,98 +1098,79 @@ cairo_matrix_multiply (cairo_matrix_t *result, const cairo_matrix_t *a, const cairo_matrix_t *b); +/* XXX: Need a new name here perhaps. */ void cairo_matrix_transform_distance (cairo_matrix_t *matrix, double *dx, double *dy); +/* XXX: Need a new name here perhaps. */ void cairo_matrix_transform_point (cairo_matrix_t *matrix, double *x, double *y); -#define CAIRO_API_SHAKEUP_FLAG_DAY 0 - #ifndef _CAIROINT_H_ -#if CAIRO_API_SHAKEUP_FLAG_DAY - -/* Deprecated functions. We've made some effort to allow the - deprecated functions to continue to work for now, (with useful - warnings). But the deprecated functions will not appear in the next - release. */ -#define cairo_current_path cairo_current_path_DEPRECATED_BY_cairo_get_path -#define cairo_current_path_flat cairo_current_path_flat_DEPRECATED_BY_cairo_get_path_flat -#define cairo_current_font_extents cairo_current_font_extents_DEPRECATED_BY_cairo_font_extents -#define cairo_get_font_extents cairo_get_font_extents_DEPRECATED_BY_cairo_font_extents -#define cairo_current_operator cairo_current_operator_DEPRECATED_BY_cairo_get_operator -#define cairo_current_rgb_color cairo_current_rgb_color_DEPRECATED_BY_cairo_get_rgb_color -#define cairo_current_alpha cairo_current_alpha_DEPRECATED_BY_cairo_get_alpha -#define cairo_current_tolerance cairo_current_tolerance_DEPRECATED_BY_cairo_get_tolerance -#define cairo_current_point cairo_current_point_DEPRECATED_BY_cairo_get_current_point -#define cairo_current_fill_rule cairo_current_fill_rule_DEPRECATED_BY_cairo_get_fill_rule -#define cairo_current_line_width cairo_current_line_width_DEPRECATED_BY_cairo_get_line_width -#define cairo_current_line_cap cairo_current_line_cap_DEPRECATED_BY_cairo_get_line_cap -#define cairo_current_line_join cairo_current_line_join_DEPRECATED_BY_cairo_get_line_join -#define cairo_current_miter_limit cairo_current_miter_limit_DEPRECATED_BY_cairo_get_miter_limit -#define cairo_current_matrix cairo_current_matrix_DEPRECATED_BY_cairo_get_matrix -#define cairo_current_target_surface cairo_current_target_surface_DEPRECATED_BY_cairo_get_target_surface -#define cairo_get_status cairo_get_status_DEPRECATED_BY_cairo_status -#define cairo_get_status_string cairo_get_status_string_DEPRECATED_BY_cairo_status_string -#define cairo_concat_matrix cairo_concat_matrix_DEPRECATED_BY_cairo_transform -#define cairo_scale_font cairo_scale_font_DEPRECATED_BY_cairo_set_font_size -#define cairo_select_font cairo_select_font_face_DEPRECATED_BY_cairo_select_font_face -#define cairo_transform_font cairo_transform_font_DEPRECATED_BY_cairo_set_font_matrix -#define cairo_transform_point cairo_transform_point_DEPRECATED_BY_cairo_user_to_device -#define cairo_transform_distance cairo_transform_distance_DEPRECATED_BY_cairo_user_to_device_distance -#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 -#define cairo_default_matrix cairo_default_matrix_DEPRECATED_BY_cairo_identity_matrix -#define cairo_matrix_set_affine cairo_matrix_set_affine_DEPRECTATED_BY_cairo_matrix_init -#define cairo_matrix_set_identity cairo_matrix_set_identity_DEPRECATED_BY_cairo_matrix_init_identity -#define cairo_pattern_add_color_stop cairo_pattern_add_color_stop_DEPRECATED_BY_cairo_pattern_add_color_stop_rgba -#define cairo_set_rgb_color cairo_set_rgb_color_DEPRECATED_BY_cairo_set_source_rgb -#define cairo_set_pattern cairo_set_pattern_DEPRECATED_BY_cairo_set_source -#define cairo_set_alpha cairo_set_alpha_DEPRECATED_BY_cairo_set_source_rgba - -#else /* CAIRO_API_SHAKEUP_FLAG_DAY */ - -#define cairo_current_path cairo_get_path -#define cairo_current_path_flat cairo_get_path_flat -#define cairo_current_font cairo_get_font -#define cairo_current_font_extents cairo_font_extents -#define cairo_current_operator cairo_get_operator -#define cairo_current_rgb_color cairo_get_rgb_color -#define cairo_current_alpha cairo_get_alpha -#define cairo_current_tolerance cairo_get_tolerance -#define cairo_current_point cairo_get_current_point -#define cairo_current_fill_rule cairo_get_fill_rule -#define cairo_current_line_width cairo_get_line_width -#define cairo_current_line_cap cairo_get_line_cap -#define cairo_current_line_join cairo_get_line_join -#define cairo_current_miter_limit cairo_get_miter_limit -#define cairo_current_matrix cairo_get_matrix -#define cairo_current_target_surface cairo_get_target_surface -#define cairo_get_font_extents cairo_font_extents -#define cairo_get_status cairo_status -#define cairo_get_status_string cairo_status_string -#define cairo_concat_matrix cairo_transform -#define cairo_transform_point cairo_user_to_device -#define cairo_transform_distance cairo_user_to_device_distance -#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_scale_font cairo_set_font_size -#define cairo_select_font cairo_select_font_face -#define cairo_surface_create_for_image cairo_image_surface_create_for_data -#define cairo_transform_font cairo_set_font_matrix -#define cairo_default_matrix cairo_identity_matrix -#define cairo_matrix_set_affine cairo_matrix_init -#define cairo_matrix_set_identity cairo_matrix_init_identity -#define cairo_pattern_add_color_stop cairo_pattern_add_color_stop_rgba -#define cairo_set_rgb_color cairo_set_source_rgb -#define cairo_set_pattern cairo_set_source -#define cairo_set_alpha cairo_set_alpha_DEPRECATED_BY_cairo_set_source_rgba - -#endif /* CAIRO_API_SHAKEUP_FLAG_DAY */ +/* Obsolete functions. These definitions exist to coerce the compiler + * into providing a little bit of guidance with its error + * messages. The idea is to help users port their old code without + * having to dig through lots of documentation. + * + * The first set of REPLACED_BY functions is for functions whose names + * have just been changed. So fixing these up is mechanical, (and + * automated by means of the cairo/util/cairo-api-update script. + * + * The second set of DEPRECATED_BY functions is for functions where + * the replacement is used in a different way, (ie. different + * arguments, multiple functions instead of one, etc). Fixing these up + * will require a bit more work on the user's part, (and hopefully we + * can get cairo-api-update to find these and print some guiding + * information). + */ +#define cairo_current_font_extents cairo_current_font_extents_REPLACED_BY_cairo_font_extents +#define cairo_get_font_extents cairo_get_font_extents_REPLACED_BY_cairo_font_extents +#define cairo_current_operator cairo_current_operator_REPLACED_BY_cairo_get_operator +#define cairo_current_tolerance cairo_current_tolerance_REPLACED_BY_cairo_get_tolerance +#define cairo_current_point cairo_current_point_REPLACED_BY_cairo_get_current_point +#define cairo_current_fill_rule cairo_current_fill_rule_REPLACED_BY_cairo_get_fill_rule +#define cairo_current_line_width cairo_current_line_width_REPLACED_BY_cairo_get_line_width +#define cairo_current_line_cap cairo_current_line_cap_REPLACED_BY_cairo_get_line_cap +#define cairo_current_line_join cairo_current_line_join_REPLACED_BY_cairo_get_line_join +#define cairo_current_miter_limit cairo_current_miter_limit_REPLACED_BY_cairo_get_miter_limit +#define cairo_current_matrix cairo_current_matrix_REPLACED_BY_cairo_get_matrix +#define cairo_current_target_surface cairo_current_target_surface_REPLACED_BY_cairo_get_target_surface +#define cairo_get_status cairo_get_status_REPLACED_BY_cairo_status +#define cairo_get_status_string cairo_get_status_string_REPLACED_BY_cairo_status_string +#define cairo_concat_matrix cairo_concat_matrix_REPLACED_BY_cairo_transform +#define cairo_scale_font cairo_scale_font_REPLACED_BY_cairo_set_font_size +#define cairo_select_font cairo_select_font_REPLACED_BY_cairo_select_font_face +#define cairo_transform_font cairo_transform_font_REPLACED_BY_cairo_set_font_matrix +#define cairo_transform_point cairo_transform_point_REPLACED_BY_cairo_user_to_device +#define cairo_transform_distance cairo_transform_distance_REPLACED_BY_cairo_user_to_device_distance +#define cairo_inverse_transform_point cairo_inverse_transform_point_REPLACED_BY_cairo_device_to_user +#define cairo_inverse_transform_distance cairo_inverse_transform_distance_REPLACED_BY_cairo_device_to_user_distance +#define cairo_init_clip cairo_init_clip_REPLACED_BY_cairo_reset_clip +#define cairo_surface_create_for_image cairo_surface_create_for_image_REPLACED_BY_cairo_image_surface_create_for_data +#define cairo_default_matrix cairo_default_matrix_REPLACED_BY_cairo_identity_matrix +#define cairo_matrix_set_affine cairo_matrix_set_affine_REPLACED_BY_cairo_matrix_init +#define cairo_matrix_set_identity cairo_matrix_set_identity_REPLACED_BY_cairo_matrix_init_identity +#define cairo_pattern_add_color_stop cairo_pattern_add_color_stop_REPLACED_BY_cairo_pattern_add_color_stop_rgba +#define cairo_set_rgb_color cairo_set_rgb_color_REPLACED_BY_cairo_set_source_rgb +#define cairo_set_pattern cairo_set_pattern_REPLACED_BY_cairo_set_source + +#define cairo_current_path cairo_current_path_DEPRECATED_BY_cairo_copy_path +#define cairo_current_path_flat cairo_current_path_flat_DEPRECATED_BY_cairo_copy_path_flat +#define cairo_get_path cairo_get_path_DEPRECATED_BY_cairo_copy_path +#define cairo_get_path_flat cairo_get_path_flat_DEPRECATED_BY_cairo_get_path_flat +#define cairo_set_alpha cairo_set_alpha_DEPRECATED_BY_cairo_set_source_rgba +#define cairo_show_surface cairo_show_surface_DEPRECATED_BY_cairo_set_source_surface_AND_cairo_paint +#define cairo_copy cairo_copy_DEPRECATED_BY_cairo_create_AND_MANY_INDIVIDUAL_FUNCTIONS +#define cairo_surface_set_repeat cairo_surface_set_repeat_DEPRECATED_BY_cairo_pattern_set_extend +#define cairo_surface_set_matrix cairo_surface_set_matrix_DEPRECATED_BY_cairo_pattern_set_matrix +#define cairo_surface_get_matrix cairo_surface_get_matrix_DEPRECATED_BY_cairo_pattern_get_matrix +#define cairo_surface_set_filter cairo_surface_set_filter_DEPRECATED_BY_cairo_pattern_set_filter +#define cairo_surface_get_filter cairo_surface_get_filter_DEPRECATED_BY_cairo_pattern_get_filter +#define cairo_matrix_create cairo_matrix_create_DEPRECATED_BY_cairo_matrix_t +#define cairo_matrix_destroy cairo_matrix_create_DEPRECATED_BY_cairo_matrix_t +#define cairo_matrix_copy cairo_matrix_create_DEPRECATED_BY_cairo_matrix_t +#define cairo_matrix_get_affine cairo_matrix_create_DEPRECATED_BY_cairo_matrix_t #endif diff --git a/src/cairoint.h b/src/cairoint.h index e13706226..68cfd1e85 100644 --- a/src/cairoint.h +++ b/src/cairoint.h @@ -91,7 +91,7 @@ #define cairo_private #endif -/* These macros allow us to deprecate a function by providing an alias +/* This macro allow us to deprecate a function by providing an alias for the old function name to the new function name. With this macro, binary compatibility is preserved. The macro only works on some platforms --- tough. @@ -100,14 +100,15 @@ source code so that it will no longer link against the old symbols. Instead it will give a descriptive error message indicating that the old function has been deprecated by the new - function. */ + function. +*/ #if __GNUC__ >= 2 && defined(__ELF__) -# define DEPRECATE(old, new) \ +# define CAIRO_FUNCTION_ALIAS(old, new) \ extern __typeof (new) old \ __asm__ ("" #old) \ __attribute__((__alias__("" #new))) #else -# define DEPRECATE(old, new) +# define CAIRO_FUNCTION_ALIAS(old, new) #endif #ifndef __GNUC__ @@ -1620,6 +1621,12 @@ _cairo_spline_fini (cairo_spline_t *spline); /* cairo_matrix.c */ cairo_private void +_cairo_matrix_get_affine (cairo_matrix_t *matrix, + double *xx, double *yx, + double *xy, double *yy, + double *x0, double *y0); + +cairo_private void _cairo_matrix_transform_bounding_box (cairo_matrix_t *matrix, double *x, double *y, double *width, double *height); @@ -1800,7 +1807,6 @@ slim_hidden_proto(cairo_get_current_point) slim_hidden_proto(cairo_fill_preserve) slim_hidden_proto(cairo_clip_preserve) slim_hidden_proto(cairo_close_path) -slim_hidden_proto(cairo_matrix_copy) slim_hidden_proto(cairo_matrix_invert) slim_hidden_proto(cairo_matrix_multiply) slim_hidden_proto(cairo_matrix_scale) @@ -1818,8 +1824,5 @@ slim_hidden_proto(cairo_restore) slim_hidden_proto(cairo_save) slim_hidden_proto(cairo_stroke_preserve) slim_hidden_proto(cairo_surface_destroy) -slim_hidden_proto(cairo_surface_get_matrix) -slim_hidden_proto(cairo_surface_set_matrix) -slim_hidden_proto(cairo_surface_set_repeat) #endif diff --git a/test/cairo-test.c b/test/cairo-test.c index bd69808e1..bce61240d 100644 --- a/test/cairo-test.c +++ b/test/cairo-test.c @@ -410,12 +410,11 @@ cairo_test_create_png_pattern (cairo_t *cr, const char *filename) if (status != READ_PNG_SUCCESS) return NULL; - image = cairo_surface_create_for_image (buffer, CAIRO_FORMAT_ARGB32, - w, h, stride); - - cairo_surface_set_repeat (image, 1); + image = cairo_image_surface_create_for_data (buffer, CAIRO_FORMAT_ARGB32, + w, h, stride); pattern = cairo_pattern_create_for_surface (image); + cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT); return pattern; } diff --git a/test/gradient-alpha.c b/test/gradient-alpha.c index c42131090..3015728b0 100644 --- a/test/gradient-alpha.c +++ b/test/gradient-alpha.c @@ -38,14 +38,14 @@ draw (cairo_t *cr, int width, int height) gradient = cairo_pattern_create_linear (0, -height, 0, height); - cairo_pattern_add_color_stop (gradient, 0.0, - 1.0, 0.0, 0.0, - 1.0); - cairo_pattern_add_color_stop (gradient, 1.0, - 0.0, 0.0, 1.0, - 0.5); - - cairo_set_pattern (cr, gradient); + cairo_pattern_add_color_stop_rgba (gradient, 0.0, + 1.0, 0.0, 0.0, + 1.0); + cairo_pattern_add_color_stop_rgba (gradient, 1.0, + 0.0, 0.0, 1.0, + 0.5); + + cairo_set_source (cr, gradient); cairo_paint (cr); diff --git a/test/mask.c b/test/mask.c index c6d602d4b..ec0322da0 100644 --- a/test/mask.c +++ b/test/mask.c @@ -53,9 +53,9 @@ set_gradient_pattern (cairo_t *cr, int x, int y) pattern = cairo_pattern_create_linear (x, y, x + WIDTH, y + HEIGHT); - cairo_pattern_add_color_stop (pattern, 0, 1, 1, 1, 1); - cairo_pattern_add_color_stop (pattern, 1, 0, 0, 0.4, 1); - cairo_set_pattern (cr, pattern); + cairo_pattern_add_color_stop_rgba (pattern, 0, 1, 1, 1, 1); + cairo_pattern_add_color_stop_rgba (pattern, 1, 0, 0, 0.4, 1); + cairo_set_source (cr, pattern); } static void @@ -64,7 +64,7 @@ set_image_pattern (cairo_t *cr, int x, int y) cairo_pattern_t *pattern; pattern = cairo_test_create_png_pattern (cr, png_filename); - cairo_set_pattern (cr, pattern); + cairo_set_source (cr, pattern); } static void diff --git a/test/move-to-show-surface.c b/test/move-to-show-surface.c index d29b8274d..c5cc1ae59 100644 --- a/test/move-to-show-surface.c +++ b/test/move-to-show-surface.c @@ -62,8 +62,9 @@ draw (cairo_t *cr, int width, int height) int i; for (i=0; i < 4; i++) { - surface = cairo_surface_create_for_image ((unsigned char *) &colors[i], - CAIRO_FORMAT_ARGB32, 1, 1, 4); + surface = cairo_image_surface_create_for_data ((unsigned char *) &colors[i], + CAIRO_FORMAT_ARGB32, + 1, 1, 4); cairo_set_source_surface (cr, surface, i % 2, i / 2); cairo_paint (cr); diff --git a/test/select-font-no-show-text.c b/test/select-font-no-show-text.c index ee5f56390..8f7708fff 100644 --- a/test/select-font-no-show-text.c +++ b/test/select-font-no-show-text.c @@ -50,9 +50,9 @@ static cairo_test_t test = { static cairo_test_status_t draw (cairo_t *cr, int width, int height) { - cairo_select_font (cr, "Bitstream Vera Sans", - CAIRO_FONT_SLANT_NORMAL, - CAIRO_FONT_WEIGHT_BOLD); + cairo_select_font_face (cr, "Bitstream Vera Sans", + CAIRO_FONT_SLANT_NORMAL, + CAIRO_FONT_WEIGHT_BOLD); return CAIRO_TEST_SUCCESS; } diff --git a/test/set-source.c b/test/set-source.c index 26524917e..568935df6 100644 --- a/test/set-source.c +++ b/test/set-source.c @@ -41,8 +41,8 @@ draw (cairo_t *cr, int width, int height) cairo_surface_t *surface; cairo_pattern_t *pattern; - surface = cairo_surface_create_for_image ((unsigned char *) &color, - CAIRO_FORMAT_ARGB32, 1, 1, 4); + surface = cairo_image_surface_create_for_data ((unsigned char *) &color, + CAIRO_FORMAT_ARGB32, 1, 1, 4); pattern = cairo_pattern_create_for_surface (surface); cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT); diff --git a/test/text-cache-crash.c b/test/text-cache-crash.c index 188852e58..547e2a34c 100644 --- a/test/text-cache-crash.c +++ b/test/text-cache-crash.c @@ -73,13 +73,15 @@ static cairo_test_status_t draw (cairo_t *cr, int width, int height) { /* Once there was a bug that choked when selecting the same font twice. */ - cairo_select_font(cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); - cairo_set_font_size(cr, 40.0); - - cairo_select_font(cr, "sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); - cairo_set_font_size(cr, 40.0); - cairo_move_to(cr, 10, 50); - cairo_show_text(cr, "hello"); + cairo_select_font_face (cr, "sans", + CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); + cairo_set_font_size (cr, 40.0); + + cairo_select_font_face (cr, "sans", + CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD); + cairo_set_font_size (cr, 40.0); + cairo_move_to (cr, 10, 50); + cairo_show_text (cr, "hello"); /* Then there was a bug that choked when selecting a font too big * for the cache. */ diff --git a/test/text-rotate.c b/test/text-rotate.c index 95a602954..6301ad9fa 100644 --- a/test/text-rotate.c +++ b/test/text-rotate.c @@ -78,9 +78,9 @@ draw (cairo_t *cr, int width, int height) cairo_text_extents_t extents; static char text[] = "cairo"; - cairo_select_font (cr, "Bitstream Vera Sans", - CAIRO_FONT_SLANT_NORMAL, - CAIRO_FONT_WEIGHT_NORMAL); + cairo_select_font_face (cr, "Bitstream Vera Sans", + CAIRO_FONT_SLANT_NORMAL, + CAIRO_FONT_WEIGHT_NORMAL); cairo_set_font_size (cr, TEXT_SIZE); cairo_set_source_rgb (cr, 0, 0, 0); diff --git a/test/transforms.c b/test/transforms.c index 9b1254aaf..2c7556a9d 100644 --- a/test/transforms.c +++ b/test/transforms.c @@ -42,7 +42,7 @@ draw_L_shape (cairo_t *cr) cairo_rel_line_to (cr, 5, 0); cairo_save (cr); - cairo_default_matrix (cr); + cairo_identity_matrix (cr); cairo_set_line_width (cr, 2.0); cairo_stroke (cr); cairo_restore (cr); diff --git a/test/translate-show-surface.c b/test/translate-show-surface.c index 57700fc16..5a566bcb1 100644 --- a/test/translate-show-surface.c +++ b/test/translate-show-surface.c @@ -60,8 +60,9 @@ draw (cairo_t *cr, int width, int height) int i; for (i=0; i < 4; i++) { - surface = cairo_surface_create_for_image ((unsigned char *) &colors[i], - CAIRO_FORMAT_ARGB32, 1, 1, 4); + surface = cairo_image_surface_create_for_data ((unsigned char *) &colors[i], + CAIRO_FORMAT_ARGB32, + 1, 1, 4); cairo_save (cr); { cairo_translate (cr, i % 2, i / 2); diff --git a/test/trap-clip.c b/test/trap-clip.c index 15549ae1b..241680392 100644 --- a/test/trap-clip.c +++ b/test/trap-clip.c @@ -52,9 +52,9 @@ set_gradient_pattern (cairo_t *cr, int x, int y) pattern = cairo_pattern_create_linear (x, y, x + WIDTH, y + HEIGHT); - cairo_pattern_add_color_stop (pattern, 0, 1, 1, 1, 1); - cairo_pattern_add_color_stop (pattern, 1, 0, 0, 0.4, 1); - cairo_set_pattern (cr, pattern); + cairo_pattern_add_color_stop_rgba (pattern, 0, 1, 1, 1, 1); + cairo_pattern_add_color_stop_rgba (pattern, 1, 0, 0, 0.4, 1); + cairo_set_source (cr, pattern); } static void @@ -63,7 +63,7 @@ set_image_pattern (cairo_t *cr, int x, int y) cairo_pattern_t *pattern; pattern = cairo_test_create_png_pattern (cr, png_filename); - cairo_set_pattern (cr, pattern); + cairo_set_source (cr, pattern); } static void diff --git a/util/cairo-api-update b/util/cairo-api-update index d2dfc0fa0..764808484 100755 --- a/util/cairo-api-update +++ b/util/cairo-api-update @@ -15,20 +15,42 @@ cairo_api_update() { cp $file $backup sed -e ' - s/cairo_get_operator/cairo_current_operator/g - s/cairo_get_rgb_color/cairo_current_rgb_color/g - s/cairo_get_alpha/cairo_current_alpha/g - s/cairo_get_tolerance/cairo_current_tolerance/g - s/cairo_get_current_point/cairo_current_point/g - s/cairo_get_fill_rule/cairo_current_fill_rule/g - s/cairo_get_line_width/cairo_current_line_width/g - s/cairo_get_line_cap/cairo_current_line_cap/g - s/cairo_get_line_join/cairo_current_line_join/g - s/cairo_get_miter_limit/cairo_current_miter_limit/g - s/cairo_get_matrix/cairo_current_matrix/g - s/cairo_get_target_surface/cairo_current_target_surface/g - s/cairo_get_status_string/cairo_status_string/g + s/cairo_current_font_extents/cairo_font_extents/g + s/cairo_get_font_extents/cairo_font_extents/g + s/cairo_current_operator/cairo_get_operator/g + s/cairo_current_tolerance/cairo_get_tolerance/g + s/cairo_current_point/cairo_get_current_point/g + s/cairo_current_fill_rule/cairo_get_fill_rule/g + s/cairo_current_line_width/cairo_get_line_width/g + s/cairo_current_line_cap/cairo_get_line_cap/g + s/cairo_current_line_join/cairo_get_line_join/g + s/cairo_current_miter_limit/cairo_get_miter_limit/g + s/cairo_current_matrix/cairo_get_matrix/g + s/cairo_current_target_surface/cairo_get_target_surface/g s/cairo_get_status/cairo_status/g + s/cairo_get_status_string/cairo_status_string/g + s/cairo_concat_matrix/cairo_transform/g + s/cairo_scale_font/cairo_set_font_size/g + s/cairo_select_font/cairo_select_font_face/g + s/cairo_transform_font/cairo_set_font_matrix/g + s/cairo_transform_point/cairo_user_to_device/g + s/cairo_transform_distance/cairo_user_to_device_distance/g + s/cairo_inverse_transform_point/cairo_device_to_user/g + s/cairo_inverse_transform_distance/cairo_device_to_user_distance/g + s/cairo_init_clip/cairo_reset_clip/g + s/cairo_surface_create_for_image/cairo_image_surface_create_for_data/g + s/cairo_default_matrix/cairo_identity_matrix/g + s/cairo_matrix_set_affine/cairo_matrix_init/g + s/cairo_matrix_set_identity/cairo_matrix_init_identity/g + s/cairo_pattern_add_color_stop/cairo_pattern_add_color_stop_rgba/g + s/cairo_set_rgb_color/cairo_set_source_rgb/g + s/cairo_set_pattern/cairo_set_source/g + s/CAIRO_OPERATOR_SRC/CAIRO_OPERATOR_SOURCE/g + s/CAIRO_OPERATOR_DST/CAIRO_OPERATOR_DEST/g + s/CAIRO_OPERATOR_OVER_REVERSE/CAIRO_OPERATOR_DEST_OVER/g + s/CAIRO_OPERATOR_IN_REVERSE/CAIRO_OPERATOR_DEST_IN/g + s/CAIRO_OPERATOR_OUT_REVERSE/CAIRO_OPERATOR_DEST_OUT/g + s/CAIRO_OPERATOR_ATOP_REVERSE/CAIRO_OPERATOR_DEST_ATOP/g ' $backup > $file } |