[Xr] XrMatrixGetAffine() function

Soorya Kuloor skuloor at verano.com
Thu Jun 5 09:56:30 PDT 2003


Hi Carl,

Here is a patch that adds XrMatrixGetAffine() function to Xr. I require
this capability in my classes to retain symmetricity in the API (and SVG
requires this for the 'Matrix' interface). I have tested the function
and it works fine.

Thanks,
-- Soorya
-------------- next part --------------
? src/junk
Index: src/Xr.h
===================================================================
RCS file: /local/src/CVS/Xr/src/Xr.h,v
retrieving revision 1.28
diff -c -r1.28 Xr.h
*** src/Xr.h	29 May 2003 02:28:53 -0000	1.28
--- src/Xr.h	5 Jun 2003 16:52:11 -0000
***************
*** 438,443 ****
--- 438,449 ----
  		   double tx, double ty);
  
  XrStatus
+ XrMatrixGetAffine (XrMatrix *xrs,
+ 		   double *a, double *b,
+ 		   double *c, double *d,
+ 		   double *tx, double *ty);
+ 
+ XrStatus
  XrMatrixTranslate (XrMatrix *matrix, double tx, double ty);
  
  XrStatus
Index: src/xrmatrix.c
===================================================================
RCS file: /local/src/CVS/Xr/src/xrmatrix.c,v
retrieving revision 1.2
diff -c -r1.2 xrmatrix.c
*** src/xrmatrix.c	29 May 2003 02:28:53 -0000	1.2
--- src/xrmatrix.c	5 Jun 2003 16:52:11 -0000
***************
*** 105,110 ****
--- 105,123 ----
  }
  
  XrStatus
+ XrMatrixGetAffine (XrMatrix *matrix,
+ 		   double *a, double *b,
+ 		   double *c, double *d,
+ 		   double *tx, double *ty)
+ {
+     *a  = matrix->m[0][0]; *b  = matrix->m[0][1];
+     *c  = matrix->m[1][0]; *d  = matrix->m[1][1];
+     *tx = matrix->m[2][0]; *ty = matrix->m[2][1];
+ 
+     return XrStatusSuccess;
+ }
+ 
+ XrStatus
  _XrMatrixSetTranslate(XrMatrix *matrix,
  		       double tx, double ty)
  {


More information about the cairo mailing list