def scale(self, context, width, height): if not self.width: self.width = width if not self.height: self.height = height scale = Scale() scale.horizontal = self.width / float(width) scale.vertical = self.height / float(height) if scale.horizontal: context.scale(scale.horizontal, 1.0) else: scale.horizontal = 1 if scale.vertical: context.scale(1.0, scale.vertical) else: scale.vertical = 1 return (scale.horizontal, scale.vertical)
def scale(self, context, width, height): if not self.width: self.width = width if not self.height: self.height = height scale = Scale() if width: scale.horizontal = self.width / width if height: scale.vertical = self.height / height if scale.horizontal: context.scale(scale.horizontal, 1.0) if scale.vertical: context.scale(1.0, scale.vertical)