Beispiel #1
0
 def _getink(self, ink, fill=None):
     if ink is None and fill is None:
         if self.fill:
             fill = self.ink
         else:
             ink = self.ink
     else:
         if ink is not None:
             if Image.isStringType(ink):
                 ink = ImageColor.getcolor(ink, self.mode)
             if self.palette and not Image.isNumberType(ink):
                 ink = self.palette.getcolor(ink)
             ink = self.draw.draw_ink(ink, self.mode)
         if fill is not None:
             if Image.isStringType(fill):
                 fill = ImageColor.getcolor(fill, self.mode)
             if self.palette and not Image.isNumberType(fill):
                 fill = self.palette.getcolor(fill)
             fill = self.draw.draw_ink(fill, self.mode)
     return ink, fill
Beispiel #2
0
	def _getink(self, ink, fill=None):
		if ink is None and fill is None:
			if self.fill:
				fill = self.ink
			else:
				ink = self.ink
		else:
			if ink is not None:
				if Image.isStringType(ink):
					ink = ImageColor.getcolor(ink, self.mode)
				if self.palette and not Image.isNumberType(ink):
					ink = self.palette.getcolor(ink)
				ink = self.draw.draw_ink(ink, self.mode)
			if fill is not None:
				if Image.isStringType(fill):
					fill = ImageColor.getcolor(fill, self.mode)
				if self.palette and not Image.isNumberType(fill):
					fill = self.palette.getcolor(fill)
				fill = self.draw.draw_ink(fill, self.mode)
		return ink, fill
Beispiel #3
0
 def setink(self, ink):
     # compatibility
     if warnings:
         warnings.warn(
             "'setink' is deprecated; use keyword arguments instead",
             DeprecationWarning,
             stacklevel=2)
     if Image.isStringType(ink):
         ink = ImageColor.getcolor(ink, self.mode)
     if self.palette and not Image.isNumberType(ink):
         ink = self.palette.getcolor(ink)
     self.ink = self.draw.draw_ink(ink, self.mode)
Beispiel #4
0
	def setink(self, ink):
		# compatibility
		if warnings:
			warnings.warn(
				"'setink' is deprecated; use keyword arguments instead",
				DeprecationWarning, stacklevel=2
				)
		if Image.isStringType(ink):
			ink = ImageColor.getcolor(ink, self.mode)
		if self.palette and not Image.isNumberType(ink):
			ink = self.palette.getcolor(ink)
		self.ink = self.draw.draw_ink(ink, self.mode)
Beispiel #5
0
def _color(color, mode):
    if Image.isStringType(color):
        from lib.pil import ImageColor
        color = ImageColor.getcolor(color, mode)
    return color