def assemble(self): # Yes, everything with HEIGHT, so I'm working in a square. # May have the colors backwards. p = partLine(linetype=self.lineType) if self.pieces == 8: # No reason to do this as a special case, but it was working # first, so why mess with it. p.move(0, -blazon.Ordinary.HEIGHT) p.makeline(0, blazon.Ordinary.HEIGHT) p.hline(-blazon.Ordinary.HEIGHT) p.makeline(blazon.Ordinary.HEIGHT, -blazon.Ordinary.HEIGHT) p.closepath() p.move(-blazon.Ordinary.HEIGHT, 0) p.makeline(blazon.Ordinary.HEIGHT, 0) p.vline(blazon.Ordinary.HEIGHT) p.makeline(-blazon.Ordinary.HEIGHT, -blazon.Ordinary.HEIGHT) p.closepath() else: angle = 2 * math.pi / self.pieces pi_2 = math.pi / 2 for i in range(0, self.pieces, 2): p.move(blazon.Ordinary.HEIGHT * math.cos(pi_2 + i * angle), blazon.Ordinary.HEIGHT * math.sin(pi_2 + i * angle)) p.makeline(0, 0) p.makeline( blazon.Ordinary.HEIGHT * math.cos(pi_2 + (i + 1) * angle), blazon.Ordinary.HEIGHT * math.sin(pi_2 + (i + 1) * angle)) p.closepath() self.path = SVGdraw.path(p) self.path.attributes["fill-rule"] = "evenodd"
def assemble(self): # Yes, everything with HEIGHT, so I'm working in a square. # May have the colors backwards. p=partLine(linetype=self.lineType) if self.pieces == 8: # No reason to do this as a special case, but it was working # first, so why mess with it. p.move(0,-blazon.Ordinary.HEIGHT) p.makeline(0,blazon.Ordinary.HEIGHT) p.hline(-blazon.Ordinary.HEIGHT) p.makeline(blazon.Ordinary.HEIGHT,-blazon.Ordinary.HEIGHT) p.closepath() p.move(-blazon.Ordinary.HEIGHT,0) p.makeline(blazon.Ordinary.HEIGHT,0) p.vline(blazon.Ordinary.HEIGHT) p.makeline(-blazon.Ordinary.HEIGHT,-blazon.Ordinary.HEIGHT) p.closepath() else: angle=2*math.pi/self.pieces pi_2=math.pi/2 for i in range(0,self.pieces,2): p.move(blazon.Ordinary.HEIGHT*math.cos(pi_2+i*angle), blazon.Ordinary.HEIGHT*math.sin(pi_2+i*angle)) p.makeline(0,0) p.makeline(blazon.Ordinary.HEIGHT*math.cos(pi_2+(i+1)*angle), blazon.Ordinary.HEIGHT*math.sin(pi_2+(i+1)*angle)) p.closepath() self.path=SVGdraw.path(p) self.path.attributes["fill-rule"]="evenodd"
def assemble(self): p=partLine(linetype=self.lineType) height=float(blazon.Ordinary.HEIGHT)/self.pieces for i in range(0,self.pieces): p.move(-blazon.Ordinary.FESSPTX,-blazon.Ordinary.FESSPTY+i*height) p.makelinerel(blazon.Ordinary.WIDTH,height/2) p.makelinerel(-blazon.Ordinary.WIDTH,height/2) p.closepath() self.path=SVGdraw.path(p)
def assemble(self): p=partLine(linetype=self.lineType) width=float(blazon.Ordinary.WIDTH)/self.pieces for i in range(0,self.pieces): p.move(-blazon.Ordinary.FESSPTX+i*width,-blazon.Ordinary.FESSPTY) p.makelinerel(width/2,blazon.Ordinary.HEIGHT) p.makelinerel(width/2,-blazon.Ordinary.HEIGHT) p.closepath() self.path=SVGdraw.path(p)
def assemble(self): p=partLine(linetype=self.lineType) p.move(-blazon.Ordinary.FESSPTX,35) p.makeline(0,-5,1) p.makeline(blazon.Ordinary.FESSPTX,35,shift=-1) p.relvline(blazon.Ordinary.FESSPTY) p.relhline(-blazon.Ordinary.WIDTH) p.closepath() self.path=SVGdraw.path(p) if self.inverted: self.path.attributes["transform"]="rotate(180)"
def assemble(self): p = partLine(linetype=self.lineType) p.move(-blazon.Ordinary.FESSPTX, 35) p.makeline(0, -5, 1) p.makeline(blazon.Ordinary.FESSPTX, 35, shift=-1) p.relvline(blazon.Ordinary.FESSPTY) p.relhline(-blazon.Ordinary.WIDTH) p.closepath() self.path = SVGdraw.path(p) if self.inverted: self.path.attributes["transform"] = "rotate(180)"
def assemble(self): p=partLine() p.lineType=self.lineType p.move(-blazon.Ordinary.WIDTH-blazon.Ordinary.FESSPTX,-blazon.Ordinary.HEIGHT-blazon.Ordinary.FESSPTY) p.hline(0) p.makeline(0,blazon.Ordinary.HEIGHT) p.hline(blazon.Ordinary.WIDTH) p.vline(0) p.makeline(-blazon.Ordinary.WIDTH,0) p.closepath() self.path=SVGdraw.path(p) self.path.attributes["fill-rule"]="evenodd"
def assemble(self): p=partLine(linetype=self.lineType) breadth=math.sqrt(blazon.Ordinary.HEIGHT**2 + blazon.Ordinary.WIDTH**2) unit=breadth/self.pieces for i in range(0,self.pieces): p.move(-breadth/2+i*unit, -breadth/2) p.makelinerel(unit/2, breadth) p.makelinerel(unit/2, -breadth) p.closepath() self.path=SVGdraw.path(p) self.path.attributes["transform"]=" rotate(45)"
def assemble(self): p = partLine(linetype=self.lineType) breadth = math.sqrt(blazon.Ordinary.HEIGHT**2 + blazon.Ordinary.WIDTH**2) unit = breadth / self.pieces for i in range(0, self.pieces): p.move(-breadth / 2 + i * unit, -breadth / 2) p.makelinerel(unit / 2, breadth) p.makelinerel(unit / 2, -breadth) p.closepath() self.path = SVGdraw.path(p) self.path.attributes["transform"] = " rotate(45)"
def assemble(self): p = partLine() p.lineType = self.lineType p.move(0, blazon.Ordinary.HEIGHT) p.makeline(0, 0, align=1) p.makeline(-blazon.Ordinary.WIDTH, -blazon.Ordinary.WIDTH) p.vline(blazon.Ordinary.HEIGHT) p.closepath() self.path1 = SVGdraw.path(p) p = partLine() p.lineType = self.lineType p.move(0, blazon.Ordinary.HEIGHT) p.makeline(0, 0, align=1, shift=1) p.makeline(blazon.Ordinary.WIDTH, -blazon.Ordinary.WIDTH) p.vline(blazon.Ordinary.HEIGHT) p.closepath() self.path2 = SVGdraw.path(p) if self.inverted: # Have to rearrange the colors too self.colors = (self.colors[2], self.colors[1], self.colors[0]) self.path1.attributes["transform"] = "rotate(180)" self.path2.attributes["transform"] = "rotate(180)"
def assemble(self): p = partLine() p.lineType = self.lineType p.move(-blazon.Ordinary.WIDTH - blazon.Ordinary.FESSPTX, -blazon.Ordinary.HEIGHT - blazon.Ordinary.FESSPTY) p.hline(0) p.makeline(0, blazon.Ordinary.HEIGHT) p.hline(blazon.Ordinary.WIDTH) p.vline(0) p.makeline(-blazon.Ordinary.WIDTH, 0) p.closepath() self.path = SVGdraw.path(p) self.path.attributes["fill-rule"] = "evenodd"
def assemble(self): p=partLine() p.lineType=self.lineType p.move(0,blazon.Ordinary.HEIGHT) p.makeline(0,0,align=1) p.makeline(-blazon.Ordinary.WIDTH, -blazon.Ordinary.WIDTH) p.vline(blazon.Ordinary.HEIGHT) p.closepath() self.path1=SVGdraw.path(p) p=partLine() p.lineType=self.lineType p.move(0,blazon.Ordinary.HEIGHT) p.makeline(0,0,align=1,shift=1) p.makeline(blazon.Ordinary.WIDTH, -blazon.Ordinary.WIDTH) p.vline(blazon.Ordinary.HEIGHT) p.closepath() self.path2=SVGdraw.path(p) if self.inverted: # Have to rearrange the colors too self.colors=(self.colors[2],self.colors[1],self.colors[0]) self.path1.attributes["transform"]="rotate(180)" self.path2.attributes["transform"]="rotate(180)"
def assemble(self): # Can't really do this by rotating Bendy, since the round corner is # on the other side. p=partLine(linetype=self.lineType) fullwidth=math.sqrt(2)*blazon.Ordinary.HEIGHT if self.pieces>3: width=fullwidth*.87/self.pieces # Compensate for round corner. else: width=fullwidth/self.pieces for i in range(1,self.pieces+2,2): p.rect(-fullwidth/2+i*width, -blazon.Ordinary.HEIGHT, width, 2*blazon.Ordinary.HEIGHT) self.path=SVGdraw.path(p) self.path.attributes["transform"]="rotate(45)"
def assemble(self): """For internal use, to simplify assembly of subclasses""" p=partLine(linetype=self.lineType) # Start to support partition lines width=float(blazon.Ordinary.WIDTH)/self.pieces for i in range(1,self.pieces-1,2): p.rect(-blazon.Ordinary.FESSPTX+i*width,-blazon.Ordinary.HEIGHT, width,2*blazon.Ordinary.HEIGHT) if not self.pieces%2: # Make the last one extra-big, so things don't show through # if the line-type isn't plain. p.rect(-blazon.Ordinary.FESSPTX+(self.pieces-1)*width, -blazon.Ordinary.HEIGHT, 2*width,2*blazon.Ordinary.HEIGHT) self.path=SVGdraw.path(p)
def assemble(self): # Can't really do this by rotating Bendy, since the round corner is # on the other side. p = partLine(linetype=self.lineType) fullwidth = math.sqrt(2) * blazon.Ordinary.HEIGHT if self.pieces > 3: width = fullwidth * .87 / self.pieces # Compensate for round corner. else: width = fullwidth / self.pieces for i in range(1, self.pieces + 2, 2): p.rect(-fullwidth / 2 + i * width, -blazon.Ordinary.HEIGHT, width, 2 * blazon.Ordinary.HEIGHT) self.path = SVGdraw.path(p) self.path.attributes["transform"] = "rotate(45)"
def assemble(self): p=partLine(linetype=self.lineType) # OK, let's map things on the *square* HEIGHTxHEIGHT # Because HEIGHT > WIDTH!!! fullwidth=math.sqrt(2)*blazon.Ordinary.HEIGHT # Oh, this is going to be much easier to do orthogonally and rotating. if self.pieces>3: width=fullwidth*.87/self.pieces # Compensate for round corner. else: # Otherwise Per Bend doesn't work. width=fullwidth/self.pieces for i in range(0,self.pieces+2,2): p.rect(fullwidth/2-i*width, -blazon.Ordinary.HEIGHT, width,2*blazon.Ordinary.HEIGHT) self.path=SVGdraw.path(p) self.path.attributes["transform"]="rotate(-45)"
def assemble(self): p = partLine(linetype=self.lineType) # OK, let's map things on the *square* HEIGHTxHEIGHT # Because HEIGHT > WIDTH!!! fullwidth = math.sqrt(2) * blazon.Ordinary.HEIGHT # Oh, this is going to be much easier to do orthogonally and rotating. if self.pieces > 3: width = fullwidth * .87 / self.pieces # Compensate for round corner. else: # Otherwise Per Bend doesn't work. width = fullwidth / self.pieces for i in range(0, self.pieces + 2, 2): p.rect(fullwidth / 2 - i * width, -blazon.Ordinary.HEIGHT, width, 2 * blazon.Ordinary.HEIGHT) self.path = SVGdraw.path(p) self.path.attributes["transform"] = "rotate(-45)"
def assemble(self): p = partLine(linetype=self.lineType) height = float(blazon.Ordinary.HEIGHT) / self.pieces #"Chevronny of n" doesn't make all that much sense anyway. for i in range(0, self.pieces + 2, 2): p.move(-blazon.Ordinary.FESSPTX, blazon.Ordinary.FESSPTY - (i - 2) * height) p.makelinerel(blazon.Ordinary.FESSPTX, -25, align=1) p.makelinerel(blazon.Ordinary.FESSPTX, 25) p.relvline(-height) p.makelinerel(-blazon.Ordinary.FESSPTX, -25, align=1) p.makelinerel(-blazon.Ordinary.FESSPTX, 25) p.closepath() self.path = SVGdraw.path(p) if (self.inverted): self.path.attributes['transform'] = " rotate(180)"
def assemble(self): p=partLine(linetype=self.lineType) height=float(blazon.Ordinary.HEIGHT)/self.pieces #"Chevronny of n" doesn't make all that much sense anyway. for i in range(0,self.pieces+2,2): p.move(-blazon.Ordinary.FESSPTX, blazon.Ordinary.FESSPTY-(i-2)*height) p.makelinerel(blazon.Ordinary.FESSPTX,-25,align=1) p.makelinerel(blazon.Ordinary.FESSPTX,25) p.relvline(-height) p.makelinerel(-blazon.Ordinary.FESSPTX,-25,align=1) p.makelinerel(-blazon.Ordinary.FESSPTX,25) p.closepath() self.path=SVGdraw.path(p) if (self.inverted): self.path.attributes['transform']=" rotate(180)"
def assemble(self): p=partLine(linetype=self.lineType) height=float(blazon.Ordinary.HEIGHT)/self.pieces # Problem. Optical center is at 0. Geometric center is a little lower, # owing to the placement of the coordinates. for i in range(1,self.pieces-1,2): p.rect(-blazon.Ordinary.WIDTH, -blazon.Ordinary.FESSPTY+i*height, 3*blazon.Ordinary.WIDTH, height) # Last piece is extra-wide because everything is shifted up to correct # for optical center. Only matters when pieces is even. # Also compensates for non-plain lines. if not self.pieces%2: p.rect(-blazon.Ordinary.WIDTH, -blazon.Ordinary.FESSPTY+(self.pieces-1)*height, 3*blazon.Ordinary.WIDTH, 3*height) self.path=SVGdraw.path(p) # Shift to bring center into place. self.path.attributes["transform"]=" translate(0,%.4f)"%\ -(blazon.Ordinary.HEIGHT/2 - blazon.Ordinary.FESSPTY)
def assemble(self): p=partLine(linetype=self.lineType) p.move(-blazon.Ordinary.FESSPTX,35) p.makeline(0,-5,1) p.makeline(blazon.Ordinary.FESSPTX,35,shift=-1) p.relvline(blazon.Ordinary.HEIGHT) p.relhline(-blazon.Ordinary.WIDTH) p.closepath() self.path=SVGdraw.path(p) trns="" try: trns+=" "+self.transform except AttributeError: pass if self.inverted: trns+=" rotate(180)" if trns: self.path.attributes['transform']=trns