set ob_type for FillStyle/LineStyle.
[swftools.git] / lib / python / primitives.c
index 55e80d0..7a8a717 100644 (file)
@@ -247,6 +247,14 @@ typedef struct {
     MATRIX matrix;
 } MatrixObject;
 
+PyObject* f_Matrix2(MATRIX* m)
+{
+    PyObject*self = (PyObject*)PyObject_New(MatrixObject, &MatrixClass);
+    MatrixObject*matrix = (MatrixObject*)self;
+    matrix->matrix = *m;
+    return self;
+}
+
 PyObject* f_Matrix(PyObject* _self, PyObject* args, PyObject* kwargs)
 {
     PyObject*self = (PyObject*)PyObject_New(MatrixObject, &MatrixClass);
@@ -286,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)
@@ -612,6 +631,8 @@ PyMethodDef* primitive_getMethods()
     CXFormClass.ob_type = &PyType_Type;
     BBoxClass.ob_type = &PyType_Type;
     MatrixClass.ob_type = &PyType_Type;
+    FillStyleClass.ob_type = &PyType_Type;
+    LineStyleClass.ob_type = &PyType_Type;
     return primitive_methods;
 }