-static PyObject* f_DefineText(PyObject* self, PyObject* args, PyObject* kwargs)
-{
- static char *kwlist[] = {"font", "text", "size", "color", NULL};
- TagObject*tag = 0;
- char*text = 0;
- int textlen = 0;
- PyObject*unicode16;
- PyObject*unicode8;
- int size = 0;
- RGBA rgba = {255,0,0,0};
- PyObject*color = 0;
- PyObject*font = 0;
- SRECT r;
-
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!u#i|O!", kwlist, &TagClass, &font, &text, &textlen, &size, &ColorClass, &color))
- return NULL;
-
- unicode16 = PyUnicode_DecodeUTF16(text, textlen*2, NULL, NULL);
- unicode8 = PyUnicode_AsUTF8String(unicode16);
- text = PyString_AS_STRING(unicode8);
-
- if(color)
- rgba = color_getRGBA(color);
-
- mylog("DefineText: text = %s", text);
-
- tag = (TagObject*)tag_new();
-
- int font_id = tagmap_add(tag->tagmap, font); // add dependency on font
-
- fonttag_getSWFFONT(font)->id = font_id;
-
- tag ->tag= swf_InsertTag(0, ST_DEFINETEXT2);
- swf_SetU16(tag->tag, /*ID*/0);
- r = swf_SetDefineText(tag->tag, fonttag_getSWFFONT(font), &rgba, text, size);
- mylog("+%08x(%d) DefineText tag=%08x \n", (int)tag, tag->ob_refcnt);
-
- //Py_DECREF(unicode16);
- //Py_DECREF(unicode8);
- //free(text);
-
- return (PyObject*)tag;
-}
-//----------------------------------------------------------------------------
-static PyObject* f_PlaceObject(PyObject* self, PyObject* args, PyObject* kwargs)
-{
- static char *kwlist[] = {"character", "depth", "matrix", "colortransform", "ratio", "name", "clipdepth", "action", NULL};
- TagObject*tag;
-
- TagObject*character = 0;
- int depth;
- int clipdepth = 0;
- PyObject*matrix = 0;
- PyObject*cxform = 0;
- PyObject*action = 0;
- int ratio = 0;
- char* name = 0;
- SWFPLACEOBJECT* po;
- po = malloc(sizeof(SWFPLACEOBJECT));
- memset(po, 0, sizeof(SWFPLACEOBJECT));
-
- swf_GetPlaceObject(0, po);
-
- if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O!i|O!O!isiO!", kwlist,
- &TagClass, &character,
- &depth,
- &MatrixClass, &matrix,
- &CXFormClass, &cxform,
- &ratio,
- &name,
- &clipdepth,
- &ActionClass, &action
- ))
- return NULL;
- po->depth = depth;
- po->id = /*ID*/ 0;
- po->clipdepth = clipdepth;
- po->ratio = ratio;
- po->name = name;
- if(clipdepth) po->clipdepth = clipdepth;
- if(matrix) po->matrix = matrix_getMatrix(matrix);
- if(cxform) po->cxform = colortransform_getCXForm(cxform);
- if(action) po->actions = action_getAction(action);
-
- tag = (TagObject*)tag_new();
- tag->placeobject = po;
- Py_INCREF(character);
- tag->character = (PyObject*)character;
- tag->tag= swf_InsertTag(0, ST_PLACEOBJECT2);
-
- po->id = tagmap_add(tag->tagmap,(PyObject*)character);
-
- swf_SetPlaceObject(tag->tag, po);
- mylog("+%08x(%d) PlaceObject %08x(%d)\n", (int)tag, tag->ob_refcnt, character, character->ob_refcnt);
-
- return (PyObject*)tag;
-}
-