Add checkerboard for transpart frames.
This commit is contained in:
parent
0d1e7459e1
commit
6a1deb9b78
BIN
background.png
BIN
background.png
Binary file not shown.
Before Width: | Height: | Size: 3.6 KiB After Width: | Height: | Size: 44 KiB |
|
@ -6,6 +6,8 @@ import core
|
||||||
import time
|
import time
|
||||||
from queue import Queue, Empty
|
from queue import Queue, Empty
|
||||||
import numpy
|
import numpy
|
||||||
|
import os
|
||||||
|
from copy import copy
|
||||||
|
|
||||||
class Worker(QtCore.QObject):
|
class Worker(QtCore.QObject):
|
||||||
|
|
||||||
|
@ -19,6 +21,9 @@ class Worker(QtCore.QObject):
|
||||||
self.queue = queue
|
self.queue = queue
|
||||||
self.core.settings = parent.settings
|
self.core.settings = parent.settings
|
||||||
self.stackedWidget = parent.window.stackedWidget
|
self.stackedWidget = parent.window.stackedWidget
|
||||||
|
self.background = Image.new("RGBA", (1920, 1080),(0,0,0,0))
|
||||||
|
self.background.paste(Image.open(os.path.join(os.path.dirname(os.path.realpath(__file__)),"background.png")))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@pyqtSlot(str, list)
|
@pyqtSlot(str, list)
|
||||||
|
@ -41,7 +46,8 @@ class Worker(QtCore.QObject):
|
||||||
|
|
||||||
width = int(self.core.settings.value('outputWidth'))
|
width = int(self.core.settings.value('outputWidth'))
|
||||||
height = int(self.core.settings.value('outputHeight'))
|
height = int(self.core.settings.value('outputHeight'))
|
||||||
frame = Image.new("RGBA", (width, height),(0,0,0,0))
|
frame = copy(self.background)
|
||||||
|
frame = frame.resize((width,height))
|
||||||
|
|
||||||
components = nextPreviewInformation["components"]
|
components = nextPreviewInformation["components"]
|
||||||
for component in reversed(components):
|
for component in reversed(components):
|
||||||
|
|
|
@ -63,10 +63,16 @@ class Worker(QtCore.QObject):
|
||||||
self.bgI += 1
|
self.bgI += 1
|
||||||
|
|
||||||
def previewDispatch(self):
|
def previewDispatch(self):
|
||||||
|
background = Image.new("RGBA", (1920, 1080),(0,0,0,0))
|
||||||
|
background.paste(Image.open(os.path.join(os.path.dirname(os.path.realpath(__file__)), "background.png")))
|
||||||
|
background = background.resize((self.width, self.height))
|
||||||
|
|
||||||
while not self.stopped:
|
while not self.stopped:
|
||||||
i = self.previewQueue.get()
|
i = self.previewQueue.get()
|
||||||
if time.time() - self.lastPreview >= 0.06 or i[0] == 0:
|
if time.time() - self.lastPreview >= 0.06 or i[0] == 0:
|
||||||
self._image = ImageQt(i[1])
|
image = copy(background)
|
||||||
|
image = Image.alpha_composite(image, i[1])
|
||||||
|
self._image = ImageQt(image)
|
||||||
self.imageCreated.emit(QtGui.QImage(self._image))
|
self.imageCreated.emit(QtGui.QImage(self._image))
|
||||||
self.lastPreview = time.time()
|
self.lastPreview = time.time()
|
||||||
|
|
||||||
|
|
Reference in New Issue