コード例 #1
0
ファイル: bitmap.py プロジェクト: fenixchen/osd_engine
    def __init__(self,
                 window,
                 id,
                 bitmaps,
                 transparent_color=None,
                 current_bitmap=0):
        self._object_index = None
        self._palette = window.palettes[1]
        self._window = window
        self._id = id

        self._data = []
        if isinstance(bitmaps, str):
            bitmaps = [bitmaps]
        assert (isinstance(bitmaps, list))
        self._bitmap_count = len(bitmaps)
        self._transparent_color = transparent_color
        self._current_bitmap = current_bitmap
        color_data = []
        for bitmap in bitmaps:
            self._width, self._height, data = ImageUtil.load(
                bitmap, transparent_color)
            color_data.extend(data)

        self._data = self._palette.extend(color_data, transparent_color)

        self._current = 0
コード例 #2
0
 def __init__(self, scene, id, bitmaps, palette=None):
     super().__init__(scene, id, palette)
     self._data = []
     if isinstance(bitmaps, str):
         bitmaps = [bitmaps]
     assert (isinstance(bitmaps, list))
     self._count = len(bitmaps)
     for bitmap in bitmaps:
         self._width, self._height, data = ImageUtil.load(bitmap)
         self._data.extend(data)
     self._current = 0
     assert (len(self._data) == self._width * self._height * self._count)
コード例 #3
0
ファイル: bitmap.py プロジェクト: fenixchen/osd_engine
    def __init__(self,
                 window,
                 id,
                 bitmaps,
                 palette=None,
                 mask_color=None,
                 width=None,
                 height=None,
                 tiled=False,
                 transparent_color=None,
                 mutable=False,
                 current_bitmap=0):

        super().__init__(window, id, palette, mutable)

        self._data = []
        if isinstance(bitmaps, str):
            bitmaps = [bitmaps]
        assert (isinstance(bitmaps, list))
        self._bitmap_count = len(bitmaps)
        self._width = width
        self._height = height
        self._tiled = tiled
        self._mask_color = mask_color
        self._bitmap_width = 0
        self._bitmap_height = 0
        self._transparent_color = transparent_color
        self._current_bitmap = current_bitmap
        color_data = []
        for bitmap in bitmaps:
            self._bitmap_width, self._bitmap_height, data = ImageUtil.load(
                bitmap)
            color_data.extend(data)

        assert self._bitmap_width > 0 and self._bitmap_height > 0

        self._palette, self._data = window.extend_color(
            color_data, self._palette)

        self._current = 0

        assert (len(self._data) == self._bitmap_width * self._bitmap_height *
                self._bitmap_count)

        if self._width is None:
            self._width = self._bitmap_width

        if self._height is None:
            self._height = self._bitmap_height