in src/spg_icvfxpatterns/PatternGenerators/frameCountSync.py [0:0]
def generator(cls, frame, kwargs, results):
""" The function which generates the actual image for the current frame
:param frame: the frame number we are generating
:param kwargs: a dictionary of arguments needed for this generator
:param results: a dictionary to store the results cross thread
"""
led_wall = kwargs.get("led_wall", None)
if led_wall is None:
raise ValueError("led_wall not found in kwargs")
timecode_frame = kwargs.get("timecode_frame", None)
if timecode_frame is None:
raise ValueError("timecode_frame not found in kwargs")
frame_num, full_file_path = cls.get_frame_num_and_file_path(frame, led_wall.name)
led_wall_image = cls.create_solid_color_image(
led_wall.resolution_width, led_wall.resolution_height
)
# We create an image for the resolution of our panel
panel_image = cls.create_solid_color_image(
led_wall.panel.panel_resolution_width,
led_wall.panel.panel_resolution_height,
color=led_wall.wall_default_color
)
# We add a border of given border width and color
_imageUtils.add_border_to_image(
panel_image, cls.border_width, border_color=cls.border_color)
for panel_count_width in range(led_wall.panel_count_width):
x_offset = led_wall.panel.panel_resolution_width * panel_count_width
for panel_count_height in range(led_wall.panel_count_height):
y_offset = led_wall.panel.panel_resolution_height * panel_count_height
per_panel_image = panel_image.copy()
# We add text to the centre of the image for the given timecode frame
_imageUtils.add_text_to_image_centre(per_panel_image, str(timecode_frame))
# We insert the panel image into the whole led wall image
oiio.ImageBufAlgo.paste(
led_wall_image, x_offset, y_offset, 0, 0, per_panel_image, roi=oiio.ROI.All
)
# Write the image to disk and store the result
cls.write_image_and_store_result(
frame_num, full_file_path, led_wall.name, led_wall_image, results
)