[cairo-commit] cairo/src cairo.c, 1.60, 1.61 cairo.h, 1.84, 1.85 cairo_gstate.c, 1.94, 1.95 cairo_matrix.c, 1.20, 1.21 cairoint.h, 1.108, 1.109

Carl Worth commit at pdx.freedesktop.org
Sun Mar 20 23:23:21 PST 2005


Committed by: cworth

Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv30185/src

Modified Files:
	cairo.c cairo.h cairo_gstate.c cairo_matrix.c cairoint.h 
Log Message:

        * src/cairo.c:
        * src/cairo_gstate.c: (_cairo_gstate_transform),
        (_cairo_gstate_user_to_device),
        (_cairo_gstate_user_to_device_distance),
        (_cairo_gstate_device_to_user),
        (_cairo_gstate_device_to_user_distance),
        (_cairo_gstate_reset_clip):
        * src/cairo_matrix.c:
        * src/cairoint.h:
        * src/cairo.h: Rename functions to eliminate abbreviations:
        cairo_concat_matrix             -> cairo_transform
        cairo_transform_point           -> cairo_user_to_device
        cairo_transform_distance        -> cairo_user_to_device_distance
        cairo_inverse_transform_point   -> cairo_device_to_user
        cairo_inverse_transform_distance-> cairo_device_to_user_distance
        cairo_init_clip                 -> cairo_reset_clip


Index: cairo.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.c,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- cairo.c	18 Mar 2005 22:28:53 -0000	1.60
+++ cairo.c	21 Mar 2005 07:23:19 -0000	1.61
@@ -619,6 +619,19 @@
     CAIRO_CHECK_SANITY (cr);
 }
 
+
+/**
+ * cairo_translate:
+ * @cr: a cairo context
+ * @tx: amount to translate in the X direction
+ * @ty: amount to translate in the Y direction
+ * 
+ * Modifies the current transformation matrix (CTM) by tanslating the
+ * user-space origin by (@tx, @ty). This offset is interpreted as a
+ * user-space coordinate according to the CTM in place before the new
+ * call to cairo_translate. In other words, the translation of the
+ * user-space origin takes place after any existing transformation.
+ **/
 void
 cairo_translate (cairo_t *cr, double tx, double ty)
 {
@@ -630,6 +643,17 @@
     CAIRO_CHECK_SANITY (cr);
 }
 
+/**
+ * cairo_scale:
+ * @cr: a cairo context
+ * @sx: scale factor for the X dimension
+ * @sy: scale factor for the Y dimension
+ * 
+ * Modifies the current transformation matrix (CTM) by scaling the X
+ * and Y user-space axes by @sx and @sy respectively. The scaling of
+ * the axes takes place after any existing transformation of user
+ * space.
+ **/
 void
 cairo_scale (cairo_t *cr, double sx, double sy)
 {
@@ -641,6 +665,19 @@
     CAIRO_CHECK_SANITY (cr);
 }
 
+
+/**
+ * cairo_rotate:
+ * @cr: a cairo context
+ * @angle: angle (in radians) by which the user-space axes will be
+ * rotated
+ * 
+ * Modifies the current transformation matrix (CTM) by rotating the
+ * user-space axes by @angle radians. The rotation of the axes takes
+ * places after any existing transformation of user space. The
+ * rotation direction for positive angles is from the positive X axis
+ * toward the positive Y axis.
+ **/
 void
 cairo_rotate (cairo_t *cr, double angle)
 {
@@ -652,17 +689,26 @@
     CAIRO_CHECK_SANITY (cr);
 }
 
+/**
+ * cairo_transform:
+ * @cr: a cairo context
+ * @matrix: a transformation to be applied to the user-space axes
+ * 
+ * Modifies the current transformation matrix (CTM) by applying
+ * @matrix as an additional transformation. The new transformation of
+ * user space takes place after any existing transformation.
+ **/
 void
-cairo_concat_matrix (cairo_t *cr,
-	       cairo_matrix_t *matrix)
+cairo_transform (cairo_t *cr, cairo_matrix_t *matrix)
 {
     CAIRO_CHECK_SANITY (cr);
     if (cr->status)
 	return;
 
-    cr->status = _cairo_gstate_concat_matrix (cr->gstate, matrix);
+    cr->status = _cairo_gstate_transform (cr->gstate, matrix);
     CAIRO_CHECK_SANITY (cr);
 }
+DEPRECATE(cairo_concat_matrix, cairo_transform);
 
 void
 cairo_set_matrix (cairo_t *cr,
@@ -698,49 +744,96 @@
     CAIRO_CHECK_SANITY (cr);
 }
 
+
+/**
+ * cairo_user_to_device:
+ * @cr: a cairo context
+ * @x: X value of coordinate (in/out parameter)
+ * @y: Y value of coordinate (in/out parameter)
+ * 
+ * Transform a coordinate from user space to device space by
+ * multiplying the given point by the current transformation matrix
+ * (CTM).
+ **/
 void
-cairo_transform_point (cairo_t *cr, double *x, double *y)
+cairo_user_to_device (cairo_t *cr, double *x, double *y)
 {
     CAIRO_CHECK_SANITY (cr);
     if (cr->status)
 	return;
 
-    cr->status = _cairo_gstate_transform_point (cr->gstate, x, 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:
+ * @cr: a cairo context
+ * @dx: X component of a distance vector (in/out parameter)
+ * @dy: Y component of a distance vector (in/out parameter)
+ * 
+ * Transform a distance vector from user space to device space. This
+ * function is similar to cairo_user_to_device() except that the
+ * translation components of the CTM will be ignored when transforming
+ * (@dx, at dy).
+ **/
 void
-cairo_transform_distance (cairo_t *cr, double *dx, double *dy)
+cairo_user_to_device_distance (cairo_t *cr, double *dx, double *dy)
 {
     CAIRO_CHECK_SANITY (cr);
     if (cr->status)
 	return;
 
-    cr->status = _cairo_gstate_transform_distance (cr->gstate, dx, 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:
+ * @cr: a cairo
+ * @x: X value of coordinate (in/out parameter)
+ * @y: Y value of coordinate (in/out parameter)
+ * 
+ * Transform a coordinate from device space to user space by
+ * multiplying the given point by the inverse of the current
+ * transformation matrix (CTM).
+ **/
 void
-cairo_inverse_transform_point (cairo_t *cr, double *x, double *y)
+cairo_device_to_user (cairo_t *cr, double *x, double *y)
 {
     CAIRO_CHECK_SANITY (cr);
     if (cr->status)
 	return;
 
-    cr->status = _cairo_gstate_inverse_transform_point (cr->gstate, x, 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:
+ * @cr: a cairo context
+ * @dx: X component of a distance vector (in/out parameter)
+ * @dy: Y component of a distance vector (in/out parameter)
+ * 
+ * Transform a distance vector from device space to user space. This
+ * function is similar to cairo_device_to_user() except that the
+ * translation components of the inverse CTM will be ignored when
+ * transforming (@dx, at dy).
+ **/
 void
-cairo_inverse_transform_distance (cairo_t *cr, double *dx, double *dy)
+cairo_device_to_user_distance (cairo_t *cr, double *dx, double *dy)
 {
     CAIRO_CHECK_SANITY (cr);
     if (cr->status)
 	return;
 
-    cr->status = _cairo_gstate_inverse_transform_distance (cr->gstate, dx, 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)
@@ -1077,27 +1170,63 @@
     CAIRO_CHECK_SANITY (cr);
 }
 
+/**
+ * cairo_clip:
+ * @cr: a cairo context
+ * 
+ * Establishes a new clip region by intersecting the current clip
+ * region with the current path as it would be filled by cairo_fill()
+ * and according to the current fill rule (see cairo_set_fill_rule()).
+ *
+ * The current clip region affects all drawing operations by
+ * effectively masking out any changes to the surface that are outside
+ * the current clip region.
+ *
+ * Calling cairo_clip() can only make the clip region smaller, never
+ * larger. But the current clip is part of the graphics state, so a
+ * tempoarary restriction of the clip region can be achieved by
+ * calling cairo_clip() within a cairo_save()/cairo_restore()
+ * pair. The only other means of increasing the size of the clip
+ * region is cairo_reset_clip().
+ **/
 void
-cairo_init_clip (cairo_t *cr)
+cairo_clip (cairo_t *cr)
 {
     CAIRO_CHECK_SANITY (cr);
     if (cr->status)
 	return;
 
-    cr->status = _cairo_gstate_init_clip (cr->gstate);
+    cr->status = _cairo_gstate_clip (cr->gstate);
     CAIRO_CHECK_SANITY (cr);
 }
 
+/**
+ * cairo_reset_clip:
+ * @cr: a cairo context
+ * 
+ * Reset the current clip region to its original, unrestricted
+ * state. That is, set the clip region to an infinitely large shape
+ * containing the target surface. Equivalently, if infinity is too
+ * hard to grasp, one can imagine the clip region being reset to the
+ * exact bounds of the target surface.
+ *
+ * Note that code meant to be reusable should not call
+ * cairo_reset_clip() as it will cause results unexpected by
+ * higher-level code which calls cairo_clip(). Consider using
+ * cairo_save() and cairo_restore() around cairo_clip() as a more
+ * robust means of temporarily restricting the clip region.
+ **/
 void
-cairo_clip (cairo_t *cr)
+cairo_reset_clip (cairo_t *cr)
 {
     CAIRO_CHECK_SANITY (cr);
     if (cr->status)
 	return;
 
-    cr->status = _cairo_gstate_clip (cr->gstate);
+    cr->status = _cairo_gstate_reset_clip (cr->gstate);
     CAIRO_CHECK_SANITY (cr);
 }
+DEPRECATE (cairo_init_clip, cairo_reset_clip);
 
 void
 cairo_select_font (cairo_t              *cr, 

Index: cairo.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.h,v
retrieving revision 1.84
retrieving revision 1.85
diff -u -d -r1.84 -r1.85
--- cairo.h	18 Mar 2005 22:28:53 -0000	1.84
+++ cairo.h	21 Mar 2005 07:23:19 -0000	1.85
@@ -310,8 +310,8 @@
 cairo_rotate (cairo_t *cr, double angle);
 
 void
-cairo_concat_matrix (cairo_t *cr,
-		     cairo_matrix_t *matrix);
+cairo_transform (cairo_t *cr,
+		 cairo_matrix_t *matrix);
 
 void
 cairo_set_matrix (cairo_t *cr,
@@ -326,16 +326,16 @@
 cairo_identity_matrix (cairo_t *cr);
 
 void
-cairo_transform_point (cairo_t *cr, double *x, double *y);
+cairo_user_to_device (cairo_t *cr, double *x, double *y);
 
 void
-cairo_transform_distance (cairo_t *cr, double *dx, double *dy);
+cairo_user_to_device_distance (cairo_t *cr, double *dx, double *dy);
 
 void
-cairo_inverse_transform_point (cairo_t *cr, double *x, double *y);
+cairo_device_to_user (cairo_t *cr, double *x, double *y);
 
 void
-cairo_inverse_transform_distance (cairo_t *cr, double *dx, double *dy);
+cairo_device_to_user_distance (cairo_t *cr, double *dx, double *dy);
 
 /* Path creation functions */
 void
@@ -438,7 +438,7 @@
 
 /* Clipping */
 void
-cairo_init_clip (cairo_t *cr);
+cairo_reset_clip (cairo_t *cr);
 
 /* Note: cairo_clip does not consume the current path */
 void

Index: cairo_gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_gstate.c,v
retrieving revision 1.94
retrieving revision 1.95
diff -u -d -r1.94 -r1.95
--- cairo_gstate.c	18 Mar 2005 22:28:53 -0000	1.94
+++ cairo_gstate.c	21 Mar 2005 07:23:19 -0000	1.95
@@ -635,8 +635,7 @@
 }
 
 cairo_status_t
-_cairo_gstate_concat_matrix (cairo_gstate_t *gstate,
-		      cairo_matrix_t *matrix)
+_cairo_gstate_transform (cairo_gstate_t *gstate, cairo_matrix_t *matrix)
 {
     cairo_matrix_t tmp;
 
@@ -700,7 +699,7 @@
 }
 
 cairo_status_t
-_cairo_gstate_transform_point (cairo_gstate_t *gstate, double *x, double *y)
+_cairo_gstate_user_to_device (cairo_gstate_t *gstate, double *x, double *y)
 {
     cairo_matrix_transform_point (&gstate->ctm, x, y);
 
@@ -708,7 +707,8 @@
 }
 
 cairo_status_t
-_cairo_gstate_transform_distance (cairo_gstate_t *gstate, double *dx, double *dy)
+_cairo_gstate_user_to_device_distance (cairo_gstate_t *gstate,
+				       double *dx, double *dy)
 {
     cairo_matrix_transform_distance (&gstate->ctm, dx, dy);
 
@@ -716,13 +716,22 @@
 }
 
 cairo_status_t
-_cairo_gstate_inverse_transform_point (cairo_gstate_t *gstate, double *x, double *y)
+_cairo_gstate_device_to_user (cairo_gstate_t *gstate, double *x, double *y)
 {
     cairo_matrix_transform_point (&gstate->ctm_inverse, x, y);
 
     return CAIRO_STATUS_SUCCESS;
 }
 
+cairo_status_t
+_cairo_gstate_device_to_user_distance (cairo_gstate_t *gstate,
+				       double *dx, double *dy)
+{
+    cairo_matrix_transform_distance (&gstate->ctm_inverse, dx, dy);
+
+    return CAIRO_STATUS_SUCCESS;
+}
+
 static void
 _cairo_gstate_user_to_backend (cairo_gstate_t *gstate, double *x, double *y)
 {
@@ -744,14 +753,6 @@
 }
 
 cairo_status_t
-_cairo_gstate_inverse_transform_distance (cairo_gstate_t *gstate, double *dx, double *dy)
-{
-    cairo_matrix_transform_distance (&gstate->ctm_inverse, dx, dy);
-
-    return CAIRO_STATUS_SUCCESS;
-}
-
-cairo_status_t
 _cairo_gstate_new_path (cairo_gstate_t *gstate)
 {
     _cairo_path_fini (&gstate->path);
@@ -1794,7 +1795,7 @@
 }
 
 cairo_status_t
-_cairo_gstate_init_clip (cairo_gstate_t *gstate)
+_cairo_gstate_reset_clip (cairo_gstate_t *gstate)
 {
     /* destroy any existing clip-region artifacts */
     if (gstate->clip.surface)

Index: cairo_matrix.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_matrix.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- cairo_matrix.c	17 Mar 2005 21:27:26 -0000	1.20
+++ cairo_matrix.c	21 Mar 2005 07:23:19 -0000	1.21
@@ -368,11 +368,13 @@
 /**
  * cairo_matrix_transform_distance:
  * @matrix: a @cairo_matrix_t
- * @dx: a distance in the X direction. An in/out parameter
- * @dy: a distance in the Y direction. An in/out parameter
+ * @dx: X component of a distance vector. An in/out parameter
+ * @dy: Y component of a distance vector. An in/out parameter
  * 
- * Transforms the vector (@dx, at dy) by @matrix.  Translation is
- * ignored. In terms of the components of the affine transformation:
+ * Transforms the distance vector (@dx, at dy) by @matrix. This is
+ * similar to cairo_matrix_transform() except that the translation
+ * components of the transformation are ignored. The calculation of
+ * the returned vector is as follows:
  *
  * <programlisting>
  * dx2 = dx1 * a + dy1 * c;

Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.108
retrieving revision 1.109
diff -u -d -r1.108 -r1.109
--- cairoint.h	18 Mar 2005 22:28:53 -0000	1.108
+++ cairoint.h	21 Mar 2005 07:23:19 -0000	1.109
@@ -1040,8 +1040,8 @@
 _cairo_gstate_rotate (cairo_gstate_t *gstate, double angle);
 
 cairo_private cairo_status_t
-_cairo_gstate_concat_matrix (cairo_gstate_t *gstate,
-			     cairo_matrix_t *matrix);
+_cairo_gstate_transform (cairo_gstate_t *gstate,
+			 cairo_matrix_t *matrix);
 
 cairo_private cairo_status_t
 _cairo_gstate_set_matrix (cairo_gstate_t *gstate,
@@ -1054,16 +1054,16 @@
 _cairo_gstate_identity_matrix (cairo_gstate_t *gstate);
 
 cairo_private cairo_status_t
-_cairo_gstate_transform_point (cairo_gstate_t *gstate, double *x, double *y);
+_cairo_gstate_user_to_device (cairo_gstate_t *gstate, double *x, double *y);
 
 cairo_private cairo_status_t
-_cairo_gstate_transform_distance (cairo_gstate_t *gstate, double *dx, double *dy);
+_cairo_gstate_user_to_device_distance (cairo_gstate_t *gstate, double *dx, double *dy);
 
 cairo_private cairo_status_t
-_cairo_gstate_inverse_transform_point (cairo_gstate_t *gstate, double *x, double *y);
+_cairo_gstate_device_to_user (cairo_gstate_t *gstate, double *x, double *y);
 
 cairo_private cairo_status_t
-_cairo_gstate_inverse_transform_distance (cairo_gstate_t *gstate, double *dx, double *dy);
+_cairo_gstate_device_to_user_distance (cairo_gstate_t *gstate, double *dx, double *dy);
 
 cairo_private cairo_status_t
 _cairo_gstate_new_path (cairo_gstate_t *gstate);
@@ -1158,10 +1158,10 @@
 		       cairo_bool_t	*inside_ret);
 
 cairo_private cairo_status_t
-_cairo_gstate_init_clip (cairo_gstate_t *gstate);
+_cairo_gstate_clip (cairo_gstate_t *gstate);
 
 cairo_private cairo_status_t
-_cairo_gstate_clip (cairo_gstate_t *gstate);
+_cairo_gstate_reset_clip (cairo_gstate_t *gstate);
 
 cairo_private cairo_status_t
 _cairo_gstate_restore_external_state (cairo_gstate_t *gstate);




More information about the cairo-commit mailing list