Ejemplo n.º 1
0
Archivo: ImageDraw.py Proyecto: nh/imgc
 def setink(self, ink):
     # compatibility
     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)
Ejemplo n.º 2
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)
Ejemplo n.º 3
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
Ejemplo n.º 4
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
Ejemplo n.º 5
0
 def setink(self, ink):
     # compatibility
     if warnings:
         warnings.warn(
             "'setink' is deprecated; use keyword arguments instead",
             DeprecationWarning)
     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)
Ejemplo n.º 6
0
def get_ink_with_alpha(self, fill=None, alpha=None):
    ink = self.ink if (fill == None) else fill
    if ink == None:
        return ink
    if Image.isStringType(ink):
        ink = ImageColor.getcolor(ink, self.mode)
    if self.palette and not Image.isNumberType(ink):
        ink = self.palette.getcolor(ink)
    if alpha != None:  #and self.mode == "RGBA"
        ink = ink[:3] + (alpha, )
    #print ink
    return self.draw.draw_ink(ink, self.mode)
Ejemplo n.º 7
0
def get_ink_with_alpha(self, fill=None, alpha=None):
	ink = self.ink if (fill == None) else fill
	if ink == None:
		return ink
	if Image.isStringType(ink):
		ink = ImageColor.getcolor(ink, self.mode)
	if self.palette and not Image.isNumberType(ink):
		ink = self.palette.getcolor(ink)
	if alpha != None: #and self.mode == "RGBA"
		ink = ink[:3]+(alpha,)
	#print ink
	return self.draw.draw_ink(ink, self.mode)