static PyObject *Py_point_in_path(PyObject *self, PyObject *args, PyObject *kwds) { double x, y, r; py::PathIterator path; agg::trans_affine trans; bool result; if (!PyArg_ParseTuple(args, "dddO&O&:point_in_path", &x, &y, &r, &convert_path, &path, &convert_trans_affine, &trans)) { return NULL; } CALL_CPP("point_in_path", (result = point_in_path(x, y, r, path, trans))); if (result) { Py_RETURN_TRUE; } else { Py_RETURN_FALSE; } }
/* Common part of insideness testing for gstate paths and userpaths. Path to check inside is passed in as inpath, nargs gives number of operands on stack before call. */ static Bool inpath_common( int32 filltype, PATHLIST *inpath, int32 nargs ) { OBJECT *arg ; int32 type ; Bool result ; Bool inside ; if ( theStackSize(operandstack) < nargs ) return error_handler(STACKUNDERFLOW) ; arg = stackindex(nargs++, &operandstack) ; type = oType(*arg) ; if ( type == OARRAY || type == OPACKEDARRAY ) { /* aperture intersection */ PATHINFO appath ; if ( ! upath_to_path(arg, UPARSE_CLOSE, &appath) ) return FALSE ; result = path_in_path(thePath(appath), inpath, filltype, &inside) ; path_free_list(thePath(appath), mm_pool_temp) ; } else { /* point in path */ SYSTEMVALUE px, py, tx, ty ; if ( ! object_get_numeric(arg, &py) ) return FALSE ; if ( theStackSize(operandstack) < nargs ) return error_handler(STACKUNDERFLOW) ; arg = stackindex(nargs++, &operandstack) ; if ( ! object_get_numeric(arg, &px) ) return FALSE ; MATRIX_TRANSFORM_XY( px, py, tx, ty, & thegsPageCTM(*gstateptr)) ; result = point_in_path(tx, ty, inpath, filltype, &inside) ; } if ( result ) { /* remove consumed operands */ npop(nargs, &operandstack) ; result = push((inside ? &tnewobj : &fnewobj), &operandstack) ; } return result ; }