def create_icon(self): surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, appconsts.THUMB_WIDTH, appconsts.THUMB_HEIGHT) cr = cairo.Context(surface) cr.set_source_rgb(*utils.gdk_color_str_to_cairo_rgb(self.gdk_color_str)) cr.rectangle(0, 0, appconsts.THUMB_WIDTH + 1, appconsts.THUMB_HEIGHT + 1) cr.fill() self.icon = surface
def create_mlt_producer(self, profile): width = profile.width() height = profile.height() surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height) cr = cairo.Context(surface) cr.set_source_rgb(*utils.gdk_color_str_to_cairo_rgb(self.gdk_color_str)) cr.rectangle(0, 0, width + 1, height+ 1) cr.fill() file_name = md5.new(self.gdk_color_str + str(width) + str(height)).hexdigest() write_file_path = utils.get_hidden_user_dir_path() + appconsts.RENDERED_CLIPS_DIR + "/" + file_name + ".png" surface.write_to_png(write_file_path) producer = mlt.Producer(profile, write_file_path) mltrefhold.hold_ref(producer) return producer
def create_mlt_producer(self, profile): width = profile.width() height = profile.height() surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height) cr = cairo.Context(surface) cr.set_source_rgb(*utils.gdk_color_str_to_cairo_rgb(self.gdk_color_str)) cr.rectangle(0, 0, width + 1, height+ 1) cr.fill() file_name = hashlib.md5((self.gdk_color_str + str(width) + str(height)).encode('utf-8')).hexdigest() write_file_path = userfolders.get_render_dir() + "/" + file_name + ".png" surface.write_to_png(write_file_path) producer = mlt.Producer(profile, write_file_path) mltrefhold.hold_ref(producer) return producer
def create_mlt_producer(self, profile): width = profile.width() height = profile.height() surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, width, height) cr = cairo.Context(surface) cr.set_source_rgb( *utils.gdk_color_str_to_cairo_rgb(self.gdk_color_str)) cr.rectangle(0, 0, width + 1, height + 1) cr.fill() file_name = md5.new(self.gdk_color_str + str(width) + str(height)).hexdigest() write_file_path = utils.get_hidden_user_dir_path( ) + appconsts.RENDERED_CLIPS_DIR + "/" + file_name + ".png" surface.write_to_png(write_file_path) producer = mlt.Producer(profile, write_file_path) mltrefhold.hold_ref(producer) return producer