• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python simplepath.parsePath函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中simplepath.parsePath函数的典型用法代码示例。如果您正苦于以下问题:Python parsePath函数的具体用法?Python parsePath怎么用?Python parsePath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了parsePath函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: effect

  def effect(self):
    clippingLineSegments = None
    pathTag = inkex.addNS('path','svg')
    groupTag = inkex.addNS('g','svg')
    error_messages = []
    for id in self.options.ids:  # the selection, top-down
      node = self.selected[id]
      if node.tag == pathTag:
        if clippingLineSegments is None: # first path is the clipper
          (clippingLineSegments, errors) = self.simplepathToLineSegments(simplepath.parsePath(node.get('d')))
          error_messages.extend(['{}: {}'.format(id, err) for err in errors])
        else:
          # do all the work!
          segmentsToClip, errors = self.simplepathToLineSegments(simplepath.parsePath(node.get('d')))
          error_messages.extend(['{}: {}'.format(id, err) for err in errors])
          clippedSegments = self.clipLineSegments(segmentsToClip, clippingLineSegments)
          if len(clippedSegments) != 0:
            # replace the path
            node.set('d', simplepath.formatPath(self.linesgmentsToSimplePath(clippedSegments)))
          else:
            # don't put back an empty path(?)  could perhaps put move, move?
            inkex.debug('Object {} clipped to nothing, will not be updated.'.format(node.get('id')))
      elif node.tag == groupTag:  # we don't look inside groups for paths
        inkex.debug('Group object {} will be ignored. Please ungroup before running the script.'.format(id))
      else: # something else
        inkex.debug('Object {} is not of type path ({}), and will be ignored. Current type "{}".'.format(id, pathTag, node.tag))

    for error in error_messages:
        inkex.debug(error)
开发者ID:funnypolynomial,项目名称:DestructiveClip,代码行数:29,代码来源:destructiveclip.py


示例2: movePath

    def movePath(self, node, x, y, origin):
        tagName = self.getTagName(node)

        if tagName != "path":
            inkex.debug('movePath only works on SVG Path elements. Argument was of type "' + tagName + '"')
            return False

        path = simplepath.parsePath(node.get("d"))
        id = node.get("id")

        box = list(simpletransform.computeBBox([node]))

        offset_x = box[0] - x
        offset_y = box[2] - (y)

        for cmd in path:
            params = cmd[1]
            i = 0

            while i < len(params):
                if i % 2 == 0:
                    # inkex.debug('x point at ' + str( round( params[i] )))
                    params[i] = params[i] - offset_x
                    # inkex.debug('moved to ' + str( round( params[i] )))
                else:
                    # inkex.debug('y point at ' + str( round( params[i]) ))
                    params[i] = params[i] - offset_y
                    # inkex.debug('moved to ' + str( round( params[i] )))
                i = i + 1

        return simplepath.formatPath(path)
开发者ID:brentini,项目名称:ExtractElements,代码行数:31,代码来源:larscwallin.inx.extractelements.py


示例3: effect

    def effect(self):
        for id, node in self.selected.iteritems():
            if node.tag == inkex.addNS('path','svg'):
                p = simplepath.parsePath(node.get('d'))
                a =[]
                pen = None
                subPathStart = None
                for cmd,params in p:
                    if cmd == 'C':
                        a.extend([['M', params[:2]], ['L', pen],
                            ['M', params[2:4]], ['L', params[-2:]]])
                    if cmd == 'Q':
                        a.extend([['M', params[:2]], ['L', pen],
                            ['M', params[:2]], ['L', params[-2:]]])
                    
                    if cmd == 'M':
                        subPathStart = params

                    if cmd == 'Z':
                        pen = subPathStart
                    else:
                        pen = params[-2:]
                    
                if len(a) > 0:
                    s = {'stroke-linejoin': 'miter', 'stroke-width': '1.0px', 
                        'stroke-opacity': '1.0', 'fill-opacity': '1.0', 
                        'stroke': '#000000', 'stroke-linecap': 'butt', 
                        'fill': 'none'}
                    attribs = {'style':simplestyle.formatStyle(s),'d':simplepath.formatPath(a)}
                    inkex.etree.SubElement(node.getparent(), inkex.addNS('path','svg'), attribs)
开发者ID:AakashDabas,项目名称:inkscape,代码行数:30,代码来源:handles.py


示例4: load

  def load(self, node, mat):
    #JiB
    #split the syle in separate tuples and assign to path
    s = node.get('style')
    if s: 
      self.style = s
      for item in s.split(';'):
        attribute , value = item.split(':')
        #print attribute, value
        value = value.replace('px', '')
        setattr(self, attribute.replace('-','') , value)
        #print getattr(self, attribute.replace('-','') )
      #print ";" + self.strokewidth
        #print attribute.replace('-','')
    d = node.get('d')
    if len(simplepath.parsePath(d)) == 0:
      return
    p = cubicsuperpath.parsePath(d)
    applyTransformToPath(mat, p)

    # p is now a list of lists of cubic beziers [ctrl p1, ctrl p2, endpoint]
    # where the start-point is the last point in the previous segment
    self.segments = []
    for sp in p:
      points = []
      subdivideCubicPath(sp,0.2)  # TODO: smoothness preference
      for csp in sp:
        points.append((csp[1][0],csp[1][1]))
      self.segments.append(points)
开发者ID:JelleB,项目名称:inkscape-unicorn,代码行数:29,代码来源:svg_parser.py


示例5: convert_element_to_path

def convert_element_to_path(node):
    """Convert an SVG element into a simplepath.
    
    This handles paths, rectangles, circles, ellipses, lines, and polylines.
    Anything else raises and exception.
    """    
    node_tag = get_node_tag(node) # node tag stripped of namespace part
        
    if node_tag == 'path':
        return simplepath.parsePath(node.get('d'))
    elif node_tag == 'rect':
        return convert_rect_to_path(node)
    elif node_tag == 'line':
        return convert_line_to_path(node)
    elif node_tag == 'circle':
        return convert_circle_to_path(node)
    elif node_tag == 'ellipse':
        return convert_ellipse_to_path(node)    
    elif node_tag == 'polyline':
        return convert_polyline_to_path(node)    
    elif node_tag == 'polygon':
        return convert_polygon_to_path(node)
    elif node_tag == 'text':
        raise Exception(_('Unable to convert text; please convert text to paths first.'))
    elif node_tag == 'image':
        raise Exception(_('Unable to convert bitmap images; please convert them to line art first.'))
    else:
        raise Exception(_('Unable to convert this SVG element to a path: <%s>') % (node.tag))
开发者ID:fabien,项目名称:tcnc,代码行数:28,代码来源:supereffect.py


示例6: plotPath

   def plotPath(self, node, matTransform):
      """ Plot the path while applying the transformation defined by the matrix matTransform. """

      filledPath = (simplestyle.parseStyle(node.get("style")).get("fill", "none") != "none")

      # Plan: Turn this path into a cubicsuperpath (list of beziers)...
      d = node.get("d")
      if len(simplepath.parsePath(d)) == 0:
         return
      p = cubicsuperpath.parsePath(d)

      # ... and apply the transformation to each point.
      simpletransform.applyTransformToPath(matTransform, p)

      # p is now a list of lists of cubic beziers [cp1, cp2, endp]
      # where the start-point is the last point of the previous segment.
      # For some reason the inkscape extensions uses csp[1] as the coordinates of each point,
      # but that makes it seem like they are using control point 2 as line points.
      # Maybe that is a side-effect of the CSP subdivion process? TODO
      realPoints = []
      for sp in p:
         cspsubdiv.subdiv(sp, self.smoothness)
         for csp in sp:
            realPoints.append( (csp[1][0], csp[1][1]) )

      self.rawObjects.append( (filledPath, realPoints) )
开发者ID:wayneandlayne,项目名称:svg2kicadmod,代码行数:26,代码来源:SvgParser.py


示例7: addDot

    def addDot(self, node):
        self.group = inkex.etree.SubElement(node.getparent(), inkex.addNS("g", "svg"))
        self.dotGroup = inkex.etree.SubElement(self.group, inkex.addNS("g", "svg"))
        self.numGroup = inkex.etree.SubElement(self.group, inkex.addNS("g", "svg"))

        try:
            t = node.get("transform")
            self.group.set("transform", t)
        except:
            pass

        style = simplestyle.formatStyle({"stroke": "none", "fill": "#000"})
        a = []
        p = simplepath.parsePath(node.get("d"))

        self.separateLastAndFirst(p)

        num = self.options.start
        for cmd, params in p:
            if cmd != "Z" and cmd != "z":
                dot_att = {
                    "style": style,
                    "r": str(inkex.unittouu(self.options.dotsize) / 2),
                    "cx": str(params[-2]),
                    "cy": str(params[-1]),
                }
                inkex.etree.SubElement(self.dotGroup, inkex.addNS("circle", "svg"), dot_att)
                self.addText(
                    self.numGroup,
                    params[-2] + (inkex.unittouu(self.options.dotsize) / 2),
                    params[-1] - (inkex.unittouu(self.options.dotsize) / 2),
                    num,
                )
                num += self.options.step
        node.getparent().remove(node)
开发者ID:vabz7867,项目名称:inkscape,代码行数:35,代码来源:dots.py


示例8: effect

 def effect(self):
     for id, node in self.selected.iteritems():
         if node.tag == inkex.addNS('path', 'svg'):
             d = node.get('d')
             p = simplepath.parsePath(d)
             last = []
             subPathStart = []
             for cmd,params in p:
                 if cmd == 'C':
                     if self.options.behave <= 1:
                         #shorten handles towards end points
                         params[:2] = pointAtPercent(params[:2],last[:],self.options.percent)    
                         params[2:4] = pointAtPercent(params[2:4],params[-2:],self.options.percent)
                     else:
                         #shorten handles towards thirds of the segment                            
                         dest1 = pointAtPercent(last[:],params[-2:],33.3)
                         dest2 = pointAtPercent(params[-2:],last[:],33.3)
                         params[:2] = pointAtPercent(params[:2],dest1[:],self.options.percent)    
                         params[2:4] = pointAtPercent(params[2:4],dest2[:],self.options.percent)
                 elif cmd == 'Q':
                     dest = pointAtPercent(last[:],params[-2:],50)
                     params[:2] = pointAtPercent(params[:2],dest,self.options.percent)
                 if cmd == 'M':
                     subPathStart = params[-2:]
                 if cmd == 'Z':
                     last = subPathStart[:]
                 else:
                     last = params[-2:]
             node.set('d',simplepath.formatPath(p))
开发者ID:AakashDabas,项目名称:inkscape,代码行数:29,代码来源:straightseg.py


示例9: effect

    def effect(self):
        for id, node in self.selected.iteritems():
            if node.tag == inkex.addNS('path','svg'):
                self.group = inkex.etree.SubElement(node.getparent(),inkex.addNS('g','svg'))
                new = inkex.etree.SubElement(self.group,inkex.addNS('path','svg'))
                
                try:
                    t = node.get('transform')
                    self.group.set('transform', t)
                except:
                    pass

                s = simplestyle.parseStyle(node.get('style'))
                s['stroke-linecap']='round'
                s['stroke-width']=self.options.dotsize
                new.set('style', simplestyle.formatStyle(s))

                a =[]
                p = simplepath.parsePath(node.get('d'))
                num = 1
                for cmd,params in p:
                    if cmd != 'Z':
                        a.append(['M',params[-2:]])
                        a.append(['L',params[-2:]])
                        self.addText(self.group,params[-2],params[-1],num)
                        num += 1
                new.set('d', simplepath.formatPath(a))
                node.clear()
开发者ID:step21,项目名称:inkscape-osx-packaging-native,代码行数:28,代码来源:dots.py


示例10: path_bounding_box

    def path_bounding_box(self, elem, parent_transform=None):
        """ Returns [min_x, min_y], [max_x, max_y] of the transformed
            element. (It doesn't make any sense to return the untransformed
            bounding box, with the intent of transforming it later, because
            the min/max points will be completely different points)
            
            The returned bounding box includes stroke-width offset.
            
            This function uses a simplistic algorithm & doesn't take curves
            or arcs into account, just node positions.
        """
        # If we have a Live Path Effect, modify original-d. If anyone clamours
        # for it, we could make an option to ignore paths with Live Path Effects
        original_d = "{%s}original-d" % inkex.NSS["inkscape"]
        path = simplepath.parsePath(elem.attrib.get(original_d, elem.attrib["d"]))

        transform = self.transform(elem, parent_transform=parent_transform)
        offset = self.elem_offset(elem, parent_transform)

        min_x = min_y = max_x = max_y = 0
        for i in range(len(path)):
            x, y = self.pathxy(path, i)
            x, y = transform_point(transform, (x, y))

            if i == 0:
                min_x = max_x = x
                min_y = max_y = y
            else:
                min_x = min(x, min_x)
                min_y = min(y, min_y)
                max_x = max(x, max_x)
                max_y = max(y, max_y)

        return (min_x - offset, min_y - offset), (max_x + offset, max_y + offset)
开发者ID:Grandrogue,项目名称:inkscape_metal,代码行数:34,代码来源:pixelsnap.py


示例11: parseArc

    def parseArc(self,node,parent):

        #self.parsing_context = 'arc'

        style = node.get('style')
        style = self.parseStyleAttribute(style)

        arc = {
            'id':node.get('id',''),
            'svg':'arc',
            'label':str(node.get(inkex.addNS('label', 'inkscape'),'')),
            'cx': node.get(inkex.addNS('cx', 'sodipodi'),''),
            'cy':node.get(inkex.addNS('cy', 'sodipodi'),''),
            'rx':node.get(inkex.addNS('rx', 'sodipodi'),''),
            'ry':node.get(inkex.addNS('ry', 'sodipodi'),''),
            'path':simplepath.parsePath(node.get('d')),
            'd':node.get('d',''),
            'box':list(simpletransform.computeBBox([node])),
            'fill':style.get('fill',''),
            'fill-opacity':style.get('fillOpacity',''),
            'stroke':style.get('stroke',''),
            'stroke-width':style.get('strokeWidth',''),
            'stroke-opacity':style.get('strokeOpacity',''),
            'transform':node.get('transform','')
        }


        if(self.reposition):
            arc['path'] = self.movePath(node,0,0,'tl')
        else:
            arc['path'] = arc['d']

        parent.append(arc)
开发者ID:larscwallin,项目名称:bansai,代码行数:33,代码来源:larscwallin.inx.bansai.py


示例12: convertToSegments

    def convertToSegments(cls, path_node):
        path_start = None
        currentPoint = None

        # work on copy to be shure not breaking anything
        path = copy.deepcopy(path_node)

        # apply transformation info on path, otherwise dealing with transform would be a mess
        simpletransform.fuseTransform(path)

        for cmd, params in simplepath.parsePath(path.get('d')):
            print_('cmd, params', cmd, params)
            if cmd == 'M':
                if(path_start is None):
                    path_start = params
                currentPoint = params

            elif cmd == 'L':
                yield Segment(currentPoint, params)
                currentPoint = params

            elif cmd in ['A', 'Q', 'C']:
                yield Segment(currentPoint, params[-2:], command=cmd, extra_parameters=params[:-2])
                currentPoint = params[-2:]

            elif (cmd == 'Z'):
                # Z is a line between the last point and the start of the shape
                yield Segment(currentPoint, path_start)
                currentPoint = None
                path_start = None

            else:
                inkex.errormsg("Path Command %s not managed Yet" % cmd)
开发者ID:bumblebeefr,项目名称:fablab-inkscape-plugins,代码行数:33,代码来源:fablab_path_lib.py


示例13: effect

    def effect(self):
        for id, node in self.selected.iteritems():
            if node.tagName == 'path':
                p = simplepath.parsePath(node.attributes.getNamedItem('d').value)
                a =[]
                pen = None
                subPathStart = None
                for cmd,params in p:
                    if cmd == 'C':
                        a.extend([['M', params[:2]], ['L', pen],
                            ['M', params[2:4]], ['L', params[-2:]]])
                    if cmd == 'Q':
                        a.extend([['M', params[:2]], ['L', pen],
                            ['M', params[:2]], ['L', params[-2:]]])
                    
                    if cmd == 'M':
                        subPathStart = params

                    if cmd == 'Z':
                        pen = subPathStart
                    else:
                        pen = params[-2:]
                    
                if len(a) > 0:
                    new = self.document.createElement('svg:path')
                    s = {'stroke-linejoin': 'miter', 'stroke-width': '1.0px', 
                        'stroke-opacity': '1.0', 'fill-opacity': '1.0', 
                        'stroke': '#000000', 'stroke-linecap': 'butt', 
                        'fill': 'none'}
                    new.setAttribute('style', simplestyle.formatStyle(s))
                    new.setAttribute('d', simplepath.formatPath(a))
                    node.parentNode.appendChild(new)
开发者ID:NirBenTalLab,项目名称:find_motif,代码行数:32,代码来源:handles.py


示例14: snap_path_scale

    def snap_path_scale(self, elem, parent_transform=None):
        # If we have a Live Path Effect, modify original-d. If anyone clamours
        # for it, we could make an option to ignore paths with Live Path Effects
        original_d = "{%s}original-d" % inkex.NSS["inkscape"]
        path = simplepath.parsePath(elem.attrib.get(original_d, elem.attrib["d"]))
        transform = self.transform(elem, parent_transform=parent_transform)
        min_xy, max_xy = self.path_bounding_box(elem, parent_transform)

        width = max_xy[0] - min_xy[0]
        height = max_xy[1] - min_xy[1]

        # In case somebody tries to snap a 0-high element,
        # or a curve/arc with all nodes in a line, and of course
        # because we should always check for divide-by-zero!
        if width == 0 or height == 0:
            return

        rescale = round(width) / width, round(height) / height

        min_xy = transform_point(transform, min_xy, inverse=True)
        max_xy = transform_point(transform, max_xy, inverse=True)

        for i in range(len(path)):
            self.transform_path_node([[1, 0, -min_xy[0]], [0, 1, -min_xy[1]]], path, i)  # center transform
            self.transform_path_node([[rescale[0], 0, 0], [0, rescale[1], 0]], path, i)
            self.transform_path_node([[1, 0, +min_xy[0]], [0, 1, +min_xy[1]]], path, i)  # uncenter transform

        path = simplepath.formatPath(path)
        if original_d in elem.attrib:
            elem.attrib[original_d] = path
        else:
            elem.attrib["d"] = path
开发者ID:Grandrogue,项目名称:inkscape_metal,代码行数:32,代码来源:pixelsnap.py


示例15: snap_path_scale

    def snap_path_scale(self, elem, parent_transform=None):
        # If we have a Live Path Effect, modify original-d. If anyone clamours
        # for it, we could make an option to ignore paths with Live Path Effects
        original_d = '{%s}original-d' % inkex.NSS['inkscape']
        path = simplepath.parsePath(elem.attrib.get(original_d, elem.attrib['d']))
        transform = self.transform(elem, parent_transform=parent_transform)
        min_xy, max_xy = self.path_bounding_box(elem, parent_transform)
        
        width = max_xy[0] - min_xy[0]
        height = max_xy[1] - min_xy[1]
        rescale = round(width)/width, round(height)/height

        min_xy = transform_point(transform, min_xy, inverse=True)
        max_xy = transform_point(transform, max_xy, inverse=True)

        for i in range(len(path)):
            self.transform_path_node([[1, 0, -min_xy[0]], [0, 1, -min_xy[1]]], path, i)     # center transform
            self.transform_path_node([[rescale[0], 0, 0],
                                       [0, rescale[1], 0]],
                                       path, i)
            self.transform_path_node([[1, 0, +min_xy[0]], [0, 1, +min_xy[1]]], path, i)     # uncenter transform
        
        path = simplepath.formatPath(path)
        if original_d in elem.attrib: elem.attrib[original_d] = path
        else: elem.attrib['d'] = path
开发者ID:gaffel85,项目名称:notification-agenda,代码行数:25,代码来源:pixelsnap.py


示例16: plotPath

	def plotPath( self, path, matTransform ):
		'''
		Plot the path while applying the transformation defined
		by the matrix [matTransform].
		'''
		# turn this path into a cubicsuperpath (list of beziers)...

		d = path.get( 'd' )

		if len( simplepath.parsePath( d ) ) == 0:
			return

		p = cubicsuperpath.parsePath( d )

		# ...and apply the transformation to each point
		applyTransformToPath( matTransform, p )

		# p is now a list of lists of cubic beziers [control pt1, control pt2, endpoint]
		# where the start-point is the last point in the previous segment.
		for sp in p:

			plot_utils.subdivideCubicPath( sp, self.options.smoothness )
			nIndex = 0

			for csp in sp:

				if self.bStopped:
					return

				self.fX = 2 * float( csp[1][0] ) / self.step_scaling_factor
				self.fY = 2 * float( csp[1][1] ) / self.step_scaling_factor

				# store home
				if self.ptFirst is None:

					# if we should start at center, then the first line segment should draw from there
					if self.options.startCentered:
						self.fPrevX = self.svgWidth / ( self.step_scaling_factor )
						self.fPrevY = self.svgHeight / ( self.step_scaling_factor )

						self.ptFirst = ( self.fPrevX, self.fPrevY )
					else:
						self.ptFirst = ( self.fX, self.fY )
						
				if self.plotCurrentLayer:
					if nIndex == 0:
						if (plot_utils.distance(self.fX - self.fPrevX,self.fY - self.fPrevY) > eggbot_conf.MIN_GAP):
							# Only raise pen between two points if there is at least a 1 step gap between them.
							self.penUp()
							self.virtualPenIsUp = True
					elif nIndex == 1:
						self.penDown()
						self.virtualPenIsUp = False

				nIndex += 1

				if self.plotCurrentLayer:
					self.plotLineAndTime()
					self.fPrevX = self.fX
					self.fPrevY = self.fY
开发者ID:JesperKrogPoulsen,项目名称:EggBot,代码行数:60,代码来源:eggbot.py


示例17: effect

    def effect(self):
        for id, node in self.selected.iteritems():
            if node.tagName == 'path':
                self.group = self.document.createElement('svg:g')
                node.parentNode.appendChild(self.group)
                new = self.document.createElement('svg:path')
                
                try:
                    t = node.attributes.getNamedItem('transform').value
                    self.group.setAttribute('transform', t)
                except AttributeError:
                    pass

                s = simplestyle.parseStyle(node.attributes.getNamedItem('style').value)
                s['stroke-linecap']='round'
                s['stroke-width']=self.options.dotsize
                new.setAttribute('style', simplestyle.formatStyle(s))

                a =[]
                p = simplepath.parsePath(node.attributes.getNamedItem('d').value)
                num = 1
                for cmd,params in p:
                    if cmd != 'Z':
                        a.append(['M',params[-2:]])
                        a.append(['L',params[-2:]])
                        self.addText(self.group,params[-2],params[-1],num)
                        num += 1
                new.setAttribute('d', simplepath.formatPath(a))
                self.group.appendChild(new)
                node.parentNode.removeChild(node)
开发者ID:NirBenTalLab,项目名称:find_motif,代码行数:30,代码来源:dots.py


示例18: get_n_points_from_path

def get_n_points_from_path( node, n):#returns a list of first n points (x,y) in an SVG path-representing node

    p = simplepath.parsePath(node.get('d')) #parse the path
    
    xi = [] #temporary storage for x and y (will combine at end)
    yi = []
    
    for cmd,params in p:                    #a parsed path is made up of (cmd, params) pairs
        defs = simplepath.pathdefs[cmd]
        for i in range(defs[1]):
            if   defs[3][i] == 'x' and len(xi) < n:#only collect the first three
                xi.append(params[i])
            elif defs[3][i] == 'y' and len(yi) < n:#only collect the first three
                yi.append(params[i])

    if len(xi) == n and len(yi) == n:
        points = [] # returned pairs of points
        for i in range(n):
            xi[i] = Draw_From_Triangle.unittouu(e, str(xi[i]) + 'px')
            yi[i] = Draw_From_Triangle.unittouu(e, str(yi[i]) + 'px')
            points.append( [ xi[i], yi[i] ] )
    else:
        #inkex.errormsg(_('Error: Not enough nodes to gather coordinates.')) #fail silently and exit, rather than invoke an error console
        return [] #return a blank
        
    return points
开发者ID:Drooids,项目名称:inkscape,代码行数:26,代码来源:draw_from_triangle.py


示例19: _handle_path

 def _handle_path(self, node):
     try:
         raw_path = node.get('d')
         p = simplepath.parsePath(raw_path)
     except:
         logging.warning('Failed to parse path %s, will ignore it', raw_path)
         p = None
     return p, []
开发者ID:Alwnikrotikz,项目名称:inkscape2tikz,代码行数:8,代码来源:tikz_export.py


示例20: point_generator

def point_generator(path):

        if len(simplepath.parsePath(path)) == 0:
                return
       
        simple_path = simplepath.parsePath(path)
        startX,startY = float(simple_path[0][1][0]), float(simple_path[0][1][1])
        yield startX, startY

        p = cubicsuperpath.parsePath(path)
        for sp in p:
                cspsubdiv.subdiv( sp, .2 )
                for csp in sp:
                    ctrl_pt1 = csp[0]
                    ctrl_pt2 = csp[1]
                    end_pt = csp[2]
                    yield end_pt[0], end_pt[1],    
开发者ID:vishpat,项目名称:Practice,代码行数:17,代码来源:shapes.py



注:本文中的simplepath.parsePath函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python simpleplot.plot_lines函数代码示例发布时间:2022-05-27
下一篇:
Python simplepath.formatPath函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap