def __init__(self, g_pool,selected_watermark_path = None,pos = (20,20)):
super().__init__(g_pool)
self.order = .9
self.menu = None
available_files = glob(os.path.join(self.g_pool.user_dir,'*png')) #we only look for png's
self.available_files = [f for f in available_files if cv2.imread(f,-1).shape[2]==4] #we only look for rgba images
logger.debug('Found {} watermark files: {}'.format(len(self.available_files), self.available_files))
self.watermark = None
self.watermark_path = None
self.alpha_mask = None
if selected_watermark_path in self.available_files:
self.load_watermark(selected_watermark_path)
elif self.available_files:
self.load_watermark(self.available_files[0])
else:
logger.warning("No .png files found. Make sure they are in RGBA format.")
self.pos = list(pos) #if we make the default arg a list the instance will edit the default vals and a new call of the class constructor creates an ainstace with modified default values.
self.move_watermark = False
self.drag_offset = None
评论列表
文章目录