static PyObject * vs_scale(PyGimpVectorsStroke *self, PyObject *args, PyObject *kwargs) { double scale_x, scale_y; static char *kwlist[] = { "scale_x", "scale_y", NULL }; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "dd:scale", kwlist, &scale_x, &scale_y)) return NULL; gimp_vectors_stroke_scale(self->vectors_ID, self->stroke, scale_x, scale_y); Py_INCREF(Py_None); return Py_None; }
static void do_points (spline_list_array_type in_splines, gint32 image_ID) { gint32 vectors; gint32 stroke; gint i, j; gboolean have_points = FALSE; spline_list_type spline_list; /* check if there really is something to do... */ for (i = 0; i < SPLINE_LIST_ARRAY_LENGTH (in_splines); i++) { spline_list = SPLINE_LIST_ARRAY_ELT (in_splines, i); /* Ignore single points that are on their own */ if (SPLINE_LIST_LENGTH (spline_list) < 2) continue; have_points = TRUE; break; } if (!have_points) return; vectors = gimp_vectors_new (image_ID, _("Selection")); for (j = 0; j < SPLINE_LIST_ARRAY_LENGTH (in_splines); j++) { spline_type seg; spline_list = SPLINE_LIST_ARRAY_ELT (in_splines, j); /* Ignore single points that are on their own */ if (SPLINE_LIST_LENGTH (spline_list) < 2) continue; seg = SPLINE_LIST_ELT (spline_list, 0); stroke = gimp_vectors_bezier_stroke_new_moveto (vectors, START_POINT (seg).x, START_POINT (seg).y); for (i = 0; i < SPLINE_LIST_LENGTH (spline_list); i++) { seg = SPLINE_LIST_ELT (spline_list, i); if (SPLINE_DEGREE (seg) == LINEAR) gimp_vectors_bezier_stroke_lineto (vectors, stroke, END_POINT (seg).x, END_POINT (seg).y); else if (SPLINE_DEGREE (seg) == CUBIC) gimp_vectors_bezier_stroke_cubicto (vectors, stroke, CONTROL1 (seg).x, CONTROL1 (seg).y, CONTROL2 (seg).x, CONTROL2 (seg).y, END_POINT (seg).x, END_POINT (seg).y); else g_warning ("print_spline: strange degree (%d)", SPLINE_DEGREE (seg)); } gimp_vectors_stroke_close (vectors, stroke); /* transform to GIMPs coordinate system, taking the selections * bounding box into account */ gimp_vectors_stroke_scale (vectors, stroke, 1.0, -1.0); gimp_vectors_stroke_translate (vectors, stroke, sel_x1, sel_y1 + sel_height + 1); } gimp_image_insert_vectors (image_ID, vectors, -1, -1); }