Files

22 lines
918 B
Python
Raw Permalink Normal View History

2026-04-16 16:51:05 +08:00
import os
from UniTAP.common import VideoFrame, ColorInfo, DataInfo, get_vf_from_image
from UniTAP.utils import video_frame_to_ci
from .pdl_types import *
UNIGRAF_IMAGE_PATH = os.path.join(os.path.dirname(__file__), "Default_16K.png")
def generate_pattern_as_vf(pattern_type: PatternType, width: int, height: int,
color_info: ColorInfo, data_info: DataInfo) -> VideoFrame:
if pattern_type != PatternType.Unigraf:
raise NotImplementedError("Generating ColorRamp and ColorSquares not supported yet.")
if pattern_type == PatternType.Unigraf:
if not os.path.exists(UNIGRAF_IMAGE_PATH):
raise FileNotFoundError("Unigraf default image not found. Not possible to generate "
"Unigraf pattern.")
vf = get_vf_from_image(UNIGRAF_IMAGE_PATH, width, height)
return video_frame_to_ci(vf, color_info, data_info)