def finish(self, path): """jeigu buvo dashingas, tai reikia ideti paskutine atkarpa ir pasaiciuoti galutini ilgi""" #path = list(self.ctx.copy_path_flat()) if self._dash_index: # paskutine dash atkarpa... segment_length = geometry.cairo_path_length(path, self._previous_path_index) self._path_length += segment_length self._special_points.append((len(path), segment_length, 0)) # 1-dash, 2-corner, 0-end
def check_special_point(self, index): """ man reikia atkarpu ilgio... ir tasko tipo, o ne indexu: jeigu taskas yra special point tai issisaugome jo index'a islygintame (flat) path'e""" if index in self._dash_index: path = list(self.ctx.copy_path_flat()) segment_length = geometry.cairo_path_length(path, self._previous_path_index) self._path_length += segment_length dash_type = self._dash_index[index] path_index = len(path) self._special_points.append((path_index, segment_length, dash_type)) self._previous_path_index = path_index #len(path)
def get_path_length(self, path=None): if self._path_length == 0 and path != None: # pirma karta bus 0 - jeigu nebuvo dash/corner tasku #print "!!!path:", path self._path_length = geometry.cairo_path_length(path) return self._path_length