Esempio n. 1
0
File: image.py Progetto: clones/kaa
    def draw_mask(self, mask_image, pos = (0, 0)):
        """
        Draw 'mask_image' over top of the existing image.  The luma channel of
        the mask image is blended with the alpha channel of the existing
        image.
        """
        if type(mask_image) in types.StringTypes:
            mask_image = imagelib.open(mask_image)
        elif isinstance(mask_image, CanvasImage):
            mask_image = mask_image.image

        self.image.draw_mask(mask_image, pos)
        self._image_changed()
Esempio n. 2
0
File: image.py Progetto: clones/kaa
    def set_image(self, image):
        """
        Sets the image for this object to 'image'
        """
        if type(image) in types.StringTypes:
            self.filename = image
            image = imagelib.open(image)
        elif isinstance(image, CanvasImage):
            image = image.image.copy()
            self.filename = None
        if self.image == image:
            return
        if image == None:
            self.reset()

        self.image = image
        self._image_changed()
Esempio n. 3
0
File: image.py Progetto: clones/kaa
 def draw_image(self, image, dst_pos = (0, 0), dst_size = (-1, -1),
            src_pos = (0, 0), src_size = (-1, -1), alpha = 255):
     """
     Draws (and blends) another image 'image' on top of the existing image,
     at position 'pos', a tuple containing the left and top coordinates
     relative to the destination image with layer alpha 'alpha'
     """
     if type(image) in types.StringTypes:
         image = imagelib.open(image)
     elif isinstance(image, CanvasImage):
         image = image.image
     if not self.image:
         if dst_size != (-1, -1):
             image.scale(dst_size)
         else:
             self.image = image
     else:
         self.image.blend(image, dst_pos, dst_size, src_pos, src_size,
                          alpha)
     self._image_changed()