mirror of
https://github.com/iperov/DeepFaceLive
synced 2025-08-19 21:13:21 -07:00
code release
This commit is contained in:
parent
b941ba41a3
commit
a902f11f74
354 changed files with 826570 additions and 1 deletions
32
xlib/qt/gui/from_file.py
Normal file
32
xlib/qt/gui/from_file.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
from PyQt6.QtGui import *
|
||||
|
||||
from .QXImage import QXImage
|
||||
from .QXPixmap import QXPixmap
|
||||
|
||||
|
||||
def QPixmap_from_file(filepath, color=None):
|
||||
img = QPixmap(str(filepath))
|
||||
|
||||
if color is not None:
|
||||
qp = QPainter(img)
|
||||
qp.setCompositionMode(QPainter.CompositionMode.CompositionMode_SourceIn)
|
||||
qp.fillRect( img.rect(), QColor(color) )
|
||||
qp.end()
|
||||
return img
|
||||
|
||||
def QXPixmap_from_file(filepath, color=None):
|
||||
img = QXPixmap(str(filepath))
|
||||
|
||||
if color is not None:
|
||||
qp = QPainter(img)
|
||||
qp.setCompositionMode(QPainter.CompositionMode.CompositionMode_SourceIn)
|
||||
qp.fillRect( img.rect(), QColor(color) )
|
||||
qp.end()
|
||||
return img
|
||||
|
||||
def QXImage_from_file(filepath, color=None):
|
||||
return QXImage(QPixmap_from_file(filepath, color).toImage())
|
||||
|
||||
|
||||
def QIcon_from_file(filepath, color='black'):
|
||||
return QIcon(QPixmap_from_file(filepath,color=color))
|
Loading…
Add table
Add a link
Reference in a new issue