Exemple #1
0
    def _generate_thumbnail(self, uid: int):
        """
        Generate the pixbuf for C{path} at demand
        """

        size = config['THUMBNAIL_SIZE']
        pixbuf = self.__window.imagehandler.get_thumbnail(page=uid,
                                                          size=(size, size))
        if pixbuf is not None:
            pixbuf = ImageTools.add_border(pixbuf, self.__border_size)

        return pixbuf
    def _generate_thumbnail(self, uid: int):
        """
        Generate the pixbuf for C{path} at demand
        """

        size = config['THUMBNAIL_SIZE']
        pixbuf = self.__image_handler.get_thumbnail(page=uid,
                                                    size=(size, size))
        if pixbuf is None:
            return None

        return ImageTools.add_border(pixbuf)
Exemple #3
0
    def _get_lens_pixbuf(self, x: int, y: int):
        """
        Get a pixbuf containing the appropiate image data for the lens
        where <x> and <y> are the positions of the cursor
        """

        canvas = GdkPixbuf.Pixbuf.new(colorspace=GdkPixbuf.Colorspace.RGB,
                                      has_alpha=True, bits_per_sample=8,
                                      width=config['LENS_SIZE'],
                                      height=config['LENS_SIZE'])
        canvas.fill(0x000000FF)  # black
        cb = self.__window.get_layout().get_content_boxes()
        source_pixbufs = self.__window.imagehandler.get_pixbufs(len(cb))
        for idx, item in enumerate(cb):
            if ImageTools.is_animation(source_pixbufs[idx]):
                continue
            cpos = cb[idx].get_position()
            self._add_subpixbuf(canvas, x - cpos[0], y - cpos[1], cb[idx].get_size(), source_pixbufs[idx])

        return ImageTools.add_border(canvas, 1)
Exemple #4
0
 def set_thumbnail(self, pixbuf):
     pixbuf = ImageTools.add_border(pixbuf, 1)
     self.__thumb.set_from_pixbuf(pixbuf)