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
Beispiel #6
0
 def __init__(self, color, file, size=12):
     # FIXME: add support for bitmap fonts
     self.color = ImageColor.getrgb(color)
     self.font = ImageFont.truetype(file, size)
Beispiel #7
0
 def __init__(self, color, opacity=255):
     self.color = ImageColor.getrgb(color)
Beispiel #8
0
 def __init__(self, color, width=1, opacity=255):
     self.color = ImageColor.getrgb(color)
     self.width = width
Beispiel #9
0
def sepia(white="#fff0c0"):
    r, g, b = ImageColor.getrgb(white)
    r = _make_linear_lut(0, r)
    g = _make_linear_lut(0, g)
    b = _make_linear_lut(0, b)
    return ImagePalette("RGB", r + g + b)
Beispiel #10
0
	def __init__(self, color, file, size=12):
		# FIXME: add support for bitmap fonts
		self.color = ImageColor.getrgb(color)
		self.font = ImageFont.truetype(file, size)
Beispiel #11
0
	def __init__(self, color, opacity=255):
		self.color = ImageColor.getrgb(color)
Beispiel #12
0
	def __init__(self, color, width=1, opacity=255):
		self.color = ImageColor.getrgb(color)
		self.width = width