added getter for matrix entries.
authorkramm <kramm>
Thu, 30 Dec 2004 20:00:53 +0000 (20:00 +0000)
committerkramm <kramm>
Thu, 30 Dec 2004 20:00:53 +0000 (20:00 +0000)
lib/python/primitives.c

index cbd2442..008c84a 100644 (file)
@@ -294,6 +294,17 @@ PyObject* f_Matrix(PyObject* _self, PyObject* args, PyObject* kwargs)
 static PyObject* matrix_getattr(PyObject * self, char* a)
 {
     PY_ASSERT_TYPE(self,&MatrixClass);
+    MatrixObject*matrix = (MatrixObject*)self;
+    if(!strcmp(a, "entries")) {
+       return Py_BuildValue("(ffffff)",
+               matrix->matrix.sx/65536.0,
+               matrix->matrix.r0/65536.0,
+               matrix->matrix.r1/65536.0,
+               matrix->matrix.sy/65536.0,
+               matrix->matrix.tx/20.0,
+               matrix->matrix.ty/20.0
+               );
+    }
     return NULL;
 }
 static int matrix_setattr(PyObject * self, char* a, PyObject* o)