def draw(self): fillColor = self.fillColor strokeColor = self.strokeColor g = Group() bg = self.background bd = self.border bdw = self.borderWidth shadow = self.shadow x, y = self.x, self.y if bg: if shadow is not None and 0<=shadow<1: shadow = Color(bg.red*shadow,bg.green*shadow,bg.blue*shadow) self._paintLogo(g,dy=-2.5, dx=2,fillColor=shadow) self._paintLogo(g,fillColor=fillColor,strokeColor=strokeColor) g.skew(kx=self.skewX, ky=self.skewY) g.shift(self._dx,self._dy) G = Group() G.add(g) _w, _h = 130, 86 w, h = self.width, self.height if bg or (bd and bdw): G.insert(0,Rect(0,0,_w,_h,fillColor=bg,strokeColor=bd,strokeWidth=bdw)) if w!=_w or h!=_h: G.scale(w/float(_w),h/float(_h)) angle = self.angle if self.angle: w, h = w/2., h/2. G.shift(-w,-h) G.rotate(angle) G.shift(w,h) G.shift(x,y) return G
def _borderDraw(self,f): s = self.size # abbreviate as we will use this a lot g = Group() g.add(f) x, y, sW = self.x+self.dx, self.y+self.dy, self.strokeWidth/2. g.insert(0,Rect(-sW, -sW, width=getattr(self,'_width',2*s)+3*sW, height=getattr(self,'_height',s)+2*sW, fillColor = None, strokeColor = self.strokeColor, strokeWidth=sW*2)) g.shift(x,y) g.scale(s/_size, s/_size) return g
def draw(self): fillColor = self.fillColor strokeColor = self.strokeColor g = Group() bg = self.background bd = self.border bdw = self.borderWidth shadow = self.shadow x, y = self.x, self.y if bg: if shadow is not None and 0 <= shadow < 1: shadow = Color(bg.red * shadow, bg.green * shadow, bg.blue * shadow) self._paintLogo(g, dy=-2.5, dx=2, fillColor=shadow) self._paintLogo(g, fillColor=fillColor, strokeColor=strokeColor, _ocolors=getattr(self, '_ocolors', None), _pagecolors=getattr(self, '_pagecolors', None)) g.skew(kx=self.skewX, ky=self.skewY) g.shift(self._dx, self._dy) G = Group() G.add(g) _w, _h = 130, 86 w, h = self.width, self.height if bg or (bd and bdw): G.insert( 0, Rect(0, 0, _w, _h, fillColor=bg, strokeColor=bd, strokeWidth=bdw)) if w != _w or h != _h: G.scale(w / float(_w), h / float(_h)) angle = self.angle if self.angle: w, h = w / 2., h / 2. G.shift(-w, -h) G.rotate(angle) G.shift(w, h) xFlip = getattr(self, 'xFlip', 0) and -1 or 0 yFlip = getattr(self, 'yFlip', 0) and -1 or 0 if xFlip or yFlip: sx = xFlip or 1 sy = yFlip or 1 G.shift(sx * x + w * xFlip, sy * y + yFlip * h) G = Group(G, transform=(sx, 0, 0, sy, 0, 0)) else: G.shift(x, y) return G
def draw(self): fillColor = self.fillColor strokeColor = self.strokeColor g = Group() bg = self.background bd = self.border bdw = self.borderWidth shadow = self.shadow x, y = self.x, self.y if bg: if shadow is not None and 0 <= shadow < 1: shadow = Color(bg.red * shadow, bg.green * shadow, bg.blue * shadow) self._paintLogo(g, dy=-2.5, dx=2, fillColor=shadow) self._paintLogo( g, fillColor=fillColor, strokeColor=strokeColor, _ocolors=getattr(self, "_ocolors", None), _pagecolors=getattr(self, "_pagecolors", None), ) g.skew(kx=self.skewX, ky=self.skewY) g.shift(self._dx, self._dy) G = Group() G.add(g) _w, _h = 130, 86 w, h = self.width, self.height if bg or (bd and bdw): G.insert(0, Rect(0, 0, _w, _h, fillColor=bg, strokeColor=bd, strokeWidth=bdw)) if w != _w or h != _h: G.scale(w / float(_w), h / float(_h)) angle = self.angle if self.angle: w, h = w / 2.0, h / 2.0 G.shift(-w, -h) G.rotate(angle) G.shift(w, h) xFlip = getattr(self, "xFlip", 0) and -1 or 0 yFlip = getattr(self, "yFlip", 0) and -1 or 0 if xFlip or yFlip: sx = xFlip or 1 sy = yFlip or 1 G.shift(sx * x + w * xFlip, sy * y + yFlip * h) G = Group(G, transform=(sx, 0, 0, sy, 0, 0)) else: G.shift(x, y) return G