def get_bounding_box(self, adjusted=False): """ Returns the bounding box, or corner points of the graphic as a list in the format [minx,maxx,miny,maxy]. If adjusted is true, the bounding box is adjusted to not include the weedline padding. """ had_weedline = self.get_weedline_status() if adjusted: self.set_weedline(False) # removes weedline if it is enabled path = cubicsuperpath.parsePath(simplepath.formatPath(self._data)) self.set_weedline(had_weedline) # adds weedline back if it was enabled return list(simpletransform.roughBBox(path))
def get_bounding_box(self,adjusted=False): """ Returns the bounding box, or corner points of the graphic as a list in the format [minx,maxx,miny,maxy]. If adjusted is true, the bounding box is adjusted to not include the weedline padding. """ had_weedline = self.get_weedline_status() if adjusted: self.set_weedline(False) # removes weedline if it is enabled path = cubicsuperpath.parsePath(simplepath.formatPath(self._data)) self.set_weedline(had_weedline) # adds weedline back if it was enabled return list(simpletransform.roughBBox(path))
def curveto(p0, curve, flat=smoothness): poly = [] d = simplepath.formatPath([['M', p0], curve]) p = cubicsuperpath.parsePath(d) cspsubdiv.cspsubdiv(p, flat) for sp in p: first = True for csp in sp: if first: first = False else: for subpath in csp: poly.append(['L', list(subpath)]) return poly
def curveto(p0,curve,flat=smoothness): poly = [] d = simplepath.formatPath([['M',p0],curve]) p = cubicsuperpath.parsePath(d) cspsubdiv.cspsubdiv(p, flat) for sp in p: first = True for csp in sp: if first: first = False else: for subpath in csp: poly.append(['L',list(subpath)]) return poly
def _update_bounding_box(self): path = cubicsuperpath.parsePath(simplepath.formatPath(self._data)) bbox = list(simpletransform.roughBBox(path)) self._properties['bounding_box'] = bbox