+//----------------------------------------------------------------------------
+
+typedef struct {
+ PyObject_HEAD
+ FILLSTYLE fs;
+} FillStyleObject;
+
+PyObject* f_FillStyle2(FILLSTYLE fs)
+{
+ FillStyleObject* self = PyObject_New(FillStyleObject, &FillStyleClass);
+ self->fs = fs;
+ return (PyObject*)self;
+}
+PyObject* f_SolidFillStyle2(RGBA color)
+{
+ FillStyleObject* self = PyObject_New(FillStyleObject, &FillStyleClass);
+ self->fs.type = FILL_SOLID;
+ self->fs.color = color;
+ return (PyObject*)self;
+}
+PyObject* f_SolidFillStyle(PyObject* _self, PyObject* args, PyObject* kwargs)
+{
+ static char *kwlist[] = {"color", NULL};
+ PyObject*color;
+ if(!kwargs) {
+ if (!PyArg_ParseTuple(args, "O!", &ColorClass, &color))
+ return NULL;
+ }
+ return f_SolidFillStyle2(color_getRGBA(color));
+}
+FILLSTYLE fillstyle_getFillStyle(PyObject*_self)
+{
+ FillStyleObject* self = (FillStyleObject*)_self;
+ return self->fs;
+}
+static void fillstyle_dealloc(PyObject* self)
+{
+ mylog("-%08x(%d) linestyle_dealloc", self, self->ob_refcnt);
+ PyObject_Del(self);
+}
+static int fillstyle_print(PyObject * _self, FILE *fi, int flags) //flags&Py_PRINT_RAW
+{
+ FillStyleObject* self = (FillStyleObject*)_self;
+ if(self->fs.type == FILL_SOLID)
+ fprintf(fi, "fill-solid(%02x%02x%02x%02x)", self->fs.color.r, self->fs.color.g, self->fs.color.b, self->fs.color.a);
+ else
+ fprintf(fi, "fill-%02x", self->fs.type);
+ return 0;
+}
+PyObject* fillstyle_issolid(PyObject*_self, PyObject*args)
+{
+ FillStyleObject* self = (FillStyleObject*)_self;
+ int b = self->fs.type == FILL_SOLID;
+ return PyInt_FromLong(b);
+}
+static PyMethodDef FillStyleMethods[] =
+{
+ /* Module functions */
+ {"isSolid", fillstyle_issolid, METH_VARARGS, "Queries whether this is a solid fill"},
+ {0,0,0,0}
+};
+static PyObject* fillstyle_getattr(PyObject * _self, char* a)
+{
+ FillStyleObject* self = (FillStyleObject*)_self;
+ if(!strcmp(a, "color")) {
+ return f_Color2(self->fs.color.r, self->fs.color.g, self->fs.color.b, self->fs.color.a);
+ }
+ return Py_FindMethod(FillStyleMethods, _self, a);
+}
+static int fillstyle_setattr(PyObject * _self, char* a, PyObject* o)
+{
+ FillStyleObject*self = (FillStyleObject*)_self;
+ if(!strcmp(a, "color")) {
+ self->fs.color = color_getRGBA(o);
+ return 0;
+ }
+ return -1;
+}
+
+PyTypeObject FillStyleClass =